Ruby2Shell: critical Ruby RCE, affected versions and how to fix it (GHSA-34m4-m9fh-gqp5)
A critical Ruby flaw allows unauthenticated attackers to run code on servers, affecting Rails and classic-style Sinatra apps by default.
Overview
A critical flaw named Ruby2Shell allows an unauthenticated attackerDone without logging in or holding a valid account on the target system to run code on a serverA computer or program on a network that stores data and responds to requests from client devices by exploiting a one-byteA group of 8 bits, enough to store 1 character heap overflowA buffer overflow inside the pool of memory a program allocates dynamically while running in how Ruby changes the case of strings in legacy encodingsRewrite data in another form so it can be carried; no key, anyone can reverse it. The vulnerability affects Ruby versions 2.4.0 to 3.3.13, 3.4.0 to 3.4.12, and 4.0.0 to 4.0.9, specifically when applications use functions like upcase or capitalize on untrusted data. Popular self-hostedSoftware that an organization installs and runs on its own servers instead of using a vendor's cloud service products such as GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse, and Chatwoot are affected because their latest releases still bundle a vulnerable version of Ruby. The issue matters because it exposes default setups of Rails and classic-style Sinatra apps to remote code executionA flaw that lets an attacker run any commands or program they choose on the target machine without any prior access. Ruby maintainersThe developer or small team responsible for reviewing changes and publishing releases for an open-source project have released fixes in versions 3.3.14, 3.4.13, and 4.0.10, but older versions like Ruby 3.2 have no fix and require a move to a supported series. Users of affected self-hosted software must make their servers private until the vendor ships a fixed release.
Terms in this story
- unauthenticated attacker
- Done without logging in or holding a valid account on the target system. An unauthenticated flaw is especially urgent in the news because any stranger on the internet can trigger it without needing a username or password first.
- server
- A computer or program on a network that stores data and responds to requests from client devices. Online stores, email systems, and multiplayer games all run on servers in data centers or the cloud, making unpatched servers a primary target for intruders.
- byte
- A group of 8 bits, enough to store 1 character. Memory sizes, network payloads, and buffer lengths are measured in bytes, and memory corruption bugs happen when a program writes even a single byte past the end of its buffer. From the CYBR 101 room CYBR 101: Ciphers and encryption (part 1)
- heap overflow
- A buffer overflow inside the pool of memory a program allocates dynamically while running. Attackers exploit a heap overflow in a browser or media parser by feeding it an oversized file that overwrites neighboring objects in memory and hijacks execution.
- encodings
- Rewrite data in another form so it can be carried; no key, anyone can reverse it. Students often confuse encoding with encryption at first, but systems encode data only so it travels safely through text protocols, not to keep it secret from anyone. From the CYBR 101 room CYBR 101: Ciphers and encryption (part 1)
- self-hosted
- Software that an organization installs and runs on its own servers instead of using a vendor's cloud service. Running a self-hosted password manager, code server, or chat platform gives a company full control over its data, but also means its own staff must install every security patch.
- code execution
- A flaw that lets an attacker run any commands or program they choose on the target machine. When an advisory warns that a bug allows arbitrary code execution, an attacker who triggers the flaw can install malware, read files, or take over the program's account.
- maintainers
- The developer or small team responsible for reviewing changes and publishing releases for an open-source project. Supply chain attackers often target a volunteer maintainer with phishing emails or offers to help, hoping to gain publishing rights over a popular code library.
- RCE
- A flaw that lets an attacker run their own code on someone else's computer over a network. This is one of the most dangerous bug classes in the news because an attacker across the internet can send a crafted request and take control of a server.
- advisory
- An official bulletin from a vendor or agency warning users about a flaw and its fix. When a bug is patched, the vendor publishes a security advisory listing affected versions, the CVE code, the severity rating, and instructions for updating.
- proof-of-concept exploits
- A working sample of code or steps that shows a reported security flaw can really be triggered. When researchers publish a proof-of-concept for a new bug, defenders can test their own systems, but criminals also watch for that code and adapt it for real attacks.
- container images
- A read-only template file that packages an application together with all the libraries it needs to run. Software teams download base container images from public registries to deploy cloud services, and a single outdated or backdoored container image can spread flaws across many servers.
This page is a short description made for this site. The article itself, with its author's name and its own link, is on the Aikido website. Cite the article, not this page.
Read the full article on Aikido (opens in a new tab)
Course connections
Each line below connects this story to a Security+ objective (a skill on CompTIA's Security+ exam, a common first cybersecurity certification), a CYBR 101 week, or a cybersecurity job, and quotes the words that made the connection.
- Kind of story: Vulnerability and patch
"Ruby2Shell is a critical Ruby flaw..." Found by reading the article; these exact words are in it - Who is affected: "Rails and classic-style Sinatra apps..."
Copied word for word from the article - Security+ 2.3 Explain various types of vulnerabilities.
"Ruby2Shell is a critical Ruby flaw that can give attackers code execution. See..." Found in the opening sentences - Job skill (from the U.S. Department of Defense list of cybersecurity jobs): Determine and document software patches or the extent of releases that would harden vulnerable software.
"Upgrade Ruby to 3.3.14, 3.4.13 or 4.0.10..." Found by reading the article; these exact words are in it
How a story is connected to the course, and every objective, week and job role