当前位置:网站首页>[CISCN2019 South China Division]Web11

[CISCN2019 South China Division]Web11

2022-08-05 03:59:00 pakho_C

[CISCN2019 South China Division]Web11
insert image description here
headerSee the question of smarty ssti once

smart ssti:
smart is the template engine of php. The function of the template engine is to separate the front-end page and data. The URL of the API displayed in the title cannot be used due to environmental reasons, but our IP is still displayed on the page., and according to its prompt XFF, we can easily think of constructing ssti:payload in X-Forwarded-For.

Here's another image:
insert image description here
According to the hint on the page, it is likely to be constructed in the XFF header:
Test:
hereInsert image description
Smarty ssti does exist
Saw another master's wp:

Smarty supports the use of {php}{/php} tags to execute the php instructions wrapped in them, then we can use the {php}{/php} tags to construct the payload, but this question will report an error
Because the current smartThis label is no longer used.
You can check the version with {$smarty.version}.

Tested it and it did
insert image description here

This version no longer supports php tags

Although the php tag cannot be used, there is an {if} tag.Smarty's {if} conditional judgment is very similar to PHP's if
, but with some additional features.Each {if} must have a matching {/if}. {else} and {elseif} can also be used.
All PHP conditional expressions and functions can be used inside if, such as *||*,or,&&,and,is_array(), etc.

Since all PHP conditional expressions and functions can be used inside if, we can also write PHP code inside.{if phpinfo()}{/if}

Execute {if phpinfo()}{/if}try
insert image description here
Successful echo
Execute the command directly: {if system('cat /flag')}{/if}
Insert picture description here
Principle introduction, refer to In another master’s wp:

require_once('./smarty/libs/' . 'Smarty.class.php');$smarty = new Smarty();$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];//Get XFF$smarty->display("string:".$ip);//This is not in the smart template format, but in the form of a string, so our tag will be parsed, that is, if, and the content will be echoed to the corresponding position on the page after parsing}
原网站

版权声明
本文为[pakho_C]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/217/202208050351457454.html

随机推荐