CWEweakness

CWE-625 Permissive Regular Expression

Official page ↗
Abstraction
Base
Structure
Simple
Status
Draft
Languages
PHP, Perl, Python
CWE version
5.0

Description

The product uses a regular expression that does not sufficiently restrict the set of allowed values.

Common consequences

• Access Control: Bypass Protection Mechanism — The regexp could accept substrings that match the pattern, which produces a partial comparison to the target. In some cases, this can allow dangerous substrings to bypass the intended protection.

Potential mitigations

• [Implementation] When applicable, ensure that the regular expression marks beginning and ending string patterns, such as "/^string$/" for 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-2021-22204: Chain: regex in EXIF processor code does not correctly determine where a string ends (CWE-625), enabling eval injection (CWE-95), as exploited in the wild per CISA KEV. • CVE-2006-1895: ".*" regexp leads to static code injection • CVE-2002-2175: insertion of username into regexp results in partial comparison, causing wrong database entry to be updated when one username is a substring of another. • CVE-2006-4527: regexp intended to verify that all characters are legal, only checks that at least one is legal, enabling file inclusion. • CVE-2005-1949: Regexp for IP address isn't anchored at the end, allowing appending of shell metacharacters. • CVE-2002-2109: Regexp isn't "anchored" to the beginning or end, which allows spoofed values that have trusted values as substrings. • CVE-2006-6511: regexp in .htaccess file allows access of files whose names contain certain substrings • CVE-2006-6629: allow load of macro files whose names contain certain substrings.

Related

Observed example · CVE (8)

  • CVE-2021-22204 Improper neutralization of user data in the DjVu file format in ExifTool versions 7.44 and up allows arbitrary code execution when parsing… vulnerability
  • CVE-2006-6629 lib/WeBWorK/PG/Translator.pm in WeBWorK Program Generation (PG) Language before 2.3.1 uses an insufficiently restrictive regular expression… vulnerability
  • CVE-2006-6511 dadaIMC .99.3 uses an insufficiently restrictive FilesMatch directive in the installed .htaccess file, which allows remote attackers to… vulnerability
  • CVE-2006-4527 includes/content/gateway.inc.php in CubeCart 3.0.12 and earlier, when magic_quotes_gpc is disabled, uses an insufficiently restrictive… vulnerability
  • CVE-2006-1895 Direct static code injection vulnerability in includes/template.php in phpBB allows remote authenticated users with write access to execute… vulnerability
  • CVE-2005-1949 The eping_validaddr function in functions.php for the ePing plugin for e107 portal allows remote attackers to execute arbitrary commands… vulnerability
  • CVE-2002-2109 Matt Wright FormMail 1.9 and earlier allows remote attackers to bypass the HTTP_REFERER check and conduct unauthorized activities via (1) a… vulnerability
  • CVE-2002-2175 phpSquidPass before 0.2 uses an incomplete regular expression to find a matching username in its database, which allows remote… vulnerability

Child of · CWE (1)

  • CWE-185 Incorrect Regular Expression weakness

Peer of · CWE (3)

  • CWE-183 Permissive List of Allowed Inputs weakness
  • CWE-184 Incomplete List of Disallowed Inputs weakness
  • CWE-187 Partial String Comparison weakness

Referenced by CVE · weakness (21)

  • CVE-2026-14814 GitLab has remediated an issue in GitLab CE/EE affecting all versions before 19.2.8, 19.3 before 19.3.5, and 19.4 before 19.4.2 that, under… vulnerability
  • CVE-2026-102983 Astro is a web framework for content-driven websites. vulnerability
  • CVE-2026-79965 Dell SCG 5.0 Appliance versions prior to 5.36.00.16 and Dell SCG 5.0 Application versions prior to 5.36.00.00, contains an External Control… vulnerability
  • CVE-2026-83609 xmldom is a pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module. vulnerability
  • CVE-2026-83617 xmldom is a pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module. vulnerability
  • CVE-2026-83618 xmldom is a pure JavaScript W3C standard-based (XML DOM Level 2 Core) DOMParser and XMLSerializer module. vulnerability
  • CVE-2026-82726 Permissive Regular Expression vulnerability in ash-project ash_phoenix lets a remote client select the tenant an Ash application uses, or… vulnerability
  • CVE-2026-55536 PraisonAI is a multi-agent teams system. vulnerability
  • CVE-2026-73845 CKAN MCP Server is a tool for querying CKAN open data portals. vulnerability
  • CVE-2026-19278 A flaw was found in StackRox/RHACS Central's Auth Machine-to-Machine (M2M) token exchange. vulnerability
  • CVE-2026-64940 Tegalog -Fumy Otegaru Memo Logger- provided by Nishishi Factory contains a vulnerability due to a permissive regular expression, which may… vulnerability
  • CVE-2026-44587 CarrierWave is a framework to upload files from Ruby applications. vulnerability
  • CVE-2026-37737 sanic-cors version 2.2.0 and prior contains an improper regular expression in the try_match() function in sanic_cors/core.py that uses… vulnerability
  • CVE-2026-40110 Jupyter Server is the backend for Jupyter web applications. vulnerability
  • CVE-2026-34763 Rack is a modular Ruby web server interface. vulnerability
  • CVE-2026-34830 Rack is a modular Ruby web server interface. vulnerability
  • CVE-2026-32973 OpenClaw before 2026.3.11 contains an exec allowlist bypass vulnerability where matchesExecAllowlistPattern improperly normalizes patterns… vulnerability
  • CVE-2026-23651 Permissive regular expression in Azure Compute Gallery allows an authorized attacker to elevate privileges locally. vulnerability
  • CVE-2023-6544 A flaw was found in the Keycloak package. vulnerability
  • CVE-2020-8910 A URL parsing issue in goog.uri of the Google Closure Library versions up to and including v20200224 allows an attacker to send malicious… vulnerability
  • CVE-2018-8926 Permissive regular expression vulnerability in synophoto_dsm_user in Synology Photo Station before 6.8.5-3471 and before 6.3-2975 allows… vulnerability

Referenced by CWE · child of (1)

  • CWE-777 Regular Expression without Anchors weakness