Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Vulnerabilities

Vulnerability in R Programming Language Could Fuel Supply Chain Attacks

A vulnerability (CVE-2024-27322) in the R programming language implementation can be exploited to execute arbitrary and be used as part of a supply chain attack.

vulnerability CVE-2024-27322

A vulnerability in the R programming language implementation can be exploited to execute arbitrary code when a malicious RDS file is loaded and referenced, and could be used as part of a supply chain attack, AI security firm HiddenLayer warns.

Tracked as CVE-2024-27322 (CVSS score of 8.8), the issue was identified in R’s serialization and deserialization process, which is used for creating and loading RDS (R Data Serialization) files.

An open source programming language, R supports data visualization, machine learning, and statistical computing, and is widely used for performing statistical analysis in industries such as finance, government, and healthcare, and is also popular within AI and ML applications.

R has its own serialization format that is used when packages are saved and loaded. When a package is compiled, a .rdb file containing objects to be serialized and a .rdx file containing metadata associated with these objects and their offsets are created.

“When a package is loaded, the metadata stored in the RDS format within the .rdx file is used to locate the objects within the .rdb file. These objects are then decompressed and deserialized, essentially loading them as RDS files,” HiddenLayer explains.

Because R supports an instruction for creating a promise object – which has a symbol (variable) and an expression attached to it, with the expression run only after the symbol is accessed – and lazy evaluation, a strategy where symbols are evaluated only when needed.

An attacker can create a promise object with an instruction that sets the variable to an unbound value and an expression containing arbitrary code. Due to lazy evaluation, the expression is evaluated and run only when the symbol associated with the RDF file is accessed, and the code will execute when the user references the symbol.

“Once the malicious file has been created and loaded by R, the exploit will run no matter how the variable is referenced,” HiddenLayer continued.

Advertisement. Scroll to continue reading.

Enabling Software Supply Chain Attacks

The security firm also warns that, because RDS packages allow users to share compiled R code with others, and because there numerous GitHub repositories dedicated to R, threat actors could abuse this vulnerability in supply chain attacks targeting R users.

readRDS, one of R’s functions that can be used to exploit the vulnerability, is referenced in over 135,000 R source files, and CRAN’s repository, which claims to have over 20,000 packages and allows anyone to upload code, does not check new packages against this vulnerability.

“Looking through the repositories, we found that a large amount of the usage was on untrusted, user-provided data, which could lead to a full compromise of the system running the program. Some source files containing potentially vulnerable code included projects from R Studio, Facebook, Google, Microsoft, AWS, and other major software vendors,” HiddenLayer explains.

To take over an R package, an attacker only needs to overwrite the .rdx file with their malicious file, ensuring that the code is automatically executed as soon as the package is loaded. By modifying a may system package, such as a compiler, the malicious code will be executed when R is initialized.

Patches for CVE-2024-27322 were included in R Core version 4.4.0, which was released as source code on April 24, followed by Windows and Mac binaries shortly. The updated version will also be included in various Linux distributions.

Related: GitHub Rolls Out ‘Code Scanning Autofix’ in Public Beta

Related: No Security Scrutiny for Half of Major Code Changes: AppSec Survey

Related: Malicious NuGet Packages Abuse MSBuild Integrations for Code Execution

Written By

Ionut Arghire is an international correspondent for SecurityWeek.

Trending

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Join the session as we discuss the challenges and best practices for cybersecurity leaders managing cloud identities.

Register

SecurityWeek’s Ransomware Resilience and Recovery Summit helps businesses to plan, prepare, and recover from a ransomware incident.

Register

People on the Move

OT zero trust access and control company Dispel has appointed Dean Macris as its CISO.

Cloud identity and security solutions firm Saviynt has hired former Gartner Analyst Henrique Teixeira as Senior Vice President of Strategy.

PR and marketing firm FleishmanHillard named Scott Radcliffe as the agency's global director of cybersecurity.

More People On The Move

Expert Insights

Related Content

Vulnerabilities

Less than a week after announcing that it would suspended service indefinitely due to a conflict with an (at the time) unnamed security researcher...

Data Breaches

OpenAI has confirmed a ChatGPT data breach on the same day a security firm reported seeing the use of a component affected by an...

IoT Security

A group of seven security researchers have discovered numerous vulnerabilities in vehicles from 16 car makers, including bugs that allowed them to control car...

Vulnerabilities

A researcher at IOActive discovered that home security systems from SimpliSafe are plagued by a vulnerability that allows tech savvy burglars to remotely disable...

Risk Management

The supply chain threat is directly linked to attack surface management, but the supply chain must be known and understood before it can be...

Cybercrime

Patch Tuesday: Microsoft calls attention to a series of zero-day remote code execution attacks hitting its Office productivity suite.

Vulnerabilities

Patch Tuesday: Microsoft warns vulnerability (CVE-2023-23397) could lead to exploitation before an email is viewed in the Preview Pane.

IoT Security

A vulnerability affecting Dahua cameras and video recorders can be exploited by threat actors to modify a device’s system time.