Skip to content
RCE Write-up Advanced

YAML Remote Code Execution in Puppet

The Puppet master deserialised YAML sent by untrusted REST API clients and then called methods on the resulting object. A crafted YAML payload could make deserialisation build an instance of any class present in the Ruby process, letting an attacker run code carried in the payload.

puppetlabs.com

Published on puppetlabs.com

When making REST api calls, the puppet master takes YAML from an untrusted client, deserializes it, and then calls methods on the resulting object. A YAML payload can be crafted to cause the deserialization to construct an instance of any class available in the ruby process, which allows an attacker to execute code…

The author, on puppetlabs.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 unsafe deserialisation of untrusted YAML into arbitrary Ruby objects, followed by method calls on the resulting object.

Impact

An unauthenticated attacker could execute arbitrary code in the Puppet master process, as the title and overview describe it as unauthenticated remote code execution.

What the attacker needed

Network access to the Puppet master REST API; no authentication required

The fix

It was fixed in Puppet 2.7.22 and 3.2.2, and in Puppet Enterprise 2.8.2.

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.

Puppet is a tool that manages servers, and its central server (the master) accepts requests over a network. It was turning data sent by those callers back into live program objects, and some object types run code when they are created or used. Because the caller was not trusted, an attacker could send a specially shaped document that made the server run the attacker's code.

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.