Skip to content
RCE Write-up Advanced

Remote Code Execution with Spring Properties

An unauthenticated file upload allowed writing files with a limited set of extensions into the Tomcat base directory. By uploading an application.xml file that sets the Spring logging.config property to a remote URL, an attacker could load a malicious logback configuration and achieve remote code execution.

srcincite.io

Published on srcincite.io

Recently a past student came to me with a very interesting unauthenticated vulnerability in a Spring application that they were having a hard time exploiting. I managed to spend some time on this problem last weekend and came up with a relatively clean solution, although I would have preferred a more generic solution…

The author, on srcincite.io

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 allowed uploading files with dangerous extensions (such as .xml) into a directory that the Spring Boot application automatically reads for configuration, and the logging.config property could be set to a remote URL that was loaded without restriction.

Impact

An unauthenticated attacker could achieve remote code execution on the server, but the exploit required a server restart and the presence of ELProcessor on the classpath.

What the attacker needed

Unauthenticated file upload; ability to restart server via API; ELProcessor on classpath

The fix

The application should not allow uploading files with executable or configuration extensions into a directory that the server reads, and the logging.config property should not accept remote URLs.

How it was found

  1. Upload a file named application.xml containing a logging.config property pointing to an attacker-controlled URL.
  2. Host a malicious logback.xml file on the attacker's server that uses a JNDI lookup to load a remote object.
  3. Restart the server via an exposed REST API so that Spring reads the uploaded application.xml.
  4. The server loads the remote logback.xml, which triggers the JNDI lookup and executes code.

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.

The application let anyone upload a file, but only with certain extensions like .xml or .zip, and saved it in a folder where the server looks for configuration files. The attacker uploaded a configuration file that told the server to download another file from the attacker's server, which then ran 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.

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.