Skip to content
RCE Write-up Advanced

Discovery

The WebGoat 8 deserialization challenge blindly deserializes a user-supplied Base64-encoded Java object, allowing an attacker to execute arbitrary commands via a gadget chain. The authors achieved a reverse shell by modifying ysoserial to generate a working Hibernate 5 payload.

medium.com

Published on medium.com

By Ahmed Sherif & Francesco Soncina

ABN AMRO, on medium.com

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

The application deserializes untrusted user input without validation, allowing a gadget chain to execute arbitrary code.

Impact

An attacker could execute arbitrary commands on the server, leading to a reverse shell and full compromise of the application container.

What the attacker needed

Access to the vulnerable endpoint; ability to send crafted serialized objects

How it was found

  1. Scan the remote endpoint with the Java-Deserialization-Scanner Burp plugin, which reports Hibernate 5 as potentially vulnerable.
  2. Modify ysoserial to include the javax.el package and rebuild with the hibernate5 profile.
  3. Generate a payload with ysoserial using the Hibernate1 chain and Base64-encode it.
  4. Send the payload to the vulnerable endpoint and verify command execution by checking the Docker container.
  5. Enumerate available binaries on the target; only Perl and Bash are present.
  6. Modify Gadgets.java in ysoserial to embed a Bash reverse shell command, rebuild, and send the new payload to obtain a reverse shell.

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.

Java serialization turns objects into a stream of bytes so they can be saved or sent. If a program turns those bytes back into objects without checking where they came from, an attacker can craft bytes that make the program run their commands. This is called insecure deserialization.

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.