Skip to content
RCE Write-up Intermediate

Cve 2022 32511 Exploit Remote Code Execution

The JMESPath Ruby library used JSON.load to parse untrusted input, which can deserialise arbitrary Ruby objects. An attacker could supply a crafted payload to execute arbitrary code, such as a reverse shell.

Dhanesh Dodia - HeyDanny Follow

Published on infosecwriteups.com

Affected versions of this package are vulnerable to Deserialization of Untrusted Data due to the usage of JSON.load, which is considered unsafe when used with untrusted input.

Dhanesh Dodia - HeyDanny, 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

The library used JSON.load instead of JSON.parse, so untrusted JSON could instantiate arbitrary Ruby objects and trigger code execution.

Impact

An attacker could execute arbitrary code on the server, for example a reverse shell, if they can control the JSON input to the library.

What the attacker needed

JMESPath 1.6.0 or earlier; attacker controls JSON input; Ruby environment

The fix

The library should use JSON.parse instead of JSON.load to avoid deserialising untrusted objects.

How it was found

  1. Install JMESPath 1.6.0 or earlier.
  2. Start an Interactive Ruby Shell (irb).
  3. Choose a payload, such as a reverse shell command.
  4. Import the vulnerable JMESPath library and supply the payload to execute the reverse shell.

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.

When a program reads data from an untrusted source, it should treat it as plain text. This library used a method that can turn that text into live objects, and an attacker can craft the text so that one of those objects runs a command. That gives the attacker control of the server.

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 Dhanesh Dodia - HeyDanny

View all

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