Skip to content
RCE Advisory Advanced

GHSL-2020-030: Server-Side Template Injection in Dropwizard

Dropwizard's self-validating feature passes untrusted bean properties into error message templates that support Java EL expressions, allowing an attacker to inject arbitrary EL and execute code. This can lead to remote code execution.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

A Server-Side Template Injection was identified in Dropwizard self-validating feature enabling attackers to inject arbitrary Java EL expressions, leading to Remote Code Execution (RCE) vulnerability.

pwntester, on GitHub Security Lab

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 ViolationCollector.addViolation() method passes its argument directly to ConstraintValidatorContext.buildConstraintViolationWithTemplate() without sanitisation, so any untrusted data becomes part of an EL expression that is later evaluated.

Impact

This issue may lead to remote code execution.

What the attacker needed

Application uses Dropwizard self-validating feature; untrusted input included in violation message

The fix

The issue was fixed by the vendor, but the initial fix was insufficient due to a Hibernate implementation bug, and a new fix was prepared.

How it was found

  1. Modify the example Person class to be self-validated and include the fullName property in a violation message.
  2. Send a POST request to /people with a JSON body containing a malicious fullName value.
  3. Check for the existence of /tmp/pwned or inspect the response to confirm code execution.

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.

Dropwizard is a Java framework. Its validation feature builds error messages using a template system that can evaluate Java EL expressions (small code snippets). If a developer includes user input in those messages, an attacker can inject their own expression and run 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.

More by Alvaro Muñoz

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.