Server Side Template Injection: To present data dynamically from emails or webpages we use templates and unsafely use of it leads to server exploits like RCE and many more.
服务器端模板注入:为了从电子邮件或网页中动态显示数据,我们使用模板,并且不安全地使用它会导致服务器漏洞利用,例如RCE等。
So when user controlled input is embedded directly into template, it may cause of SSTI. This may occurs as developer want to offer rich functionality.
因此,当用户控制的输入直接嵌入到模板中时,可能会导致SSTI。 当开发人员想要提供丰富的功能时,可能会发生这种情况。
Example: There is application that has functionality where users can send emails to their customer and the content of the email can be modified by the user. So if developer is using templates such as freemarker or twig for rich email experience and directly passing the inputs from the user for processing and sending the email. Attacker can inject malicious inputs in order to run the commands on the server.
示例:存在具有功能的应用程序,用户可以在其中向用户发送电子邮件,并且用户可以修改电子邮件的内容。 因此,如果开发人员正在使用诸如freemarker或twig之类的模板来获得丰富的电子邮件体验,并直接传递用户输入来处理和发送电子邮件。 攻击者可以注入恶意输入,以便在服务器上运行命令。
Working:
加工:
· User enter the malicious input in the application which is using templates.
·用户在使用模板的应用程序中输入恶意输入。
· Application transfers the malicious inputs without validating to the template engine
·应用程序在不验证模板引擎的情况下传输恶意输入
· Template engine processes invalidated input which may cause code execution on the server.
·模板引擎处理无效的输入,这可能导致服务器上的代码执行。
Detect: To test for template engine we can try some simple payloads if they gets evaluated then the application is vulnerable to template injection.
检测:要测试模板引擎,我们可以尝试一些简单的有效负载(如果经过评估),则应用程序容易受到模板注入的攻击。
Different la