CVE-2026-67987: 
Ruby vulnerability analysis and mitigation

Overview

CVE-2026-67987 is a polynomial-time Regular Expression Denial of Service (ReDoS) vulnerability in the crmne/ruby_llm Ruby AI framework, specifically in its <think> tag response parsing logic. The flaw exists at commit fa6f279847d6d7027814539d9c0dfc3bbdfd2a83 in lib/ruby_llm/protocols/chat_completions/chat.rb (lines 355–356) and affects deployments running on Ruby 3.1.x. It was published on September 29, 2026, with a patch committed the same day. The vulnerability carries a CVSS v3.1 base score of 7.5 (High) (Github Advisory).

Technical details

The root cause is CWE-1333 (Inefficient Regular Expression Complexity): two consecutive regular expressions used in the extract_think_tag_content method — text.scan(%r{<think>(.*?)</think>}m) and text.gsub(%r{<think>.*?</think>}m, '') — exhibit polynomial-time worst-case behavior on Ruby 3.1.x when processing strings with many unterminated <think> tags. Because the regexes use a lazy quantifier (.*?) with the multiline flag across potentially unbounded input, a crafted or anomalous LLM response containing a large number of unclosed <think> tags causes the Ruby regex engine to perform excessive backtracking, consuming CPU proportional to the square (or higher) of the input length. No authentication or special privileges are required; the attacker only needs to influence the content of a model response processed by the library (Github Advisory, Patch Commit).

Impact

Successful exploitation causes excessive CPU consumption on the server running the ruby_llm library, degrading or completely stalling chat-completion processing. The impact is limited to availability (no confidentiality or integrity loss), but sustained exploitation could render an AI-powered application unresponsive, affecting all users of the service. Because the trigger is a model response rather than a direct user request, the attack surface includes any pathway that allows an adversary to influence LLM output — such as prompt injection or a compromised/malicious model endpoint (Github Advisory).

Exploitability

There is no public proof-of-concept exploit and no evidence of in-the-wild exploitation at the time of disclosure (Github Advisory). The vulnerability is automatable (no user interaction required) and exploitable over the network without credentials, but requires the ability to influence the content of an LLM response processed by the library. The EPSS score is approximately 0.17–0.43% (35th percentile), indicating low near-term exploitation probability. The CVE status is listed as "Deferred" and it is not currently listed in the CISA KEV catalog (Github Advisory).

Exploitation steps

  1. Identify target: Locate an application using crmne/ruby_llm at commit fa6f279847d6d7027814539d9c0dfc3bbdfd2a83 or earlier versions with the extract_think_tag_content method, running on Ruby 3.1.x.
  2. Influence model response: Use prompt injection or control over a connected model endpoint to cause the LLM to return a response containing a large number of unterminated <think> tags (e.g., <think><think><think>... repeated thousands of times without closing tags).
  3. Trigger ReDoS: When the application calls extract_think_tag_content on the malicious response string, the two vulnerable regexes (text.scan(%r{<think>(.*?)</think>}m) and text.gsub(%r{<think>.*?</think>}m, '')) enter polynomial-time backtracking, consuming CPU proportional to the input size.
  4. Achieve DoS: Sustained or repeated delivery of such responses causes CPU exhaustion on the server, delaying or blocking chat-completion processing for all users (Patch Commit, Github Advisory).

Indicators of compromise

  • Process: Ruby server process (e.g., Puma, Unicorn, Sidekiq) showing sustained near-100% CPU usage on a single thread during or after chat-completion requests.
  • Logs: Application logs showing chat-completion requests that hang or time out without completing; error logs referencing regex evaluation or response parsing timeouts.
  • Network: Unusual or repeated requests to LLM provider endpoints returning responses with abnormally large payloads or many repeated <think> tag patterns.
  • Application Metrics: Spike in response latency or worker thread saturation correlated with specific model responses containing <think> tag sequences.

Mitigation and workarounds

The fix is to update crmne/ruby_llm to a version that includes commit 5e88411f171721b381853fa77d254e266dcf6ad8, which removes the extract_think_tag_content method and all <think> tag parsing logic entirely — thinking content is now sourced only from provider-specific fields (reasoning, reasoning_content, etc.) (Patch Commit). If an immediate upgrade is not possible, consider implementing a pre-processing filter to reject or truncate model responses containing excessive or malformed <think> tags before they reach the parsing layer. Additionally, applying timeouts on response parsing operations and rate-limiting chat-completion requests can reduce the impact of sustained exploitation attempts (Github Advisory).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Ubuntu

Unknown

devel

ruby-llm

Unknown

Source: This report was generated using AI

Related Ruby vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-55107CRITICAL10
  • Ruby logoRuby
  • kobako
NoYesSep 30, 2026
CVE-2026-67989HIGH7.5
  • Ruby logoRuby
  • ruby_llm
NoYesOct 02, 2026
CVE-2026-67987HIGH7.5
  • Ruby logoRuby
  • ruby_llm
NoYesSep 29, 2026
CVE-2026-12545MEDIUM6.7
  • Ruby logoRuby
  • hammer_cli
NoYesOct 01, 2026
GHSA-mwm8-39rw-8826MEDIUM6.3
  • Ruby logoRuby
  • sqlite3
NoYesOct 02, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management