Skip to content

ReDoS via unvalidated sensitivePatterns regex #28

Description

@akshayaab

Title: ReDoS risk: user-controlled sensitivePatterns passed to RegExp without validation

Labels: security, critical, response-analyzer

Body:

Problem

User-controlled sensitivePatterns from config are passed into new RegExp(pattern, "i") in response-analyzer.ts without validation or sanitization. Malicious or poorly chosen patterns (e.g. ReDoS like (a+)+$ or (a|a?)+b) can cause catastrophic backtracking when run against large response bodies.

Why this matters

During a red-team run, every agent response is checked against these patterns. A single pathological regex can block the Node event loop and freeze the entire scan — a denial-of-service on the red-team operator.

Impact

Critical — Entire real-time scan can hang indefinitely; operational and availability impact.

Files / location

  • lib/response-analyzer.ts — lines ~18–19, 29–31 (pattern → new RegExp)
  • lib/types.tsConfig.sensitivePatterns
  • config.json / config.example.json — pattern list

Details

Documented as Issue ID. Mitigations: allowlist safe pattern shapes, timeout per match, or use a safe matcher for simple literals.

Issue ID:
Category: Security Risk
File/Location: lib/response-analyzer.ts (lines 18–19, 29–31)
Problem Statement: User-controlled sensitivePatterns from config are passed directly into new RegExp(pattern, "i") without validation or sanitization.
Why This Is a Problem: Malicious or poorly chosen regex patterns (e.g. ReDoS patterns like (a+)+$ or (a|a?)+b) can cause catastrophic backtracking and block the event loop, leading to denial of service.
Impact Level: Critical
Notes: Config may be edited by admins or generated; any pattern that can run against large response bodies is a risk.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions