Skip to content
RCE Write-up Advanced

CVE-2020-8163: Partial Remote Code Execution

A vulnerability in Rails versions before 5.0.1 and [redacted] allows user-controlled keys in the locals array passed to the render method to be unsanitised and eval'd, potentially leading to partial remote code execution. An attacker could inject code via a crafted request parameter, but the impact is limited because the injected code must fit within a larger expression.

medium.com

Published on medium.com

If the attacker can control the locals variable passed into the second parameter of the call render, you’re likely to get beaten up by this vulnerability, which would partially cause the RCE.

Boik Su, 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

Impact

An attacker could achieve partial remote code execution, but the injected code must be syntactically valid within a larger expression, limiting the ease of exploitation.

What the attacker needed

Rails version < 5.0.1 or < [redacted]; Attacker controls locals keys passed to render

How it was found

  1. Identify a Rails application that passes user-controlled input into the locals parameter of the render method.
  2. Craft a request where a key in the locals array contains Ruby code, such as a system call.
  3. Send the request to the server, which will evaluate the injected code as part of the template rendering process.

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.

This report describes a bug in an old version of the Ruby on Rails web framework. When a developer uses a feature to pass extra variables to a web page template, the names of those variables are not cleaned before being turned into code that the server runs. An attacker who can control those names might be able to sneak in their own commands, but it is tricky because the commands have to fit into a larger piece of 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.