See how ruby compares to other vendors in security performance
On 11/18/26 17:03, Alan Coopersmith wrote: GHSA-34m4-m9fh-gqp5: Heap buffer overflow in case conversion of strings https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5
Ruby has a one-byte heap-based buffer overflow in the case conversion of strings. Changing the case of a crafted string may allow remote code execution. We are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios. MITRE appears to have assigned https://www.cve.org/CVERecord?id=CVE-2026-132825 for this one today.
-- -Alan Coopersmith- alan.coopersmith () oracle com Oracle Solaris Engineering - https://blogs.oracle.com/solaris
Fixed GHSA-2fjv-p558-g82m (Use-after-free via repopulation of lastfatalerrorbacktrace global after shutdown).
https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5
https://verialabs.com/ruby2shell/
CVE-2026-132825
All Ruby versions back to 2.4.0 are vulnerable. Patches available for 3.3 and up.
Ruby before 3.3.14, 3.4.13, and 4.0.10 has a heap-based buffer overflow during case conversion. One byte can be written outside a buffer for, for example, ISO-8859-1 or Windows-1252.
Ruby before 3.3.14, 3.4.13, and 4.0.10 has a heap-based buffer overflow during case conversion. One byte can be written outside a buffer for, for example, ISO-8859-1 or Windows-1252.
https://www.ruby-lang.org/en/news/2026/11/18/multiple-vulnerabilities-in-regexp-and-string/ advises: Security advisories: multiple vulnerabilities in Regexp and String case conversion
Posted by mame on 18 Nov 2026
Seven vulnerabilities have been discovered in Ruby’s regular expression engine and in the case conversion of strings. We are aware of PoCs that prove some of them can be used to trigger remote code execution. We have released Ruby 4.0.10, 3.4.13 and 3.3.14 to fix them. We strongly recommend upgrading.
CVE identifiers have been requested for these vulnerabilities but have not been assigned yet, so this advisory refers to them by their GitHub Security Advisory (GHSA) identifiers.
GHSA-34m4-m9fh-gqp5: Heap buffer overflow in case conversion of strings https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m9fh-gqp5
Ruby has a one-byte heap-based buffer overflow in the case conversion of strings. Changing the case of a crafted string may allow remote code execution. We are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios.
GHSA-7x2q-68qv-6p8x: Double free in regular expression compilation https://github.com/ruby/ruby/security/advisories/GHSA-7x2q-68qv-6p8x
Ruby has a double free in its regular expression engine. Compiling a crafted regular expression pattern may allow remote code execution in applications that compile attacker-controlled patterns. We are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios.
GHSA-87fm-7w84-j2px: Integer overflow in case conversion of strings https://github.com/ruby/ruby/security/advisories/GHSA-87fm-7w84-j2px
Ruby has an integer overflow in the case conversion of strings, which causes a heap-based buffer overflow. Changing the case of a crafted string may allow remote code execution. We are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios.
GHSA-wpqw-5qxg-m68r: Out-of-bounds read in case-insensitive regular expression matching https://github.com/ruby/ruby/security/advisories/GHSA-wpqw-5qxg-m68r
Ruby has an out-of-bounds read in its regular expression engine. Matching against a crafted regular expression pattern may allow remote code execution in applications that use attacker-controlled patterns. We are aware of PoCs that prove this flaw can lead to memory corruption in an attacker-controlled way.
GHSA-3p8q-wmhx-vm2w: Heap buffer overflow in regular expression compilation https://github.com/ruby/ruby/security/advisories/GHSA-3p8q-wmhx-vm2w
Ruby has an integer overflow in its regular expression engine, which causes a heap-based buffer overflow. Compiling a crafted regular expression pattern may allow remote code execution in applications that compile attacker-controlled patterns. We are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios.
GHSA-7whj-cfh7-xgm4: Heap buffer overflow in Regexp#tos https://github.com/ruby/ruby/security/advisories/GHSA-7whj-cfh7-xgm4
Ruby has a heap-based buffer overflow in Regexp#tos. Converting a crafted regular expression to a string may allow information disclosure or remote code execution in applications that compile attacker-controlled patterns. We are aware of PoCs that prove this flaw can be used to trigger RCE in some scenarios.
GHSA-pvgc-g7gj-pv6h: Out-of-bounds read in case-insensitive backreference matching https://github.com/ruby/ruby/security/advisories/GHSA-pvgc-g7gj-pv6h
Ruby has an out-of-bounds read in its regular expression engine. Matching a crafted string may disclose memory contents or crash the process.
Affected versions
Ruby 3.3.13 and earlier Ruby 3.4.0 through 3.4.12 Ruby 4.0.0 through 4.0.9
Recommended action
We strongly recommend upgrading to Ruby 4.0.10, 3.4.13 or 3.3.14.
Ruby 3.3 is in the security maintenance phase. Ruby 3.2 and earlier have reached their end of life and will not receive these fixes.
Credits
GHSA-34m4-m9fh-gqp5: Stephan Lipp (Ada Logics) and Anthropic GHSA-7x2q-68qv-6p8x: Stephan Lipp (Ada Logics) and Anthropic GHSA-87fm-7w84-j2px: babayaga GHSA-wpqw-5qxg-m68r: Stephan Lipp (Ada Logics) and Anthropic GHSA-3p8q-wmhx-vm2w: aphantom GHSA-7whj-cfh7-xgm4: Stephan Lipp (Ada Logics) and Anthropic GHSA-pvgc-g7gj-pv6h: Hiroya Fujinami and Hiroshi SHIBATA
History
Originally published at 2026-11-19 00:00:00 (UTC) -- -Alan Coopersmith- alan.coopersmith () oracle com Oracle Solaris Engineering - https://blogs.oracle.com/solaris
(Ruby before 3.3.14, 3.4.13, and 4.0.10 has a heap-based buffer overflo ...)
CVE-2026-97229 is an integer overflow in Onigmo, the regex engine built into Ruby, which GitLab uses to compile CI/CD config regexes. A crafted regex can run code on the server without authentication. GitLab scored it 10.0 and says it works "under certain conditions", without saying which.
Fixed in GitLab 19.2.8, 19.3.5 and 19.4.2, released Oct 12. Affected: self-managed CE/EE 19.2.0-19.2.7, 19.3.0-19.3.4, 19.4.0-19.4.1. GitLab.com and Dedicated are already patched.
CISA added it to KEV on Oct 29 with a due date of Nov 1. Rapid7 published a working PoC on Oct 13. Censys counted about 25,766 hosts on affected versions in mid-October.
The catch is in Alpine Linux's post-mortem from Oct 28. Alpine was attacked on Oct 20-21 after it had already upgraded GitLab, and the upgrade did not help. GitLab's patch fixes the Ruby bundled in its own omnibus and CNG packages. Alpine runs GitLab on a system Ruby, so the vulnerable engine was still there. Source installs and distro packages have the same problem.
Those installs need Ruby updated separately: 3.3.13 or 3.4.12 (released Oct 23), or 4.0.8 or later in the 4.0 series. Ruby issued no CVE of its own for this, so scanners report it under the GitLab number.
Check both the GitLab version and the Ruby version before calling an instance patched.
Sources: GitLab critical patch release 19.4.2 / 19.3.5 / 19.2.8 (Oct 12); CISA KEV entry for CVE-2026-97229 (added Oct 29, due Nov 1); Alpine Linux post-mortem (Oct 28); Rapid7 analysis and PoC (Oct 13); Ruby 3.3.13 / 3.4.12 release notes (Oct 23).
https://www.ruby-lang.org/en/news/2026/10/23/regexp-fixes-for-gitlab-cves/ says: Regexp compilation fixes related to GitLab's CVE-2026-89078, CVE-2026-93577, CVE-2026-97229 and CVE-2026-110264
Posted by k0kubun on 23 Oct 2026
We have released Ruby 4.0.9, 3.4.12 and 3.3.13. They fix several bugs in Ruby’s regular expression engine (Onigmo) that GitLab found could be used for remote code execution on GitLab servers. GitLab published four CVEs for these issues, and the Ruby releases contain the fixes for the underlying bugs in Ruby.
Background ----------
GitLab compiles regular expressions supplied by its users, such as patterns in CI configuration, with Regexp.new. GitLab found that specially crafted patterns could corrupt memory while Ruby compiles them, and that this could be turned into remote code execution on GitLab servers. GitLab addressed these issues in its own releases by patching the Ruby it ships, and assigned the following CVE identifiers:
CVE-2026-89078: Double Free issue in Regular Expression Parser (GitLab 19.4.1) CVE-2026-93577: Integer Overflow issue in Regular Expression Compiler (GitLab 19.4.1) CVE-2026-97229: Integer Overflow issue in CI/CD Regular Expression Compiler (GitLab 19.4.2) CVE-2026-110264: Integer Overflow issue in Regular Expression Compiler (GitLab 19.5.1)
Fixes in Ruby -------------
The following table shows the change in Ruby that fixes the bug behind each CVE, and the first release of each series that contains it.
GitLab CVE Bug in Ruby Change Ruby Ruby Ruby 4.0 3.4 3.3 ---------- ----------- ------- ---- ---- ---- CVE-2026-89078 Double free when parsing a pattern fails after an alternation #13332 4.0.0 3.4.12 3.3.13
CVE-2026-93577, Integer overflow in the size of a CVE-2026-97229 compiled pattern #19020 4.0.8 3.4.12 3.3.13
CVE-2026-110264 Overflow of internal IDs in a pattern with many repeats #16801 4.0.9 3.4.12 3.3.13
Ruby 4.0.9, 3.4.12 and 3.3.13 contain all of these fixes.
Who is affected ---------------
These bugs are reached only when an application compiles a regular expression from a string that an attacker controls, for example by passing it to Regexp.new, Regexp.union or Regexp.compile, or by interpolating it into a regexp literal such as /#{input}/. Applications that only use regular expressions written by their own developers are not affected.
Regexp.timeout does not protect against these bugs. Limiting the length of patterns does not reliably protect against them either, because some of them can be triggered by short patterns.
Recommended action ------------------
We recommend upgrading to Ruby 4.0.9, 3.4.12 or 3.3.13 or later.
If you cannot upgrade, please avoid compiling regular expressions from untrusted input.
Ruby 3.3 is in the security maintenance phase, in which we normally release only fixes for vulnerabilities. Ruby 3.3.13 includes these fixes as an exception, because GitLab assigned CVEs to issues that rely on them.
About CVE identifiers ---------------------
We have not requested CVE identifiers in Ruby for these fixes, at least for now.
Ruby has generally considered it unsafe to compile and use a regular expression created from untrusted input. We stated this in the advisory for CVE-2022-28738, where we nevertheless treated a double free in Regexp compilation as a vulnerability after a comprehensive assessment. We did the same for CVE-2024-27282.
However, the Regexp documentation currently discusses untrusted patterns only in terms of denial of service, and recommends a timeout for them. It does not clearly say whether compiling an untrusted pattern is a use case that Ruby supports. We plan to discuss how to document this, and whether we treat this kind of issue as a vulnerability in Ruby, including whether to request CVE identifiers for these fixes. If we request any, we will update this page.
In the meantime, please refer to GitLab’s CVE identifiers listed above when you track these issues, for example in a security scanner.
Credits -------
Thanks to Johan Carlsson (joaxcar) for discovering the integer overflow fixed by #19020 through GitLab’s bug bounty program, and to GitLab for reporting these issues to us and coordinating the fixes.
History --------
Originally published at 2026-10-23 03:11:22 (UTC)
crmne/rubyllm at commit fa6f279847d6d7027814539d9c0dfc3bbdfd2a83 contains a polynomial-time regular expression denial-of-service condition in Mistral model capability matching on Ruby 3.1.x
Summary
Mail::Utilities.qvaluedecode and Mail::Utilities.bvaluedecode decoded only the first RFC 2047 encoded-word in a string and used an overly greedy pattern to match the charset token. A crafted, malformed encoded-word embedded in an address display name or local part could cause the decoded output to differ from what a human reviewer or downstream parser would expect, allowing an attacker to spoof the apparent sender/recipient address.
Details
Both decoders used a single String#match against a pattern such as /\=\?(.+)?\?[Qq]\?(.)\?\=/m. Two problems:
1. Single match, dropped remainder. Only the first =?charset?Q?...?= (or ?B?) word was decoded. Any additional encoded-words or surrounding text were not handled consistently, so the decoded result could silently omit or alter parts of the input. 2. Greedy charset capture. (.+)? is greedy and matches across ? delimiters, so a malformed word could span more of the string than a strict RFC 2047 parse would, changing the boundary between "encoded" and "literal" text.
Impact
Applications using mail to parse and display or authorize based on decoded header values (From, To, Reply-To, etc.) may present or act on an address different from the one a validator inspecting the raw header would see. Primary risk is spoofing / phishing and authorization-check bypass. No RCE.
crmne/rubyllm at commit fa6f279847d6d7027814539d9c0dfc3bbdfd2a83 contains a polynomial-time regular expression denial-of-service condition in RubyLLM::Utils.underscore on Ruby 3.1.x. A very long crafted class, agent, or tool name can cause excessive CPU consumption and a denial of service.
Summary
JSON.dump(obj, io) and JSON::State#generate(obj, io) can write past the internal JSON generator buffer when a streamed object contains an attacker-controlled string near 16 KB. The issue is a heap out-of-bounds write in the IO-streaming path and is demonstrated as a reliable process crash / denial of service.
This was triaged on HackerOne as report #3785370. The issue was confirmed there and I was asked to open it here.
Details
Root cause is in ext/json/fbuffer/fbuffer.h, fbufferdoinccapa().
On the IO path, the buffer is grown to FBUFFERIOBUFFERSIZE (16383), but the early return checks total capacity instead of remaining capacity:
c if (RBUNLIKELY(fb->io)) { if (fb->capa < FBUFFERIOBUFFERSIZE) { fbufferrealloc(fb, FBUFFERIOBUFFERSIZE); } else { fbufferflush(fb); }
if (RBLIKELY(requested < fb->capa)) { return; } }
If fb->len already contains JSON syntax bytes, and a string flush has 16383 - fb->len <= requested < 16383, this check returns even though there is not enough space left. fbufferappendreserved() then writes past the buffer:
c MEMCPY(fb->ptr + fb->len, newstr, char, len);
The minimal fix is to compare against the remaining capacity:
diff - if (RBLIKELY(requested < fb->capa)) { + if (RBLIKELY(requested <= fb->capa - fb->len)) { return; }
PoC
ruby require "json" require "stringio"
io = StringIO.new big = "a" 16385 big[16382] = '"' # escapable byte near the buffer boundary
JSON.dump([big], io)
Verified results:
text Ruby 4.0.5 / bundled json 2.18.0: malloc(): invalid size (unsorted) .../json/common.rb:956: [BUG] Aborted
ruby/ruby master c78418b7a0 / json 2.19.8 / ASan: heap-buffer-overflow WRITE of size 16382 fbufferappendreserved ext/json/fbuffer/fbuffer.h:145 searchflush ext/json/generator/generator.c:139 convertUTF8toJSON ext/json/generator/generator.c:231 rawgeneratejsonstring ext/json/generator/generator.c:922 cStatemgenerate ext/json/generator/generator.c:1891
Control: the same data through JSON.dump([big]) without an IO argument returns normally. The bug is specific to the IO-streaming path.
Impact
A remote attacker can trigger a heap out-of-bounds write if they control a string field that an application serializes through JSON.dump(obj, io) or JSON::State#generate(obj, io). The demonstrated impact is reliable denial of service. I am not claiming code execution or information disclosure.
Mastodon is a free, open-source social network server based on ActivityPub. Prior to 4.5.10, 4.4.17, and 4.3.23, when using Ruby versions older than 3.4, PrivateAddressCheck.privateaddress? returns false for IPv4-mapped IPv6 addresses (::ffff:a.b.c.d) corresponding to some private IPv4 addresses, depending on Ruby version, this can include loopback, RFC1918 private networks, and link-local space. An attacker who controls DNS for any domain can publish an AAAA record with such a mapped address; any outbound HTTP fetch Mastodon performs against that hostname then opens a real TCP connection to the underlying IPv4 address, including 127.0.0.1 and cloud-metadata endpoints such as 169.254.169.254. This vulnerability is fixed in 4.5.10, 4.4.17, and 4.3.23.
Faraday is an HTTP client library abstraction layer that provides a common interface over many adapters. From 1.0.0 until 1.10.6 and 2.14.3, Faraday::NestedParamsEncoder, the default nested query parameter encoder/decoder in Faraday, decodes nested query strings without enforcing a maximum nesting depth. A crafted query string causes Faraday to build a deeply nested Ruby Hash structure. The internal dehash routine then recursively walks this attacker-controlled structure without a depth limit. At sufficient depth, Ruby raises an uncaught SystemStackError (stack level too deep), crashing the calling thread or worker. This can lead to denial of service in applications that pass attacker-controlled query strings to Faraday's nested query parsing or URL-building paths. This vulnerability is fixed in 1.10.6 and 2.14.3.
Net::IMAP implements Internet Message Access Protocol (IMAP) client functionality in Ruby. Prior to 0.6.5 and 0.5.15, several Net::IMAP commands accept a "raw data" argument that is sent verbatim after validation to prevent command injection. However, if a server does not support non-synchronizing literals, it may still be possible to inject arbitrary IMAP commands inside non-synchronizing literals. A server without support for non-synchronizing literals may interpret the "+}\r\n" as the end of a malformed command line and respond with a tagged BAD. In that case, the contents of the literal will be interpreted as one or more new pipelined commands, allowing a CRLF command injection attack to succeed. This affects criteria for #search and #uidsearch; searchkeys for #sort, #thread, #uidsort, and #uidthread; and attr for #fetch and #uidfetch. This vulnerability is fixed in 0.6.5 and 0.5.15.
Net::IMAP implements Internet Message Access Protocol (IMAP) client functionality in Ruby. Prior to 0.6.5 and 0.5.15, several Net::IMAP commands accept a raw string argument which is only validated to prevent CRLF injection and then sent verbatim. If this string is derived from user-controlled input, an attacker can force the next command to be absorbed as a continuation of the first command. This will cause the first command to eventually fail, but also prevents it from returning until another command is sent (from another thread). That other command will not return until the connection is closed. This vulnerability is fixed in 0.6.5 and 0.5.15.
It was discovered that Ruby's Net::IMAP library did not properly verify that Transport Layer Security (TLS) encryption was started after issuing a STARTTLS command. A remote attacker could possibly use this issue to perform a machine-in-the-middle attack and silently bypass TLS encryption. (CVE-2026-42246) It was also discovered that Ruby's Net::IMAP library did not validate string arguments passed to certain commands. A remote attacker could possibly use this issue to inject arbitrary IMAP commands. (CVE-2026-42257)
An issue was discovered in Ruby 4 before 4.0.5. A race condition leading to a use-after-free in the pthread-based getaddrinfo timeout handler (rbgetaddrinfo in ext/socket/raddrinfo.c) allows a remote attacker who can delay DNS responses near the user-specified timeout to crash a Ruby process that calls Addrinfo.getaddrinfo(..., timeout:) or Socket.tcp(..., resolvtimeout:). Memory-corruption-based exploitation is theoretically possible. The attack could, for example, be carried out through a crafted authoritative DNS server or recursive resolver.
End of life: 3/31/2029, Latest version: 4.0.10
Impact
The REXML gems from 3.3.3 to 3.4.1 have a DoS vulnerability when parsing XML containing multiple XML declarations. If you need to parse untrusted XMLs, you may be impacted to these vulnerabilities.
Patches
REXML gems 3.4.2 or later include the patches to fix these vulnerabilities.
Workarounds
Don't parse untrusted XMLs.
References
https://www.ruby-lang.org/en/news/2025/09/18/dos-rexml-cve-2025-58767/ : An announcement on www.ruby-lang.org
ruby-jwt v3.0.0.beta1 was discovered to contain weak encryption. NOTE: the Supplier's perspective is "keysize is not something that is enforced by this library. Currently more recent versions of OpenSSL are enforcing some key sizes and those restrictions apply to the users of this gem also."
This vulnerability allows remote attackers to smuggle arbitrary HTTP requests on affected installations of Ruby WEBrick. This issue is exploitable when the product is deployed behind an HTTP proxy that fulfills specific conditions. The specific flaw exists within the readheaders method. The issue results from the inconsistent parsing of terminators of HTTP headers. An attacker can leverage this vulnerability to smuggle arbitrary HTTP requests.
This vulnerability allows remote attackers to smuggle arbitrary HTTP requests on affected installations of Ruby WEBrick. This issue is exploitable when the product is deployed behind an HTTP proxy that fulfills specific conditions. The specific flaw exists within the readheaders method. The issue results from the inconsistent parsing of terminators of HTTP headers. An attacker can leverage this vulnerability to smuggle arbitrary HTTP requests.
Admin Framework. A logic issue was addressed with improved checks.
It was discovered that Ruby incorrectly handled parsing of an XML document that has specific XML characters in an attribute value using REXML gem. An attacker could use this issue to cause Ruby to crash, resulting in a denial of service. This issue only affected in Ubuntu 22.04 LTS, Ubuntu 24.04 LTS, and Ubuntu 24.10. (CVE-2024-35176, CVE-2024-39908, CVE-2024-41123, CVE-2024-43398) It was discovered that Ruby incorrectly handled expanding ranges in the net-imap response parser. If a user or automated system were tricked into connecting to a malicious IMAP server, a remote attacker could possibly use this issue to consume memory, leading to a denial of service. This issue only affected Ubuntu 24.04 LTS, and Ubuntu 24.10. (CVE-2025-25186) It was discovered that the Ruby CGI gem incorrectly handled parsing certain cookies. A remote attacker could possibly use this issue to consume resources, leading to a denial of service. (CVE-2025-27219) It was discovered that the Ruby CGI gem incorrectly handled parsing certain regular expressions. A remote attacker could possibly use this issue to consume resources, leading to a denial of service. (CVE-2025-27220) It was discovered that the Ruby URI gem incorrectly handled certain URI handling methods. A remote attacker could possibly use this issue to leak authentication credentials. (CVE-2025-27221)