Skip to content
RCE Write-up Intermediate

Spring Boot RCE

A Spring Boot Whitelabel error page reflected user input into a SpEL expression, allowing an attacker to execute arbitrary Java code. The author achieved remote command execution by bypassing quote filtering using nested Character.toString calls.

Tushar Follow

Published on web.archive.org

This is my very frist blog post which was pending for a long time (almost a year). I would like to share a particular Remote Code Execution (RCE) in Java Springboot framework.

Tushar Adhikary, on web.archive.org

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 write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the application passed user-controlled input into a SpEL expression that was evaluated without sanitisation, and the error page reflected the result.

Impact

An attacker could execute arbitrary commands on the server, leading to full remote code execution.

What the attacker needed

Spring Boot version before 1.2.8; Whitelabel error page reflecting user input

The fix

The vulnerability was fixed in Spring Boot 1.2.8; upgrading is advised.

How it was found

  1. Send a request with a SpEL expression like ${12*12} in a parameter to confirm evaluation.
  2. Try to execute a command using Runtime.exec with a quoted string, but observe that quotes are URL-encoded and the command fails.
  3. Use nested Character.toString calls to build the command string without quotes.
  4. Execute the command and optionally use IOUtils.toString to capture the output.

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 write-up has not been written yet. The Original tab links to the source.

Spring Boot is a popular framework for building Java web applications. A 'Whitelabel error page' is a default error page shown when something goes wrong. Here, the page took user input and evaluated it as code (SpEL), so an attacker could run their own commands 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.

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.