Skip to content
RCE Advisory Intermediate

GHSL-2023-136: Remote Code Execution (RCE) in Samson

Samson's Kubernetes role verification controller passed user-supplied YAML to an unsafe deserialisation function, allowing arbitrary Ruby object instantiation. An attacker could exploit this to execute arbitrary commands on the server.

Alvaro Muñoz Follow

Originally disclosed on GitHub Security Lab

Samson’s Kubernetes::RoleVerificationsController deserializes user-controllable data leading to Remote Code Execution (RCE).

pwntester, on GitHub Security Lab

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 report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The code used YAML.load_stream on untrusted input, which can instantiate arbitrary Ruby classes and lead to code execution.

Impact

This issue may lead to Remote Code Execution (RCE).

What the attacker needed

Access to the Samson instance; a GitHub account for login

The fix

The issue was fixed by merging a pull request that presumably replaces the unsafe YAML loading with a safe method.

How it was found

  1. Start the Docker image bundled with Samson.
  2. Log in using your GitHub account.
  3. Visit the role verification page.
  4. Paste a malicious YAML document into the textbox.

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.

The application let users paste YAML (a text format for data) into a form and then loaded it with a Ruby function that can create any object, not just plain data. Because of that, a malicious YAML file could make the server run commands chosen by 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 Alvaro Muñoz

View all

132 more disclosed reports, best first.

More from GitHub Security Lab

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.