Lab: Basic server-side template injection (code context)
Summary: PortSwigger's lab demonstrates server-side template injection in a Tornado template, where the "preferred name" feature lets a user escape the {{someExpression}} syntax and inject arbitrary template code. The exercise requires using Tornado's syntax for executing arbitrary Python to delete the morale.txt file from Carlos's home directory via the POST /my-account/change-blog-post-author-display endpoint.
Key Takeaway: The flaw is a single user-editable field passed unsafely into a template, and the payoff is arbitrary Python execution that reaches another user's files - a reminder that template engines turn small input-handling mistakes into full code execution.
Read the original at PortSwigger Research ↗
- Topics
- Vulnerabilities & Patching
- Related
- Attackers Exploit UnrealIRCd Flaw That Enables Server-Level Command Injection Cyber Risks · Nov 14, 2026U.S. CISA adds Check Point and UnrealIRCd flaws to its Known Exploited Vulnerabilities catalog Cyber Risks · Nov 14, 2026PostgreSQL Patches 52 Flaws, Including 22-Year-Old Bug Enabling Authenticated RCE Cyber Risks · Nov 13, 2026