当前位置:网站首页>[CISCN2019 华东南赛区]Web11
[CISCN2019 华东南赛区]Web11
2022-08-05 03:52:00 【pakho_C】
[CISCN2019 华东南赛区]Web11
头一次见smarty ssti的题
smart ssti:
smart是php的模板引擎,模板引擎的作用就是分离前端页面和数据的,题目中显示API的URL由于环境的原因无法使用,但我们的IP依旧显示在了页面的右上角,且根据它的提示XFF我们很容易想到,在X-Forwarded-For里构造ssti:payload。
又祭出这张图了:
根据页面的提示,很可能要在XFF头中构造:
测试:
确实存在smarty ssti
看了另一位师傅的wp:
Smarty支持使用{php}{/php}标签来执行被包裹其中的php指令,那么我们可以使用{php}{/php}标签来构造payload,但是本题会报错
因为现在的smart已经不用此标签了。
可以用{$smarty.version}来看一下版本。
测试了一下,的确如此

这个版本已经不支持php标签了
虽然php标签不能用,但是还有个{if}标签。 Smarty的{if}条件判断和PHP的if
非常相似,只是增加了一些特性。每个{if}必须有一个配对的{/if}. 也可以使用{else} 和 {elseif}.
全部的PHP条件表达式和函数都可以在if内使用,如*||*,or,&&,and,is_array(), 等等既然全部的PHP条件表达式和函数都可以在if内使用,那我们在里面写php代码也行。 {if phpinfo()}{/if}
执行 {if phpinfo()}{/if}尝试
成功回显
直接执行命令:{if system('cat /flag')}{/if}
原理介绍,参考另一位师傅的wp里的:
<?php
require_once('./smarty/libs/' . 'Smarty.class.php');
$smarty = new Smarty();
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
//获取XFF
$smarty->display("string:".$ip);
//此处并不是以smart模板格式,而是以字符串形式,所以会解析我们的标签,也就是if,解析后把内容回显到页面上的相应位置
}
边栏推荐
猜你喜欢

Getting Started with Kubernetes Networking

Web3.0 Dapps - the road to the future financial world

Increasing leetcode - a daily topic 1403. The order of the boy sequence (greed)

On governance and innovation, the 2022 OpenAtom Global Open Source Summit OpenAnolis sub-forum came to a successful conclusion

多御安全浏览器新版下载 | 功能优秀性能出众

UE4 通过互动(键盘按键)开门

从企业的视角来看,数据中台到底意味着什么?

leetcode-每日一题1403. 非递增顺序的最小子序列(贪心)

After the large pixel panorama is completed, what are the promotion methods?

2022-08-04T17:50:58.296+0800 ERROR Announcer-3 io.airlift.discovery.client.Announcer appears after successful startup of presto
随机推荐
Ice Scorpion V4.0 attack, security dog products can be fully detected
36-Jenkins-Job Migration
905. Interval selection
Developing Hololens encountered The type or namespace name 'HandMeshVertex' could not be found..
Spark Basics [Introduction, Getting Started with WordCount Cases]
How to Add Category-Specific Widgets in WordPress
[Solved] Unity Coroutine coroutine is not executed effectively
Swing有几种常用的事件处理方式?如何监听事件?
Use Unity to publish APP to Hololens2 without pit tutorial
Call Alibaba Cloud oss and sms services
[Software testing] unittest framework for automated testing
2022.8.4-----leetcode.1403
Redis key basic commands
Android 面试题——如何徒手写一个非阻塞线程安全队列 ConcurrentLinkedQueue?
iMedicalLIS监听程序(2)
2022 High-level installation, maintenance, and removal of exam questions mock exam question bank and online mock exam
冰蝎V4.0攻击来袭,安全狗产品可全面检测
On governance and innovation, the 2022 OpenAtom Global Open Source Summit OpenAnolis sub-forum came to a successful conclusion
You may use special comments to disable some warnings. 报错解决的三种方式
包拉链不可用,但是是被另一个包。