一、SSTI简介SSTI就是服务器端模板注入(Server-Side Template Injection),实际上也是一种注入漏洞。由于未对用户输入的数据进行过滤,导致由用户输入的模板引擎渲染标识符中的内容被渲染,导致RCE(任意代码执行)漏洞。二、判断模板引擎最出名的一张图。解释:绿色箭头指成功执行,红色箭头指原样返回或报错。区分Jinja2与Twig通过{{7*'7'}}返回的值。Jinja2:7777777Twig:49三、Smarty1. 简介这是一个基于PHP服务的模板引擎,是为了让前端界面(html)与程序代码(php)分离而产生的一种解决方案,Smarty 的原理是变量替换原则,我们只需要在html文件里写好Smarty的标签即可,如果对用户的输入不加处理直接回显可能会导致SSTI漏洞。2. 漏洞确认POC:{$smarty.version}返回版本号。3. 任意文件读取POC:string:{include file='[file path]'}解释:{include}标签所导致,被该标签引入的文件只会单纯的输出文件内容,就算引入 php 文件也是如此。通过self获
Equinox
一个乐于分享的网安人