GHSL-2020-045: Server-side template injection in Atlassian Confluence - CVE-2020-4027
A user with permission to edit User macros could bypass the Velocity sandbox and execute arbitrary Java code or system commands. This allowed remote code execution with the privileges of the Confluence process.
Originally disclosed on GitHub Security Lab
A user with privileges to edit User macros may execute arbitrary Java code or run arbitrary system commands with the same privileges as the account running Confluence.
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 report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Velocity sandbox (SecureUberspector) was incomplete because the Templating API exposed objects whose object graph allowed instantiation of arbitrary Java classes.
Impact
This issue may lead to Remote Code Execution.
What the attacker needed
Privileges to edit User macros
The fix
The issue was fixed in Confluence 7.5.1, and additional RCE vectors were fixed later.
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 report has not been written yet. The Original tab links to the source.
User macros are small templates that let people customise Confluence pages. The template engine tries to restrict what those templates can do, but the restrictions could be bypassed to run harmful code on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.