Skip to content
RCE Write-up Intermediate

️ Inside The 160 Comment Fight To Fix Snakeyamls Rce Default

SnakeYAML's default configuration instantiated arbitrary Java classes from global YAML tags, allowing remote code execution when untrusted YAML was parsed. An attacker could supply crafted YAML to trigger this deserialization flaw.

Jonathan Leitschuh Follow

Published on infosecwriteups.com

How a 5-year-old deserialization flaw, a vacation phone call, and some persistence led to a safer Java ecosystem

Jonathan Leitschuh, on infosecwriteups.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

Likely the library's default parser resolved global YAML tags to Java class names and instantiated those classes without requiring the developer to opt in to unsafe behaviour.

Impact

An attacker who could get untrusted YAML parsed by a vulnerable application could achieve remote code execution, provided suitable classes were on the classpath.

What the attacker needed

Application parses untrusted YAML; suitable classes on the classpath

The fix

SnakeYAML 2.0 was released and by default no longer instantiates Java classes from global YAML tags, making the unsafe behaviour opt-in.

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.

SnakeYAML is a Java library that reads YAML, a common configuration file format. By default it treated special type markers in the YAML as instructions to create Java objects, so a malicious YAML file could make the application run attacker-chosen code. The fix makes the library refuse to create objects from those markers unless the developer explicitly allows it.

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 Jonathan Leitschuh

View all

3 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.