Ruby2Shell: Ruby 4.0.10, 3.4.13, 3.3.14 fix seven memory flaws, incl. one-byte heap overflow with RCE on Rails
Matéria consolidada. Reúne 4 matérias que o Tifon tinha publicado separadamente sobre a mesma história. A IA reescreveu o relatório com o que as 3 fontes trouxeram em 23/11/2026 10:13; os links antigos trazem para cá.
Fontes: gbhackers.com ↗ thehackernews.com ↗ securityonline.info ↗
The Ruby maintainers released Ruby 4.0.10, 3.4.13 and 3.3.14 on November 18, 2026. They fix seven memory-safety flaws in the regular expression engine and in string case conversion (securityonline.info, thehackernews.com). The advisories rate three flaws critical, three high and one moderate (thehackernews.com). Working PoCs exist, and five of them reach remote code execution (RCE) (thehackernews.com). On November 19, 2026, Veria Labs disclosed one of the critical flaws, GHSA-34m4-m9fh-gqp5, under the name Ruby2Shell. It is a one-byte heap overflow in case conversion for legacy single-byte encodings, and Veria Labs says it can give unauthenticated RCE on default Ruby on Rails and classic-style Sinatra applications (gbhackers.com). Veria Labs also found vulnerable bundled runtimes in several popular products (gbhackers.com). No exploitation in the wild has been reported (securityonline.info, thehackernews.com, gbhackers.com). The PoCs had not been published at the time of the earlier reports, but Veria Labs planned to publish its PoC one week after disclosure, around November 26 (gbhackers.com). The flaws have no CVE IDs yet. The project says it has requested them, so the GitHub advisory (GHSA) IDs are the only identifiers for now (thehackernews.com, gbhackers.com). The sources worked only from articles and did not verify the vendor advisories.
Entenda a falha
A vulnerabilidade
Ruby 4.0.0-4.0.9, 3.4.0-3.4.12 and 3.3.13 and earlier have seven memory-safety flaws in the regex engine and in string case conversion. They have no CVE IDs yet, only GHSA IDs. Three are critical: GHSA-34m4-m9fh-gqp5 ("Ruby2Shell"), a one-byte heap overflow in case conversion for single-byte encodings such as ISO-8859-1; GHSA-7x2q-68qv-6p8x, a double free when compiling a regex with a && intersection; and GHSA-3p8q-wmhx-vm2w, a compiled-program size overflow that writes to the heap. Three are high (Regexp#to_s heap overflow, a case change over 4 GiB, an out-of-bounds read in case-insensitive matching) and one is moderate (an out-of-bounds read with a case-insensitive backreference). Veria Labs says Ruby2Shell gives unauthenticated RCE on default Rails and classic Sinatra. Fixed in 4.0.10, 3.4.13 and 3.3.14. Ruby 3.2 and earlier are EOL and get no fix.
Como funciona
In the regex bugs, an application takes text from a user, such as a search filter, routing rule or validation setting, and has Ruby compile it into a regular expression. The engine builds an internal compiled program and handles constructs like character-class intersections. In the flawed paths, a size calculation overflows so memory is written past a heap buffer, or the same buffer is freed twice. Regexp#to_s, which turns a compiled regex back into text, can also overflow a heap buffer. In the case-conversion bugs, Ruby changes the case of a string, computes the output size and writes the result. In some legacy single-byte encodings the output has more bytes than the input and the routine does not always check there is room, so it writes one byte too far. UTF-8 takes a different path. Results above 4 GiB also get the size wrong. No regex is needed for these. The moderate read bug fires when a fixed pattern with a case-insensitive backreference is matched against a crafted subject string.
Por que é vulnerável
The articles describe memory-safety errors: integer overflows in size calculations, a double free, an off-by-one write and out-of-bounds reads and writes in regex compilation, Regexp#to_s, case-insensitive matching and case conversion. For Ruby2Shell, the case-conversion routine for legacy single-byte encodings does not consistently verify that the buffer has room when the output is larger than the input. Veria Labs says the defect dates back to Ruby 2.4.0. The articles do not say why the others went unnoticed or detail the code changes. The fix is to upgrade the interpreter, and the advisories list no workaround.
Onde está
The articles name no files or functions, only the regex engine, Regexp#to_s and string case conversion, each with its own GitHub advisory (GHSA IDs above).
Como foi descoberta
The Ruby project credits Stephan Lipp of Ada Logics and Anthropic with four of the findings, and babayaga, aphantom, Hiroya Fujinami and Hiroshi SHIBATA with the other three. The articles do not say how they were found. Ruby disclosed them through a security announcement and one advisory per flaw with the releases on November 18, 2026, and says it has requested CVE IDs. On November 19, Veria Labs disclosed the Ruby2Shell flaw (GHSA-34m4-m9fh-gqp5) and said it found vulnerable bundled runtimes in GitLab 19.6.0, GitHub Enterprise Server 3.22.5, Mastodon 4.7.5, OpenProject 17.9.7, Discourse 2026.10.1 and Chatwoot 4.20.0. No exploitation in the wild has been reported. This is the second regex fix batch in four weeks: the October 23 releases fixed different Onigmo bugs found by GitLab.
PoC existente, privada
O exploit existe, mas quem o tem não o publicou.
Ruby's maintainers say they know of working PoCs for six of the seven flaws. Five reach remote code execution, though for the 4 GiB case-conversion flaw the size needed puts it out of reach for most requests. The sixth, for GHSA-wpqw-5qxg-m68r, shows attacker-controlled memory corruption without demonstrated code execution. The moderate read flaw is described only as a memory disclosure or crash. Ruby has not published these PoCs. Veria Labs said it planned to publish its Ruby2Shell PoC one week after the November 19 disclosure, around November 26. That is a plan, and the articles do not confirm a release. Treat patching as urgent, especially for internet-facing Rails and classic Sinatra apps.
Explicação gerada por IA a partir da matéria e dos artigos, em 23/11/2026 10:29.
Detalhes técnicos
- GHSA-34m4-m9fh-gqp5 (critical, Ruby2Shell): one-byte heap overflow in case conversion for single-byte encodings such as ISO-8859-1. RCE PoC (thehackernews.com). The routine does not consistently check buffer space when the output is larger than the input. UTF-8 strings take a different code path and are not affected (gbhackers.com). The defect dates back to Ruby 2.4.0 (gbhackers.com).
- GHSA-7x2q-68qv-6p8x (critical): double free when compiling a regex that uses a
&&character-class intersection. RCE PoC (thehackernews.com). - GHSA-3p8q-wmhx-vm2w (critical): the compiled regex program size can overflow, causing a heap buffer write. RCE PoC (thehackernews.com, securityonline.info).
- GHSA-87fm-7w84-j2px (high): heap overflow when a case change produces a result larger than 4 GiB. RCE PoC, but the size needed puts it out of reach for most requests (thehackernews.com).
- GHSA-7whj-cfh7-xgm4 (high): heap overflow in
Regexp#to_s. RCE PoC (thehackernews.com). - GHSA-wpqw-5qxg-m68r (high): out-of-bounds read in case-insensitive matching. The PoC shows memory corruption, but RCE has not been shown (thehackernews.com).
- GHSA-pvgc-g7gj-pv6h (moderate): out-of-bounds read with a case-insensitive backreference. It can disclose memory or crash the process, and it can fire against a fixed pattern (thehackernews.com, securityonline.info).
- The regex flaws require an application that builds regexes from attacker-controlled input. The two case-conversion flaws fire when the application changes the case of a crafted string (both original sources).
- Ruby2Shell exposure: default Rails and classic Sinatra can reach the vulnerable code without an account. Plain Rack and other frameworks are not exposed by default. Custom code that converts the case of untrusted legacy-encoded strings can still be vulnerable (gbhackers.com).
- Affected versions are 4.0.0–4.0.9, 3.4.0–3.4.12 and 3.3.13 and earlier. Ruby 3.2 and earlier are end of life and will not be fixed (thehackernews.com). Ruby2Shell also affects the end-of-life branches through 3.2 (gbhackers.com).
- Veria Labs found vulnerable bundled runtimes in GitLab 19.6.0, GitHub Enterprise Server 3.22.5, Mastodon 4.7.5, OpenProject 17.9.7, Discourse 2026.10.1 and Chatwoot 4.20.0. A bundled runtime does not mean every installation has the same network exposure (gbhackers.com).
- An earlier batch on October 23 (4.0.9, 3.4.12, 3.3.13) fixed different regex bugs found by GitLab (thehackernews.com). Per Lilting's analysis cited by securityonline.info, those were Onigmo bugs behind four GitLab code execution CVEs.
Remediação
- Upgrade the Ruby interpreter to 4.0.10, 3.4.13 or 3.3.14. The advisories list no workaround (securityonline.info, gbhackers.com).
- Restart long-running processes and rebuild servers, workers and container images. Updating gems or frameworks does not replace the interpreter (thehackernews.com, securityonline.info).
- For products that bundle Ruby (such as GitLab, GitHub Enterprise Server, Mastodon, OpenProject, Discourse and Chatwoot), install the vendor's fixed release. An OS package update will not replace the embedded runtime. The Ruby2Shell disclosure is separate from GitLab's November security updates, which cover 37 vulnerabilities (gbhackers.com).
- Move off Ruby 3.2 and earlier, which will not be fixed, to a supported, patched branch (thehackernews.com, gbhackers.com).
- Prioritize internet-facing Rails and classic Sinatra deployments, since a public PoC is expected. After rollout, verify the runtime used by the running service, not only the version installed on the host (gbhackers.com).
- Review code that compiles user-controlled regexes or case-converts external text, and use Regexp.escape where possible (securityonline.info, thehackernews.com).
- Track the flaws by GHSA ID until CVEs are assigned (thehackernews.com).
Relatos divergentes
- Number of RCE PoCs: securityonline.info says only that "some" of the bugs have RCE PoCs. thehackernews.com, published later, says five have RCE PoCs, one shows memory corruption without demonstrated code execution, and one only discloses memory or crashes. The more specific thehackernews.com breakdown is preferred.
- Severity breakdown: securityonline.info reports only that three flaws are critical. thehackernews.com adds three high and one moderate.
- PoC availability: securityonline.info and thehackernews.com say the PoCs have not been published. gbhackers.com, the most recent source, says Veria Labs planned to publish its Ruby2Shell PoC one week after the November 19 disclosure. This is a planned release, not a confirmed one.
- Exposure of the case-conversion flaw: the earlier sources describe it as requiring an application that case-converts crafted strings. gbhackers.com, a single article-based source, says default Rails and classic Sinatra reach the vulnerable code unauthenticated. This has not been confirmed by the vendor advisories.
Linha do tempo
-
Ruby2Shell: one-byte heap overflow in Ruby case conversion enables unauthenticated RCE on default Rails and classic Sinatra apps
ler a análise desta fonte ocultar
Veria Labs disclosed Ruby2Shell on November 19, 2026. It is a one-byte heap overflow in the Ruby runtime's string case conversion for certain legacy single-byte encodings. The article says it can lead to unauthenticated remote code execution in default Ruby on Rails and classic-style Sinatra applications. The disclosure lists advisory GHSA-34m4-m9fh-gqp5, and the CVE assignment is pending. The disclosure reports no active exploitation, but Veria Labs planned to publish a proof of concept one week after disclosure. This article is the only source used, and no vendor or repository pages were checked.
Technical Details
- The case-conversion routine does not consistently check buffer space when the output is larger than the input. UTF-8 strings take a different code path and are not affected.
- Default Rails and classic Sinatra can reach the vulnerable code without an account. Plain Rack and other frameworks are not exposed by default. Custom code that converts the case of untrusted legacy-encoded strings can still be vulnerable.
- Affected versions are Ruby 4.0.0–4.0.9, 3.4.0–3.4.12 and 3.3.0–3.3.13. The defect dates back to Ruby 2.4.0 and also affects end-of-life branches through 3.2.
- Veria Labs found vulnerable bundled runtimes in GitLab 19.6.0, GitHub Enterprise Server 3.22.5, Mastodon 4.7.5, OpenProject 17.9.7, Discourse 2026.10.1 and Chatwoot 4.20.0.
- Bundled-runtime findings and default framework exposure are related, but they do not mean every installation has the same network exposure.
Remediation
- Upgrade Ruby to 3.3.14, 3.4.13 or 4.0.10. Move end-of-life branches to a supported, patched branch.
- For products that bundle Ruby, install the vendor's fixed release. An OS package update will not replace the embedded runtime. The Ruby2Shell disclosure is separate from GitLab's November security updates, which cover 37 vulnerabilities.
- Prioritize internet-facing Rails and classic Sinatra deployments. After rollout, verify the runtime used by the running service, not only the version installed on the host.
-
Ruby 4.0.10, 3.4.13 and 3.3.14 fix seven regex and string memory-safety flaws, five with RCE PoCs
ler a análise desta fonte ocultar
The Ruby maintainers released Ruby 4.0.10, 3.4.13 and 3.3.14 to fix seven memory-safety flaws in the regular expression engine and in string case conversion. Per the article, the advisories rate three flaws critical, three high and one moderate. Five have proof-of-concept remote code execution (RCE), one has a PoC that corrupts memory but has not been shown to run code, and one only discloses memory or crashes. The advisories report no attacks so far. The seven flaws have no CVE IDs yet, and the project says it has requested them. The GitHub advisory IDs are the only identifiers for now. Exposure depends on whether an attacker can feed crafted patterns or strings into the affected code. This research was limited to the article, so vendor-side details were not independently verified.
Technical Details
- GHSA-34m4-m9fh-gqp5 (critical): one-byte heap overflow in case conversion for single-byte encodings such as ISO-8859-1. RCE PoC.
- GHSA-7x2q-68qv-6p8x (critical): double free when compiling a regex that uses a
&&character-class intersection. RCE PoC. - GHSA-3p8q-wmhx-vm2w (critical): heap overflow when the compiled regex size overflows. RCE PoC.
- GHSA-87fm-7w84-j2px (high): heap overflow when a case change produces a result larger than 4 GiB. RCE PoC, but the size needed puts it out of reach for most requests.
- GHSA-7whj-cfh7-xgm4 (high): heap overflow in
Regexp#to_s. RCE PoC. - GHSA-wpqw-5qxg-m68r (high): out-of-bounds read in case-insensitive matching. The PoC shows memory corruption, but RCE has not been shown.
- GHSA-pvgc-g7gj-pv6h (moderate): out-of-bounds read with a case-insensitive backreference. It can disclose memory or crash the process, and it can fire against a fixed pattern.
The regex flaws require an application that builds regexes from attacker-controlled input. The two case-conversion flaws fire when the application changes the case of a crafted string. Affected versions are 4.0.0–4.0.9, 3.4.0–3.4.12 and 3.3.13 and earlier. Ruby 3.2 and earlier are end of life and will not be fixed. The article says the earlier October release (4.0.9, 3.4.12, 3.3.13) fixed different regex bugs found by GitLab.
Remediation
Update the Ruby interpreter to 4.0.10, 3.4.13 or 3.3.14, then restart or rebuild servers, workers and container images. Updating gems or frameworks does not replace the interpreter. Move off Ruby 3.2 and earlier. Review code that compiles user-controlled regexes or case-converts external text. Track the flaws by GHSA ID until CVEs are assigned.
-
Ruby 4.0.10, 3.4.13 and 3.3.14 fix seven memory-safety flaws in regex engine and case conversion, some with RCE PoCs
ler a análise desta fonte ocultar
Ruby released versions 4.0.10, 3.4.13 and 3.3.14 on November 18, 2026. They fix seven memory-safety bugs in the regular expression engine and in string case conversion. Ruby's advisories say working PoCs exist that show some of the bugs can lead to remote code execution. The PoCs have not been published, and no exploitation in the wild has been confirmed. Three of the flaws are rated critical, and the article says none has a CVE ID yet. No web research was done, so the details below come only from the article and have not been checked against the vendor advisories.
Technical Details
- GHSA-3p8q-wmhx-vm2w: the size of a compiled regex program can overflow, causing a heap buffer write.
- GHSA-7x2q-68qv-6p8x: a character class intersection causes a double free.
- GHSA-34m4-m9fh-gqp5: case conversion in single-byte encodings such as ISO-8859-1 writes one byte past the buffer.
- GHSA-7whj-cfh7-xgm4: heap buffer overflow in Regexp#to_s.
- GHSA-87fm-7w84-j2px: case conversion overflows when the result exceeds 4 GiB.
- GHSA-wpqw-5qxg-m68r: out-of-bounds read that can corrupt memory.
- GHSA-pvgc-g7gj-pv6h: medium-severity read that may disclose memory or crash the process.
- Most of the flaws need an application that compiles regexes from attacker-controlled strings. The two case conversion bugs can be triggered by a crafted string alone.
- An October 23 batch (4.0.9, 3.4.12, 3.3.13) fixed Onigmo bugs that, per Lilting's analysis cited by the article, were behind four GitLab code execution CVEs.
Remediation
- Upgrade to Ruby 4.0.10, 3.4.13 or 3.3.14. The advisories list no workaround.
- Rebuild container images and restart long-running Ruby processes.
- Review code that builds regexes from user input, and use Regexp.escape where possible.