<p>SQL注入一:</p><p>漏洞文件:/help.asp</p><p>这里id参数过滤不严存在sql注入的,但是conn.asp中包含了:</p><pre class="lang-php" data-lang="php"><!--#include file="conn.asp"--> <!--#include file="inc/config.asp"--> <% if trim(request("id")) &lt;&gt; "" then set rs=conn.execute("select * from help where id ="&amp;trim(request("id"))&amp;" order by paixu asc") if not rs.eof then title=rs("help_title") content=rs("help_content") end if else set rs=conn.execute("select top 1 * from help order by paixu asc") if not rs.eof then title=rs("help_title") content=rs("help_content") end if end if%> </pre><p>SQL注入二</p><p>漏洞文件:/card_server.asp</p><p>这里没有直接包含数据库连接文件,直接创建了连接对象,导致这一个注入是无法被sqlin.asp防御,注意,Request的sel参数没有过滤直接带入查询导致了SQL注入。简单构造一下注入点:</p><p><a href="http://127.0.0.1/card_server.asp?sel=1">http://127.0.0.1/card_server.asp?sel=1</a>′</p><p>Microsoft JET Database Engine 错误 ‘80040e14′<br>字符串的语法错误 在查询表达式 ‘parentid=1” 中。<br>/card_server.asp,行 28</p><p>GETSHELL:</p><p>漏洞文件:/SqlIn.Asp</p><pre...
<p>SQL注入一:</p><p>漏洞文件:/help.asp</p><p>这里id参数过滤不严存在sql注入的,但是conn.asp中包含了:</p><pre class="lang-php" data-lang="php"><!--#include file="conn.asp"--> <!--#include file="inc/config.asp"--> <% if trim(request("id")) &lt;&gt; "" then set rs=conn.execute("select * from help where id ="&amp;trim(request("id"))&amp;" order by paixu asc") if not rs.eof then title=rs("help_title") content=rs("help_content") end if else set rs=conn.execute("select top 1 * from help order by paixu asc") if not rs.eof then title=rs("help_title") content=rs("help_content") end if end if%> </pre><p>SQL注入二</p><p>漏洞文件:/card_server.asp</p><p>这里没有直接包含数据库连接文件,直接创建了连接对象,导致这一个注入是无法被sqlin.asp防御,注意,Request的sel参数没有过滤直接带入查询导致了SQL注入。简单构造一下注入点:</p><p><a href="http://127.0.0.1/card_server.asp?sel=1">http://127.0.0.1/card_server.asp?sel=1</a>′</p><p>Microsoft JET Database Engine 错误 ‘80040e14′<br>字符串的语法错误 在查询表达式 ‘parentid=1” 中。<br>/card_server.asp,行 28</p><p>GETSHELL:</p><p>漏洞文件:/SqlIn.Asp</p><pre class="lang-php" data-lang="php"><function OpenDB(sdbname) { /* *--------------- OpenDB(sdbname) ----------------- * OpenDB(sdbname) * 功能:打开数据库sdbname,返回conn对象. * 参数:sdbname,字符串,数据库名称. * 实例:var conn = OpenDB("database.mdb"); *--------------- OpenDB(sdbname) ----------------- */ /*var connstr = "driver={SQL Server};server=.;uid=sa;pwd=7881541;database=wangyou";*/ var connstr = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="+Server.MapPath(sdbname); var conn = Server.CreateObject("ADODB.Connection"); conn.Open(connstr); return conn; } var oConn = OpenDB("HSGAMEDB/#HSgame201008041121.asp"); var sel = Request("sel"); var classid = Request("classid") var fieldname = Request("fieldname") var arrResult = new Array(); //var sql = "select "+fieldname+" from game_class where parentid='"+sel+"' and classid="+classid; var sql = "select * from card_class where parentid="+sel+""; //Response.Write("alert("+sql+")") var rs0 = Server.CreateObject("ADODB.Recordset"); rs0.Open(sql,oConn,1,1); while(!rs0.EOF) { //遍历所有适合的数据放入arrResult数组中. arrResult[arrResult.length] = rs0(0).Value+"|"+rs0(1).Value; rs0.MoveNext(); } //escape解决了XMLHTTP。中文处理的问题. //数组组合成字符串.由","字符串连接. Response.Write(escape(arrResult.join(","))); %> </pre><p>这里直接将用户非法提交的字符串写入了sql_whelpu.asp的数据库里面了,试想一下,如果故意加入一句话不就可以GETSHELL了吗? 在没有被人插入过asp的<%%>符号则可直接访问:</p><p>当然如果有被人提交过的需要注意闭合就可以获取webshell了~ 这里成功将一句话写入数据库:sql_whelpu.asp,我们打开看看是不是呢?</p>