GHSL-2020-043: Server-side template injection in Liferay - CVE-2020-13445
A user with privileges to edit FreeMarker or Velocity templates could bypass the sandbox and execute arbitrary Java code or system commands with the same privileges as the Liferay account. The report demonstrates this on Liferay Portal CE 7.3 GA1.
Originally disclosed on GitHub Security Lab
A user with privileges to edit FreeMarker or Velocity templates may execute arbitrary Java code or run arbitrary system commands with the same privileges as the account running Liferay.
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 template sandbox exposes objects that allow access to dangerous classes, enabling sandbox escape.
Impact
This issue may lead to Remote Code Execution.
What the attacker needed
Privileges to edit templates
The fix
The issue was fixed in Liferay Portal 7.3.2.
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.
Templates are used to generate web pages, and they can run code. Liferay tried to restrict what code templates can run, but the restrictions could be bypassed. Someone who can edit templates could then run any command on the server, as if they were the server's user.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.