加入收藏 | 设为首页 | 会员中心 | 我要投稿 核心网 (https://www.hxwgxz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程 > 正文

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

发布时间:2020-12-24 18:45:04 所属栏目:编程 来源:网络整理
导读:GET方式SQL注入攻击网站入侵防守代码. '-------------------------------------------------------------------------- http://61.144.185.39/System_BBS_ShowInfo.asp?pid=1cid=8';exec%20master.dbo.xp_cmdshell%20"net user test test /add;--aid=8sid=4pa

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防守方式要小心过滤一些必要的参数.

(编辑:核心网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    热点阅读