brace-expansion, Regular Expression Denial of Service (ReDoS), CVE-2025-XXXXX (Low)

Listen to this Post

How the CVE Works

The vulnerability (CVE-2025-XXXXX) in `brace-expansion` (versions ≤1.1.11) stems from inefficient regex handling in the `expand()` function within index.js. Attackers can craft malicious brace patterns (e.g., {1..1000000000}) triggering catastrophic backtracking due to poor quantifier handling in the regex engine. This ReDoS attack consumes excessive CPU resources, causing service degradation. Remote exploitation is possible but requires high-complexity input, and the patch (commit a5b98a4f30d7813266b221435e1eaaf25a1b0ac5) optimizes pattern matching logic.

DailyCVE Form

Platform: Node.js
Version: ≤1.1.11
Vulnerability: ReDoS
Severity: Low
Date: Jun 10, 2025

Prediction: Patch expected Jun 20, 2025

What Undercode Say:

Analytics

  • Attack Vector: Remote
  • CVSS Score: 3.7 (Low)
  • Affected Packages: `brace-expansion@<=1.1.11`

Exploit Command

curl -X POST http://target.com/api/expand -d '{"pattern":"{1..999999999}"}'

Protection Commands

npm update brace-expansion --save

Code Patch Verification

const braceExpansion = require('brace-expansion');
console.log(braceExpansion('{1..10}').length === 10); // Safe pattern test

Mitigation Code

// Sanitize input before processing
function safeBraceExpand(input) {
if (input.length > 100) throw new Error("Input too large");
return require('brace-expansion')(input);
}

Log Monitoring

grep -E 'brace-expansion.timeout' /var/log/node.log

Dependency Check

npm ls brace-expansion

Exploit Detection Script

const re = /{....}/;
if (re.test(userInput)) {
console.warn("Potential ReDoS attempt detected");
}

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image

Scroll to Top