KEMBAR78
Basics of Server Side Template Injection | PPTX
Basics of Server Side
Template Injection
By
Shrutirupa(@freak_crypt)
What are Template Engines?
Template Engines are:
1. Widely used by web applications for dynamically generating data.
2. These data are generated through web pages or emails.
What is Server Side Template Injection??
1. We are able to inject some malicious piece of code through the improper/unsafe embedded input
into the templates used
2. This may result into the execution of commands at the server side
What is the first step towards detecting an
SSTI?
1. Unusual behaviour
2. Errors
3. Mathematical expressions getting executed
Ways to detect:
1. {{4*6}}
2. {4*6}
3. ${4*6}
4. ${{7*7}}
5. <%= 7 * 7 %>
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20I
njection
What’s next?
Figuring out the templates used at the backend!!!
Based on the template used, injecting codes accordingly
An example:
Let’s go to:
http://challenge01.root-me.org/web-serveur/ch41/
curl 'http://challenge01.root-me.org/web-serveur/ch41/' -v
Also:
Through curl:
Mitigations
1. Executing users’ code in a sandboxed environment to lower the risk
2. Sandboxing inside a locked down Docker container
3. Validation of input field is always one way to avoid any malicious user to enter any unethical code
Any Questions??
References
https://portswigger.net/kb/papers/serversidetemplateinjection.pdf
https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Server%20Side%20Template%20I
njection
https://www.we45.com/blog/server-side-template-injection-a-crash-course-
Basics of Server Side Template Injection

Basics of Server Side Template Injection