Skip to content
RCE Write-up Advanced

$9,000 for a Cookie That Shouldn’t Have Been an Object: Java De

The application deserialized the raw value of a rememberMe cookie as a native Java object without any type filtering or signature verification. An attacker could supply a crafted serialized object containing a known gadget chain, leading to remote code execution on the server.

T4nv1 Follow

Published on medium.com

I’ve stopped counting how many targets I’ve fingerprinted as Java without finding anything usable. This one almost joined that pile.

T4nv1, 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

Impact

Full remote code execution on the application server, exploitable by anyone able to set a cookie value on an authenticated or authentication-adjacent request, without needing any other vulnerability or prior foothold.

What the attacker needed

A valid session or authentication-adjacent request; ability to set the rememberMe cookie; a gadget-chain class on the classpath

The fix

The application was fixed by switching the deserialization filter to an explicit allowlist within 48 hours, followed by migrating the remember-me mechanism to a signed opaque token over the following weeks.

How it was found

  1. Log in and check the 'keep me signed in' box to receive a rememberMe cookie.
  2. Decode the cookie from base64 and observe it begins with the Java serialization magic bytes.
  3. Generate a serialized payload using a public gadget-chain tool with an out-of-band DNS callback command.
  4. Base64-encode the payload and replace the rememberMe cookie value on an authenticated request.
  5. Send the request and monitor the DNS collaborator listener for a callback.
  6. On the third gadget-chain variant tried, a DNS lookup arrived within about four seconds, confirming command 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 write-up has not been written yet. The Original tab links to the source.

Java can turn an object into a stream of bytes and later rebuild it, a process called deserialization. If a web app rebuilds an object from a cookie without checking what classes it contains, an attacker can include a class that runs a command when rebuilt. Here, a cookie called rememberMe was rebuilt this way, and a crafted value made the server run a command that sent a DNS lookup to the attacker.

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 T4nv1

View all

113 more disclosed reports, best first.

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.