T086学习网 | 站长学院 | 技术文档 | 成语 | 歇后语 | 帝国时代 | 代码收藏 | IP地址查询 | 生活百科 | 生日密码 | CSS压缩 | 用户评论 | 欣欣百宝箱

GET方式SQL注入攻击网站入侵防守代码.

【 来源:DVBBS作者:Scripts.NET 更新时间:2004-04-16 | 字体:
[导读]GET方式SQL注入攻击网站入侵防守代码. '--------------------------------------------------------------------------http://61.144.185.39/System_BBS_ShowInfo.asp?pid=1&cid=8';exec%20master.dbo.xp_cmdshe...
GET方式SQL注入攻击网站入侵防守代码.
'--------------------------------------------------------------------------
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防守方式要小心过滤一些必要的参数.
  • 转载请注明来源:IT学习网 网址:http://www.t086.com/ 向您的朋友推荐此文章
  • 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系我们,我们会尽快予以更正。
更多
留言建议ASP探针PHP探针站长Enjoy的Blog
© 2017 T086学习网 - T086.com(原itlearner.com)
RunTime:15.54ms QueryTime:7