Skip to content
RCE Write-up Intermediate

**The Unsafe Send: How an HTTP Client Library Led to Remote Code Execution**

A Ruby HTTP client library passed a caller-supplied HTTP verb directly to Ruby's send method without validation, so an attacker who could control the verb could invoke arbitrary methods such as eval and run system commands. This allowed remote code execution on any application that let users choose the HTTP method.

Alperen Follow

Published on medium.com

Finding a vulnerability in a core library is always a “hold your breath” moment. You realize that the impact isn’t just limited to one endpoint, but potentially to every application that includes this dependency.

Alperen, on medium.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 Ruby's send with an unvalidated, user-controlled method name, allowing any method on the connection object to be invoked.

Impact

Any application that lets a user specify the HTTP method, such as a webhook tester or proxy tool, could be fully taken over, allowing arbitrary shell commands, theft of credentials, and a persistent foothold.

What the attacker needed

Application uses the vulnerable library; attacker can control the HTTP verb; attacker can control the resource path

The fix

The library should validate the HTTP verb against a strict allowlist of real HTTP methods before calling send, and avoid using send with user input.

How it was found

  1. Identify the perform_request method that calls send with the http_verb argument.
  2. Supply 'eval' as the HTTP verb and a Ruby code string as the resource path.
  3. Call perform_request with those values to execute the code on the server.

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.

The library let the person using it choose which HTTP method to use, like GET or POST. Instead of checking that the choice was a real HTTP method, it handed the choice straight to a Ruby feature that can call any function by name. An attacker could therefore ask it to call a function that runs commands on the server, taking over the machine.

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 Alperen

View all

1 more disclosed report, 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.