deniz.in

Markets

Weather

Loading weather

· via Hacker News – Front Page (native)

Ruby2Shell: pre-auth RCE on stock Rails traced to one-byte overflow in Ruby's upcase

A heap overflow in Ruby's single-byte encoding case conversion, reachable from default Rails and Sinatra setups, is disclosed as a pre-authentication RCE. Fixed Ruby releases are available now.

Ruby2Shell: pre-auth RCE on stock Rails traced to one-byte overflow in Ruby's upcase

Verial Labs has disclosed a vulnerability it calls Ruby2Shell, tracked as GHSA-34m4-m9fh-gqp5, that it says enables remote code execution before authentication on unmodified Rails deployments. The flaw sits in Ruby's own string handling rather than in application code, and it is reachable from Rails and classic Sinatra in their default configurations. Fixed Ruby releases accompanied the advisory on 19 November 2026, and the story reached the Hacker News front page the same day.

A one-byte overflow in case conversion

The root cause is in how Ruby treats the German sharp s (ß) in single-byte encodings. Most of those encodings have no uppercase form of the character, so upcasing it expands into the two letters "SS". In the underlying C loop, the first of those output bytes is written after a bounds check, but the second is written without one.

Because the output buffer is sized as the input length plus 20 bytes, and every ß adds one byte to the result, an input containing 21 of the characters writes a single byte past the end of the buffer. According to Verial Labs, the same faulty loop appears across several ISO-8859 and Windows-125x encodings and has been present since Ruby 2.4.0. It is reached through upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings take a different code path and are unaffected. The fix landed upstream in the ruby/ruby repository as commit d582f8f.

Who is exposed

On an affected Ruby, Rails and classic-style Sinatra are vulnerable out of the box. Other frameworks and plain Rack applications are not exposed by default, although application code that upcases attacker-supplied strings in a legacy encoding can still trigger the bug.

The advisory also lists current releases of widely deployed self-hosted software that bundle an affected interpreter:

  • GitLab 19.6.0 (Ruby 3.3.13)
  • GitHub Enterprise Server 3.22.5 (4.0.9)
  • Mastodon 4.7.5 (4.0.9)
  • OpenProject 17.9.7 (4.0.9)
  • Discourse 2026.10.1 (3.4.7)
  • Chatwoot 4.20.0 (3.4.4)

The exploitation primitive

The overflow itself is narrow: one byte, either "S" (0x53) during upcasing or "s" (0x73) during case folding, written immediately after the output buffer. The attacker controls the size of that buffer through the length of the input string, and copying the converted result back out also reads one byte beyond the buffer's end.

How that constrained primitive is extended into the pre-authentication code execution the advisory promises is not yet public. Verial Labs says it will publish a proof of concept in about a week, deliberately holding it back to give operators time to upgrade. Until then, defenders have to treat the RCE claim as credible and patch on that assumption.

Patch now

Ruby users should move to a fixed release depending on their series: 4.0.10, 3.4.13 or 3.3.14. The 3.2 series and everything older, back to 2.4.0 where the bug was introduced, are end-of-life and will not receive a patch. Sites running packaged software should install the vendor's fixed release rather than swapping the bundled interpreter themselves.

Why it matters

This is a vulnerability in the language runtime, not in the framework or in developer-written code, which is why stock Rails installs are exposed without any misconfiguration. The blast radius is unusually wide: the affected-products list includes some of the most widely deployed self-hosted platforms on the internet, and anyone still on an EOL Ruby branch has no patch path short of a version upgrade.

The tiny primitive cuts both ways. A single semi-controlled byte is easy to dismiss as unexploitable, but the researchers' decision to delay their proof of concept suggests they believe exploitation is practical. With roughly a week before it drops, internet-facing Rails and Sinatra applications on affected Rubies are on a clock, and patching first is the only defensible order of operations.

  • #ruby
  • #rails
  • #security
  • #vulnerability
  • #rce

Related posts