Skip to content
HN On Hacker News ↗

Ruby2Shell (GHSA-34m4-m9fh-gqp5)

▲ 408 points • 189 comments • by jdns • 5d ago • HN discussion ↗

Pangram verdict · v3.3

We believe that this entire text is AI.

100 %

AI likelihood · overall

AI
0% human-written 100% AI-generated
SEGMENTS · HUMAN 0 of 4
SEGMENTS · AI 4 of 4
WORD COUNT 397
PEAK AI % 100% · §1
Analyzed
Nov 19
backend: pangram/v3.3
Segments scanned
4 windows
avg 99 words each
Distribution
0 / 100%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 397 words · 4 segments analyzed

Human AI-generated
§1 AI · 100%

Affected software Ruby versions Ruby series Affected Fixed in 4.0 4.0.0 to 4.0.9 4.0.10 3.4 3.4.0 to 3.4.12 3.4.13 3.3 3.3.0 to 3.3.13 3.3.14 3.2 and older All releases back to 2.4.0 EOL Your deployment 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. Framework Status on an affected Ruby Rails Affected Sinatra (classic style) Affected Other frameworks and plain Rack Not exposed by default Self-hosted software The latest version of the following popular software bundles an affected Ruby. Software Bundled Ruby Status GitLab 19.6.0 3.3.13 Affected GitHub Enterprise Server 3.22.5 4.0.9 Affected Mastodon 4.7.5 4.0.9 Affected OpenProject 17.9.7 4.0.9 Affected Discourse 2026.10.1 3.4.7 Affected Chatwoot 4.20.0 3.4.4 Affected Updated 19 November 2026 at 07:59 UTC. Your deployment Upgrade Ruby to a fixed release: 3.3.14, 3.4.13 or 4.0.10. Self-hosted software Install the vendor's fixed release. See Self-hosted software for fixed versions of popular products. Technical details Root cause Most of Ruby's single-byte encodings have no capital ß. Upcasing it writes two bytes, SS, but the loop only bounds-checks one (to < to_end). while (*pp < end && to < to_end) { /* room for one byte */ code = *(*pp)++; if (code == SHARP_s) { if (flags & ONIGENC_CASE_UPCASE) { *to++ = 'S'; /* first byte */ code = 'S'; } /* ...

§2 AI · 100%

*/ } /* ...

§3 AI · 100%

*/ *to++ = code; /* second byte, unchecked */} The output buffer is allocated as the input length plus 20 bytes. Each ß adds one byte to the output, so an input with 21 of them overflows the buffer by one byte. The same loop is in several ISO-8859 and Windows-125x encodings and has been there since Ruby 2.4.0. It is reached by upcase, swapcase, downcase(:fold) and casecmp?. UTF-8 strings take a different code path and are not affected. Fixed upstream in ruby/ruby@d582f8f. Primitive A one-byte heap overflow. The byte written is S (0x53) when upcasing or s (0x73) when case-folding, and it lands directly after the output buffer. The attacker controls the size of the buffer through the input length. Copying the result out of the buffer then reads one byte out of bounds.

§4 AI · 100%

Proof of concept We'll be publishing a proof of concept in a week, once people have had time to upgrade.