# CVE-2024-27280: StringIO buffer overread vulnerability

> Attackers can read past the end of a string in Ruby's StringIO library, potentially exposing sensitive memory values.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 8 May 2024
- **Updated:** 4 Nov 2025
- **Also known as:** ALPINE-CVE-2024-27280, BELL-CVE-2024-27280, CLEANSTART-2026-JV37320, CLSA-2026-1782469374, DEBIAN-CVE-2024-27280, GHSA-v5h6-c2hv-hv3r, ROOT-APP-RUBY-CVE-2024-27280, UBUNTU-CVE-2024-27280, USN-6853-1

## What is CVE-2024-27280?

CVE-2024-27280 is a critical vulnerability in n/a, published on 8 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

A buffer-overread issue was discovered in StringIO 3.0.1, as distributed in Ruby 3.0.x through 3.0.6 and 3.1.x through 3.1.4. The ungetbyte and ungetc methods on a StringIO can read past the end of a string, and a subsequent call to StringIO.gets may return the memory value. 3.0.3 is the main fixed version; however, for Ruby 3.0 users, a fixed version is stringio 3.0.1.1, and for Ruby 3.1 users, a fixed version is stringio 3.0.1.2.

Weakness: CWE-120 (Buffer Copy without Checking Size of Input)

## Which versions are affected by CVE-2024-27280?

2 open source packages ship an affected version, including stringio.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `stringio` | RubyGems | All versions | 3.0.1.1 |
| `stringio` | RubyGems | All versions | 3.0.1.1 |

## How do I fix CVE-2024-27280?

Upgrade stringio to 3.0.1.1 or later.

## Is CVE-2024-27280 being exploited?

There is no known exploitation of CVE-2024-27280 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-27280 and fix it if it is affected.

What it is: CVE-2024-27280 is a critical vulnerability in n/a, published on 8 May 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-27280 in the wild and no public exploit code.

Affected packages and fixed versions:
- stringio (RubyGems): affected all versions; fixed in 3.0.1.1
- stringio (RubyGems): affected all versions; fixed in 3.0.1.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-27280/ (Markdown: https://insights.sbomify.com/CVE-2024-27280/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-27280
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-27280
- OSV: https://osv.dev/vulnerability/CVE-2024-27280

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-27280/
Summaries are generated and may contain mistakes; the official description above is the record.
