Cyber Risks · PortSwigger Research

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