Server-Side Template Injection (SSTI): A Practical Overview
Overview
Server-side template injection occurs when user input is embedded into server templates in a way that alters template syntax, not just rendered text. Impact can escalate from content injection to server-side code execution depending on the engine.
What You Will Learn
• Common locations
• Testing signals (high level)
• Remediation

Common locations
• Email subject/body templates
• PDF/invoice generators
• Error pages and notification systems
• CMS themes and custom expression languages
Testing signals (high level)
• Input reflected inside template expressions or engine-specific syntax zones
• Different responses when template metacharacters are introduced carefully in labs/authorized targets
• Template engine fingerprinting via documentation and stack clues—not blind destructive probing
Remediation
• Never concatenate untrusted input into template source
• Pass user data as template variables only
• Sandbox engines where possible and keep logic out of templates
• Code review any dynamic template compilation features
Conclusion
Use this guide only on systems you are authorized to test. At SapiensHack, we focus on clear methodology, solid notes, and findings that help teams fix real risk—not noisy scanner output.
If you want related reading, browse the matching category in the sidebar and continue the series from there.




Comments