SSTI leads to RCE on PyroCMS
The PyroCMS admin interface allowed template code in fields such as the role Description, so an authenticated user could run server commands. The author demonstrated this by reading a system file.
Whats is Pyro? Pyro is a content management system (CMS) that was built using the PHP programming language.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, user-controlled fields were rendered by the Twig template engine without sanitisation, allowing template expressions to be evaluated.
Impact
An authenticated user with role-editing permissions could execute arbitrary commands on the server, potentially escalating privileges or accessing sensitive files.
What the attacker needed
Authenticated access; permission to edit roles
How it was found
- Log in to PyroCMS with an account that can edit roles.
- Go to the Users > Roles section and edit the Admin role.
- Enter template code in the Description field.
- Save the role and observe the command output.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A template engine fills in placeholders like {{7*7}} to build web pages. If a site puts user input into a template without checking it, the engine may run that input as code. Here, an admin could type template code into a description field and make the server run commands.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.