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.
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
- Install JMESPath 1.6.0 or earlier.
- Start an Interactive Ruby Shell (irb).
- Choose a payload, such as a reverse shell command.
- 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.