Track vulnerabilities like this one. Sign up free to get alerted when software you use is affected.
9.3

CVE-2024-27280: Ruby StringIO may reveal memory data

CVE-2024-27280 · published 2 years ago
Summary

The StringIO library used in Ruby 3.0 and 3.1 can read past the end of a string, potentially exposing the contents of memory to the program. This can happen when the ungetbyte or ungetc functions are used and then StringIO.gets is called. Upgrade to the patched StringIO version (3.0.3 or the specific 3.0.1.1/3.0.1.2 releases) to eliminate the risk.

What to do
  • Update nobu nakada stringio to version 3.0.1.1.
  • Update stringio to version 0.1.0.41610.1.
  • Update debian ruby3.1 to version 3.1.2-7+deb12u1.
  • Update ruby to version 3.1.5-r0.
  • Update ruby to version 3.2.4-r0.
  • Update ruby to version 3.3.1-r0.
  • Update canonical ruby2.5 to version 2.5.1-1ubuntu1.16+esm5.
  • Update canonical ruby2.7 to version 2.7.0-5ubuntu1.14.
  • Update canonical ruby3.0 to version 3.0.2-7ubuntu2.7.
Affected software
Ecosystem VendorProductAffected versions
rubygems nobu nakada stringio < 3.0.1.1
Fix: upgrade to 3.0.1.1
Root:Ruby – stringio < 0.1.0.41610.1
Fix: upgrade to 0.1.0.41610.1
Debian:12 debian ruby3.1 < 3.1.2-7+deb12u1
Fix: upgrade to 3.1.2-7+deb12u1
Alpine:v3.16 – ruby < 3.1.5-r0
Fix: upgrade to 3.1.5-r0
Alpine:v3.18 – ruby < 3.2.4-r0
Fix: upgrade to 3.2.4-r0
Alpine:v3.20 – ruby < 3.3.1-r0
Fix: upgrade to 3.3.1-r0
Ubuntu:Pro:16.04:LTS canonical ruby2.3 All versions
Ubuntu:Pro:18.04:LTS canonical ruby2.5 < 2.5.1-1ubuntu1.16+esm5
Fix: upgrade to 2.5.1-1ubuntu1.16+esm5
Ubuntu:20.04:LTS canonical ruby2.7 < 2.7.0-5ubuntu1.14
Fix: upgrade to 2.7.0-5ubuntu1.14
Ubuntu:22.04:LTS canonical ruby3.0 < 3.0.2-7ubuntu2.7
Fix: upgrade to 3.0.2-7ubuntu2.7
Original advisory text
CVE-2024-27280 in stringio - Patched by Root
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.
References
Fix within
Internet-facing 3 days
Internal 60 days
  • Not known to be exploited
  • Can be exploited automatically
  • Gives an attacker full control
Severity
9.3 Critical
Exploitation
2% chance of attack within 30 days
Type
CWE-120Classic Buffer Overflow
CWE-126Buffer Over-read
Timeline
Published14 May 2024
Updated5 Dec 2026
First seen6 Mar 2026
Track software like this
Free during beta