GHSL-2020-086, 087, 088, 089 - Server-Side Template Injection in Apache Camel - CVE-2020-11994
Apache Camel's FreeMarker, Velocity, MVEL and Mustache components allowed an attacker who could control certain message headers to inject templates, leading to remote code execution or arbitrary file disclosure. The attacker could override the template content or resource URI via headers such as CamelFreemarkerTemplate and CamelFreemarkerResourceUri.
Originally disclosed on GitHub Security Lab
Apache Camel FreeMarker, Velocity, MVEL and Moustache components are vulnerable to Server-Side Template Injection (SSTI) leading to Remote Code Execution (RCE) or Arbitrary File Disclosure.
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
The templating components accepted template content and resource URIs from message headers without proper validation, allowing an attacker to override the intended template and execute arbitrary code or read files.
Impact
This issue leads to Remote Code Execution and Arbitrary File Disclosure.
What the attacker needed
Attacker can control message headers; Camel route uses a vulnerable templating component
How it was found
- Set up a Camel route that uses the freemarker component to render a template.
- Send a message to the route with a header that overrides the template content.
- The template engine executes the attacker-supplied template, running arbitrary commands.
- Alternatively, send a header specifying a resource URI to read arbitrary files.
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.
Apache Camel is a tool that helps different systems talk to each other by passing messages. The templating components let you format those messages using templates. The bug is that an attacker could send a message with a special header that replaces the template with their own, and because templates can run code, the attacker could run commands on the server or read files.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.