---
title: "CAPEC-492: Regular Expression Exponential Blowup"
url: https://radicalnotion.ai/capec/capec-492
type: capec
description: "An adversary may execute an attack on a program that uses a poor Regular Expression(Regex) implementation by choosing input that results in an extreme situation for the Regex. A typical extreme situation operates at exponential time compared to the input size. This is due to most implementations using a Nondeterministic Finite Automaton(NFA) state machine to be built by the Regex algorithm since NFA allows backtracking and thus more complex regular expressions."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-492: Regular Expression Exponential Blowup

- **Abstraction:** Standard
- **Status:** Draft
- **CAPEC catalog version:** 3.9

## Description

An adversary may execute an attack on a program that uses a poor Regular Expression(Regex) implementation by choosing input that results in an extreme situation for the Regex. A typical extreme situation operates at exponential time compared to the input size. This is due to most implementations using a Nondeterministic Finite Automaton(NFA) state machine to be built by the Regex algorithm since NFA allows backtracking and thus more complex regular expressions.

The algorithm builds a finite state machine and based on the input transitions through all the states until the end of the input is reached. NFA engines may evaluate each character in the input string multiple times during the backtracking. The algorithm tries each path through the NFA one by one until a match is found; the malicious input is crafted so every path is tried which results in a failure. Exploitation of the Regex results in programs hanging or taking a very long time to complete. These attacks may target various layers of the Internet due to regular expressions being used in validation.

## Prerequisites

- This type of an attack requires the ability to identify hosts running a poorly implemented Regex, and the ability to send crafted input to exploit the regular expression.

## Mitigations

- Test custom written Regex with fuzzing to determine if the Regex is a poor one. Add timeouts to processes that handle the Regex logic. If an evil Regex is found rewrite it as a good Regex.

## Related weaknesses (CWE)

- [CWE-400](https://radicalnotion.ai/cwe/cwe-400): Uncontrolled Resource Consumption
- [CWE-1333](https://radicalnotion.ai/cwe/cwe-1333): Inefficient Regular Expression Complexity

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-130](https://radicalnotion.ai/capec/capec-130) | Excessive Allocation |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| OWASP Attacks | Regular expression Denial of Service - ReDoS | - |

## Frequently asked questions

### What is CAPEC-492?

An adversary may execute an attack on a program that uses a poor Regular Expression(Regex) implementation by choosing input that results in an extreme situation for the Regex. A typical extreme situation operates at exponential time compared to the input size. This is due to most implementations using a Nondeterministic Finite Automaton(NFA) state machine to be built by the Regex algorithm since NFA allows backtracking and thus more complex regular expressions.

### How do you prevent CAPEC-492?

Test custom written Regex with fuzzing to determine if the Regex is a poor one. Add timeouts to processes that handle the Regex logic. If an evil Regex is found rewrite it as a good Regex.

### What weaknesses does CAPEC-492 target?

CAPEC-492 exploits 2 CWE weaknesses: CWE-400 (Uncontrolled Resource Consumption) and CWE-1333 (Inefficient Regular Expression Complexity).

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/492.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-492). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
