Ruby sharp-s upcase bug enables pre-authentication RCE on default Rails
Original title: Ruby2ßhell: Pre-authentication RCE on stock Rails
Ruby 3.3.14, 3.4.13 and 4.0.10 fix a one-byte heap overflow; a proof of concept is due in a week.
A one-byte heap overflow in Ruby's single-byte encoding upcase path, present since Ruby 2.4.0, is reachable before authentication on default Rails and classic-style Sinatra. Upcasing a sharp s writes two bytes while the loop checks room for one; 21 of them overflow a buffer sized to the input length plus 20. UTF-8 takes a different path and is not affected. Fixed releases are Ruby 3.3.14, 3.4.13 and 4.0.10; Ruby 3.2 and older are end of life.
Unconfirmed: The write-up does not say whether attackers already exploit the flaw; the proof of concept is not yet published.
- Ruby 4.0.0 to 4.0.9 is fixed in 4.0.10.
- Ruby 3.4.0 to 3.4.12 is fixed in 3.4.13; 3.3.0 to 3.3.13 in 3.3.14.
- GitLab 19.6.0 bundles affected Ruby 3.3.13.
- GitHub Enterprise Server 3.22.5, Mastodon 4.7.5 and OpenProject 17.9.7 bundle Ruby 4.0.9.
- Discourse 2026.10.1 bundles 3.4.7; Chatwoot 4.20.0 bundles 3.4.4.
Impact: pre-authentication remote code execution on default Rails
| Product | Affected | Fixed in |
|---|---|---|
| Ruby | 4.0.0 to 4.0.9; 3.4.0 to 3.4.12; 3.3.0 to 3.3.13; 3.2 and older back to 2.4.0 | 4.0.10, 3.4.13, 3.3.14 |
| Rails | default configuration on an affected Ruby | — |
| Sinatra | classic style on an affected Ruby | — |
| GitLab | 19.6.0 (bundled Ruby 3.3.13) | — |
| GitHub Enterprise Server | 3.22.5 (bundled Ruby 4.0.9) | — |
| Mastodon | 4.7.5 (bundled Ruby 4.0.9) | — |
| OpenProject | 17.9.7 (bundled Ruby 4.0.9) | — |
| Discourse | 2026.10.1 (bundled Ruby 3.4.7) | — |
| Chatwoot | 4.20.0 (bundled Ruby 3.4.4) | — |
- 1.Upgrade Ruby to 3.3.14, 3.4.13, or 4.0.10.
- 2.Install the vendor's fixed release for self-hosted software that bundles an affected Ruby.
From the original article
2 min read at verialabs.com
The bug is reachable from the following frameworks in their default configuration. Other frameworks are not exposed by default, but application code that upcases strings received in a legacy encoding may also be vulnerable. The latest version of the following popular software bundles an affected Ruby.
By jdns · verialabs.com
A short excerpt; the article and its images belong to the publisher. Summary, key facts and assessment above are AI-written from the article and can be wrong.