---
title: "CWE-624: Executable Regular Expression Error"
url: https://radicalnotion.ai/cwe/cwe-624
type: cwe
description: "The product uses a regular expression that either (1) contains an executable component with user-controlled inputs, or (2) allows a user to enable execution by inserting pattern modifiers."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-624: Executable Regular Expression Error

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 4
- **Of those, in CISA KEV:** 0
- **New in 2026:** 3
- **CWE catalog version:** 4.21

## Description

The product uses a regular expression that either (1) contains an executable component with user-controlled inputs, or (2) allows a user to enable execution by inserting pattern modifiers.

Case (2) is possible in the PHP preg\_replace() function, and possibly in other languages when a user-controlled input is inserted into a string that is later parsed as a regular expression.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** PHP (Undetermined), Perl (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability | Execute Unauthorized Code or Commands | - |

## Potential mitigations

### Implementation

The regular expression feature in some languages allows inputs to be quoted or escaped before insertion, such as \\Q and \\E in Perl.

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2006-2059 | Executable regexp in PHP by inserting "e" modifier into first argument to preg\_replace |
| CVE-2005-3420 | Executable regexp in PHP by inserting "e" modifier into first argument to preg\_replace |
| CVE-2006-2878 | Complex curly syntax inserted into the replacement argument to PHP preg\_replace(), which uses the "/e" modifier |
| CVE-2006-2908 | Function allows remote attackers to execute arbitrary PHP code via the username field, which is used in a preg\_replace function call with a /e (executable) modifier. |

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-25237 | PEAR is Vulnerable to PHP Code Execution via preg\_replace /e in Bug Update Emails | critical | 9.2 | - | No | 2026-02-03 |
| CVE-2024-41655 | TF2 Item Format Regular Expression Denial of Service vulnerability | high | 8.7 | - | No | 2024-07-23 |
| CVE-2026-113877 | HTTP::Headers::ActionPack versions before 0.10 for Perl allow CPU exhaustion via Accept-Language ranges matched as regular expressions | high | 7.5 | - | No | 2026-10-23 |
| CVE-2026-97076 | WordPress WP Rocket plugin \< 3.23.5 - Denial of Service Attack vulnerability | high | 7.5 | - | No | 2026-10-09 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-77](https://radicalnotion.ai/cwe/cwe-77) | Improper Neutralization of Special Elements used in a Command |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| Software Fault Patterns | Tainted input to command | SFP24 | - |

## Frequently asked questions

### What is CWE-624?

The product uses a regular expression that either (1) contains an executable component with user-controlled inputs, or (2) allows a user to enable execution by inserting pattern modifiers.

### What CVEs are caused by CWE-624?

4 recorded CVEs are attributed to CWE-624, including CVE-2026-25237, CVE-2024-41655 and CVE-2026-113877.

### How do you prevent CWE-624?

The regular expression feature in some languages allows inputs to be quoted or escaped before insertion, such as \\Q and \\E in Perl.

### How is CWE-624 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-624?

Exploiting CWE-624 can lead to: Execute Unauthorized Code or Commands.

### Is CWE-624 actively exploited?

4 recorded CVEs are caused by CWE-624; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/624.html)

---

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