Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessInfluence or control LLM endpoint response
-
DeliveryReturn payload with many unterminated <think> tags
-
ExploitApp parses response via vulnerable think-tag regexes
-
ExecutionPolynomial backtracking spikes CPU
-
ImpactChat-completion processing delayed/degraded
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V2 - Validation and Business Logic Regex complexity limits
MITRE ATT&CK
1 technique across 1 tactic: Impact The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires three stacked conditions: (1) the application uses crmne/ruby_llm at/around commit fa6f2798 with the regex-based <think>-tag response parsing in chat.rb and stream_accumulator.rb; (2) it runs on Ruby 3.1.x, since Ruby 3.2+ regex optimizations mitigate the backtracking; and (3) the attacker can shape the MODEL RESPONSE to include many unterminated <think> tags - a malicious or compromised model endpoint, a prompt-injection coercing such output, or a MitM on the LLM API connection. The host application exposes no direct unauthenticated network surface for this; exploitation is gated by control over the upstream model output rather than by any ruby_llm configuration. Impact is limited to CPU consumption and processing delay in the request handling the response. |
| Impact | All real-world signals point to a low priority despite the input CVSS of 7.5. The vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H is network, low-complexity and unauthenticated, but the A:H (high availability impact) appears inflated: the flaw is a POLYNOMIAL-time ReDoS (CWE-1333), not exponential, and the description itself characterizes the effect as 'excessive CPU consumption' that 'delay[s] chat-completion processing' rather than a crash or sustained outage - this argues for A:L and a real base score closer to 5.3. EPSS is 0.17% (5th percentile), among the lowest tiers, consistent with no public exploit and no scanning interest. Not in CISA KEV; no POC identified. A nuance limits the PR:N framing: although ruby_llm requires no application authentication, triggering the bug requires an attacker to influence the MODEL RESPONSE (many unterminated <think> tags), which in practice means a malicious/compromised model endpoint, a prompt-injection coercing such output, or a MitM on the LLM API connection - the host app is not a direct network attack surface. Finally the condition is Ruby-version-specific: Ruby 3.1.x is affected, while Ruby 3.2+ regex linear-time/memoization optimizations largely mitigate this class. Net: low real-world risk, further gated by product obscurity and runtime version. |
| Exploit ScenarioDerived | An application using the ruby_llm gem at the vulnerable commit on Ruby 3.1.x connects to an LLM endpoint an attacker controls or can influence (malicious provider, prompt-injected output, or MitM). The attacker returns a chat completion containing many unterminated <think> tags, driving lazy backtracking in the two think-tag parsing regexes to consume excessive CPU and delay request processing. No public exploit code or active exploitation is identified at time of analysis. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 01, 2026
Polynomial-time regular expression denial-of-service in the crmne/ruby_llm library's <think>-tag response parsing can be triggered when a model response contains many unterminated <think> tags, driving excessive CPU consumption and delaying chat-completion processing. Only deployments pinned near commit fa6f279847d6d7027814539d9c0dfc3bbdfd2a83 and running on Ruby 3.1.x are affected, since Ruby 3.2+ regex engine optimizations mitigate the backtracking; RubyLLM exposes no direct network surface of its own, so an attacker must be able to shape the upstream LLM response (malicious/compromised model endpoint, prompt injection, or interception of the model API connection). No public exploit code has been identified at time of analysis, EPSS is 0.17% (5th percentile), and there is no CISA KEV listing; the consensus signal is a low-priority issue despite the vendor-assigned 7.5 score, with real impact limited to CPU consumption and processing delay in the request handling the response.
RemediationAI
Upstream fix available (PR/commit); released patched version not independently confirmed - apply commit 5e88411f171721b381853fa77d254e266dcf6ad8 (https://github.com/crmne/ruby_llm/commit/5e88411f171721b381853fa77d254e266dcf6ad8), which removes the regex-based <think>-tag extraction in lib/ruby_llm/protocols/chat_completions/chat.rb and the stream-accumulator tag state machine; confirm your pinned revision is at or after that commit rather than assuming a specific gem version number, since none is confirmed in the source data. If the patch cannot be applied immediately, the most surgical mitigation is to stop passing string content through think-tag extraction (the code path removed by the fix), at the cost of losing inline reasoning-block splitting and any UI that depends on separate thinking text. Running the application on Ruby 3.2 or later also mitigates the backtracking via regex engine optimizations, though this is a runtime-wide upgrade with broader regression-testing implications rather than a targeted fix. Because exploitation requires control over the model response, reduce that prerequisite: use TLS and, where supported, certificate pinning to the LLM endpoint to defeat interception, treat all model output as untrusted and constrain prompt-injection surface, and cap or truncate response body size before parsing so a pathological payload cannot be delivered at scale. Vendor references: https://github.com/crmne/ruby_llm and https://nvd.nist.gov/vuln/detail/CVE-2026-67987 (EUVD-2026-89427).
Affected VersionsENISA
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
RubyLLM is a Ruby library for interacting with LLM chat-completion APIs. Its chat-completions protocol layer (lib/ruby_llm/protocols/chat_completions/chat.rb) and its streaming accumulator (lib/ruby_llm/stream_accumulator.rb) previously parsed model output for inline reasoning blocks delimited by <think>...</think> and stripped them from the user-visible content. The extraction logic used two consecutive regular expressions - a scan of %r{<think>(.*?)</think>}m and a gsub of %r{<think>.*?</think>}m - plus a streaming state machine that held back partial tags across chunk boundaries. Because these patterns involve nested quantifiers over arbitrary-length content, they exhibit catastrophic/polynomial backtracking on inputs containing many opening <think> tags with no matching closing tag; this is CWE-1333, Inefficient Regular Expression Complexity. The pathological behavior is runtime-dependent: Ruby 3.1.x's regex engine does not have the internal optimizations introduced in Ruby 3.2+, which is why the advisory scopes the issue specifically to Ruby 3.1.x. The upstream fix (commit 5e88411f171721b381853fa77d254e266dcf6ad8) removes the regex-based think-tag extraction entirely, deletes extract_think_tag_content and the stream-accumulator tag state machine (handling content as opaque text) and updates the thinking feature documentation accordingly; the code is reachable only by the client parsing a response, not by a remotely reachable endpoint in the library itself.
Know when Ruby gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
PR:N since no app auth is needed, but A:L not A:H because the polynomial ReDoS causes CPU delay rather than full denial of service.
Primary rating from Vendor (mitre).
CVSS VectorVendor: mitre
Lifecycle Timeline
3DescriptionCVE.org
crmne/ruby_llm at commit fa6f279847d6d7027814539d9c0dfc3bbdfd2a83 contains polynomial-time regular expression denial-of-service conditions in think-tag response parsing on Ruby 3.1.x. A malicious or anomalous model response containing many unterminated <think> tags can cause excessive CPU consumption in two consecutive regular expressions and delay chat-completion processing
Executive ViewAI
The crmne/ruby_llm library at commit fa6f279847d6d7027814539d9c0dfc3bbdfd2a83, when run on Ruby 3.1.x, can experience excessive CPU consumption and delayed chat-completion processing if an attacker can influence the upstream model response to contain many unterminated <think> tags. Affected teams are those running that pinned library and Ruby version combination while relying on external LLM endpoints that could be malicious, compromised, or intercepted. Leadership should care because this is a low-likelihood availability issue for AI chat features rather than a broadly exploitable network-facing vulnerability; no public exploit identified at time of analysis, with no CISA KEV listing.
No vendor-released patch identified at time of analysis; interim mitigations include upgrading Ruby 3.1.x to Ruby 3.2+ where possible, limiting and validating model response size and content, stripping or rejecting unterminated <think> tags before parsing, enforcing request timeouts, concurrency caps, CPU quotas, and process isolation, restricting LLM endpoints to trusted sources, protecting model API connection integrity, and monitoring for CPU spikes.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
Ruby before 2.4.3 allows Net::FTP command injection. Rated high severity (CVSS 8.8), this vulnerability is remotely expl
The lazy_initialize function in lib/resolv.rb in Ruby through 2.4.3 uses Kernel#open, which might allow Command Injectio
Ruby through 2.2.7, 2.3.x through 2.3.4, and 2.4.x through 2.4.1 can expose arbitrary memory during a JSON.generate call
Type confusion exists in two methods of Ruby's WIN32OLE class, ole_invoke and ole_query_interface. Rated critical severi
Authenticated remote code execution in OpenC3 COSMOS (Ruby gem 'openc3' versions 5.1.0 through 7.2.1) lets any logged-in
Type confusion exists in _cancel_eval Ruby's TclTkIp class method. Rated critical severity (CVSS 9.8), this vulnerabilit
An exploitable heap overflow vulnerability exists in the Fiddle::Function.new "initialize" function functionality of Rub
An issue was discovered in Oniguruma 6.2.0, as used in Oniguruma-mod in Ruby through 2.4.1 and mbstring in PHP through 7
Stored XSS in Bugsink error tracking tool before 2.0.13 allows unauthenticated attackers to inject persistent scripts th
Ruby before 2.4.2, 2.3.5, and 2.2.8 is vulnerable to a malicious format string which contains a precious specifier (*) w
Heap-based buffer overflow in Ruby 1.8, 1.9 before 1.9.3-p484, 2.0 before 2.0.0-p353, 2.1 before 2.1.0 preview2, and tru
Heap-use-after-free in the Ruby json gem's native C extension (versions 2.20.0 through 2.21.1) allows an unauthenticated
EUVD-2026-89427
GHSA-5m38-526f-3498
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB