Skip to content
RCE Write-up Advanced

R-bitrary Code Execution: Vulnerability In R’s Deserialization (CVE-2024-27322)

A malicious RDS file or R package can contain a promise object with an unbound value and an expression, causing arbitrary code execution when the deserialized object is accessed. An attacker could execute code on a victim's system by tricking them into loading a crafted RDS file or R package.

Kasimir Schulz Follow

Published on hiddenlayer.com

R is an open-source programming language and software environment for statistical computing, data visualization, and machine learning. Consisting of a strong core language and an extensive list of libraries for additional functionality, it is only natural that R is popular and widely used today, often being the only…

Kasimir Schulz (@Abraxus7331), Kieran Evans (@KieranEvans89), on hiddenlayer.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

Likely the deserialization process allows the creation of promise objects with unbound values and arbitrary expressions, which are evaluated when the object is accessed, leading to code execution.

Impact

An attacker could execute arbitrary code on the victim's system, potentially leading to full compromise, and this could be used in supply chain attacks via R packages.

What the attacker needed

Victim loads a malicious RDS file or R package

The fix

The vulnerability was fixed in R v4.4.0.

How it was found

  1. Craft a malicious RDS file containing a promise object with an unbound value and an expression containing arbitrary code.
  2. Load the malicious RDS file using readRDS or include it in an R package.
  3. When the deserialized object is accessed or the package is loaded, the expression is evaluated and the arbitrary code runs.

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.

R is a programming language used for statistics. When R saves data to a file, it uses a format called RDS. The vulnerability is that a specially crafted RDS file can contain hidden instructions that run code when the file is opened and the data is used. This means opening a malicious RDS file could let an attacker run their own programs on your computer.

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.