Researchers uncovered a critical security vulnerability in Rails applications that leverages the Bootsnap caching library. This exploit allows attackers to achieve remote code execution (RCE) by exploiting an arbitrary file write vulnerability.
The issue is particularly concerning as Bootsnap has been a default component in Rails since version 5.2.
The vulnerability stems from a standard arbitrary file write flaw. Below is an example of vulnerable code:
According to the Conviso Research Team, in this scenario, users can control both the file path and content. This allows malicious actors to write files to arbitrary locations on the server, potentially leading to RCE.
Despite the exploit’s potential, certain restrictions make its execution non-trivial. Rails production environments often use Docker containers with limited writable directories such as /tmp, db, and log.
Investigate Real-World Malicious Links & Phishing Attacks With Threat Intelligence Lookup - Try for Free
However, these limitations can be bypassed by targeting specific writable directories, such as tmp/cache/bootsnap.
Bootsnap optimizes Rails applications by caching expensive computations. Its cache files are stored in tmp/cache/bootsnap and include compiled Ruby files. These files follow a specific structure consisting of a header (cache key) and the compiled content.
By overwriting a cache file with malicious Ruby code and triggering its execution during application startup, attackers can achieve RCE. An overview of the exploitation process is as follows:
This vulnerability highlights the risks associated with arbitrary file write flaws in web applications. By abusing Bootsnap’s caching mechanism, attackers can escalate privileges to achieve RCE.
Developers should adopt stringent security practices, including input validation and dependency management, to mitigate such threats effectively.
Integrating Application Security into Your CI/CD Workflows Using Jenkins & Jira -> Free Webinar
Hackers are actively probing AI systems, turning exposed gateways and agent tools into routes for…
Hackers are making some phishing pages harder to track by changing the code delivered to…
A cyber incident reportedly forced a British power plant to halt operations for about four…
Russian hackers have used a new backdoor called HOOKEDGE to target defense manufacturers, government bodies,…
TITAN ransomware is pairing file encryption with an ambitious claim: artificial intelligence that can sort…
A fake student resume is being used to place a remote-access tool on researchers’ Windows…