New: Citizen Developer Security | Let everyone develop. Securely.

See how

Blog

Ruby2Shell (GHSA-34m4-m9fh-gqp5): heap overflow in Ruby string case conversion

4 MIN

Ruby2Shell (GHSA-34m4-m9fh-gqp5) is a one-byte heap buffer overflow in Ruby’s string case conversion that may let an attacker run code in a Ruby application that changes the case of text it receives. Stephan Lipp (Ada Logics) and Anthropic reported it, and Ruby fixed it in 4.0.10, 3.4.13 and 3.3.14 on November 18, 2026. Ruby rates it critical and says it is aware of proofs of concept that reach remote code execution in some scenarios. A CVE has been requested and is not assigned yet.

Key highlights

  • What it is: an off-by-one heap write when Ruby changes the case of a string in a single-byte encoding such as ISO-8859-1 or Windows-1252.
  • Severity: critical (Ruby). No CVSS score published.
  • Affected: Ruby 4.0.0 to 4.0.9, 3.4.0 to 3.4.12, 3.3.0 to 3.3.13 and every release from 2.4 to 3.2.
  • Trigger: case conversion (upcase, swapcase, capitalize, downcase(:fold), casecmp?) of attacker-supplied text in an affected encoding. UTF-8 strings are not affected.
  • Fix: Ruby 4.0.10, 3.4.13 or 3.3.14.
  • Stopgap: none published.
  • Exploitation: Ruby reports proofs of concept that reach code execution. It does not report exploitation in the wild.

The bug

For the German sharp s (ß), case conversion writes two bytes but the loop checked room for only one, so a string with enough of them writes one byte past the output buffer. The fix changes that check in 14 ISO-8859 and Windows-125x encoding files.

Shift to AI podcast hosted by Roland Cloutier. Listen nowShift to AI podcast hosted by Roland Cloutier. Listen nowShift to AI podcast hosted by Roland Cloutier. Listen now

Who is exposed

A Ruby process is exposed when it runs an affected version and changes the case of text an attacker controls while that text is tagged with one of the affected single-byte encodings. Ruby 3.2 and older are end of life and get no fix, but they carry the same code back to Ruby 2.4.0.

Fix status

Source Status Builds
Ruby 4.0 Fixed 4.0.10
Ruby 3.4 Fixed 3.4.13
Ruby 3.3 Fixed 3.3.14
Ruby 2.4 to 3.2 No fix planned end of life
Official Docker ruby image Fixed 4.0.10, 3.4.13, 3.3.14 tags, November 19
GitHub Actions ruby/setup-ruby Fixed v1.342.0 and @v1 install the fixed versions
Debian, Ubuntu, Alpine, RHEL No advisory yet
See Cycode in action. Book a demoSee Cycode in action. Book a demoSee Cycode in action. Book a demo

How to check

  1. Run ruby -v in each image or host. For a container image: docker run --rm --entrypoint ruby <image> -v.
  2. Search repositories for FROM ruby: lines, ruby-version: in GitHub Actions workflows and .ruby-version files with a version in the affected range.
  3. Ask vendors of self-hosted software that ships its own Ruby which release includes the fix.

How Cycode helps

Three items on the Threat Intelligence dashboard query the Context Intelligence Graph:

  • GitHub Actions setup-ruby: workflow steps that install an affected Ruby, including short versions such as 3.4 when ruby/setup-ruby is pinned to v1.341.0 or older.
  • Dockerfile base images: Dockerfiles on an affected tag of the official ruby image or a CircleCI or Bitnami Ruby image. Short tags such as ruby:3.4 are not listed.
  • Image runtimes: scanned container images with an affected Ruby interpreter, compiled in or installed from a distribution package. The count is the number of image repositories.
Your complete Post-Mythos toolkit. Learn moreYour complete Post-Mythos toolkit. Learn moreYour complete Post-Mythos toolkit. Learn more

What to do

  1. Upgrade to Ruby 4.0.10, 3.4.13 or 3.3.14 and rebuild every image that bundles Ruby, including images built from short tags before November 19.
  2. Move applications on Ruby 3.2 or older to a supported line.
  3. Update ruby/setup-ruby pins to v1.342.0 or later.
  4. Install the fixed release of any self-hosted product that ships its own Ruby once its vendor publishes one.

Sources

See Cycode in actionBook a demo

FAQ

Frequently asked questions

What is Ruby2Shell?

A one-byte heap overflow in Ruby string case conversion, tracked as GHSA-34m4-m9fh-gqp5.

Which versions are affected?

Ruby 2.4.0 to 3.3.13, 3.4.0 to 3.4.12 and 4.0.0 to 4.0.9.

Are UTF-8 strings affected?

No. Only single-byte encodings such as ISO-8859-1 and Windows-1252.

Is it exploited?

Ruby reports proofs of concept that reach code execution. It does not report exploitation in the wild.

Is there a workaround?

Ruby lists none. Upgrade.