GHSL-2020-039: Server-side template injection in Alfresco - CVE-2020-12873
A user with privileges to edit a FreeMarker template could bypass the FreeMarker sandbox and execute arbitrary Java code or system commands with the same privileges as the Alfresco account. This could lead to remote code execution.
Originally disclosed on GitHub Security Lab
A user with privileges to edit a FreeMarker template (e.g. a webscript) may execute arbitrary Java code or run arbitrary system commands with the same privileges as the account running Alfresco.
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 FreeMarker sandbox in Alfresco exposes objects whose object graph can be traversed to reach classes that allow instantiation of arbitrary Java objects, bypassing the sandbox restrictions.
Impact
This issue may lead to Remote Code Execution.
What the attacker needed
Privileges to edit a FreeMarker template
The fix
The issue was fixed by Alfresco on 13 May 2020.
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.
FreeMarker is a template engine that lets you generate text output, often used in web applications. Alfresco tried to restrict what templates can do, but a user who can edit templates could find ways to break out of those restrictions and run harmful code on the server. This means someone with template editing rights could take full control of 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.