CWEweakness
CWE-185 Incorrect Regular Expression
- Abstraction
- Base
- Structure
- Simple
- Status
- Draft
- Languages
- Not Language-Specific, Python
- CWE version
- 5.0
Description
The product specifies a regular expression in a way that causes data to be improperly matched or compared.
Common consequences
• Other: Unexpected State, Varies by Context — When the regular expression is not correctly specified, data might have a different format or type than the rest of the program expects, producing resultant weaknesses or errors.
• Access Control: Bypass Protection Mechanism — When the regular expression is used in protection mechanisms such as filtering or validation, this may allow an attacker to bypass the intended restrictions on the incoming data.
• Access Control: Bypass Protection Mechanism — In PHP, regular expression checks can sometimes be bypassed with a null byte, leading to any number of weaknesses.
Potential mitigations
• [Implementation] Regular expressions can become error prone when defining a complex language even for those experienced in writing grammars. Determine if several smaller regular expressions simplify one large regular expression. Also, subject the regular expression to thorough testing techniques such as equivalence partitioning, boundary value analysis, and robustness. After testing and a reasonable confidence level is achieved, a regular expression may not be foolproof. If an exploit is allowed to slip through, then record the exploit and refactor the regular expression.
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-2002-2109: Regexp isn't "anchored" to the beginning or end, which allows spoofed values that have trusted values as substrings.
• CVE-2005-1949: Regexp for IP address isn't anchored at the end, allowing appending of shell metacharacters.
• CVE-2001-1072: Bypass access restrictions via multiple leading slash, which causes a regular expression to fail.
• CVE-2000-0115: Local user DoS via invalid regular expressions.
• CVE-2002-1527: Chain: Malformed input generates a regular expression error that leads to information exposure.
• CVE-2005-1061: Certain strings are later used in a regexp, leading to a resultant crash.
• CVE-2005-2169: MFV. Regular expression intended to protect against directory traversal reduces ".../...//" to "../".
• CVE-2005-0603: Malformed regexp syntax leads to information exposure in error message.
• CVE-2005-1820: Code injection due to improper quoting of regular expression.
• CVE-2005-3153: Null byte bypasses PHP regexp check (interaction error).
• CVE-2005-4155: Null byte bypasses PHP regexp check (interaction error).
Related
Attack pattern · CAPEC (3)
Observed example · CVE (11)
- CVE-2005-4155 registration.PHP in ATutor 1.5.1 pl2 allows remote attackers to execute arbitrary SQL commands via an e-mail address that ends in a NULL… vulnerability
- CVE-2005-3153 login.php in myBloggie 2.1.3 beta and earlier allows remote attackers to bypass a whitelist regular expression and conduct SQL injection… vulnerability
- CVE-2005-2169 Directory traversal vulnerability in source.php in Quick & Dirty PHPSource Printer 1.1 and earlier allows remote attackers to read… 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-2005-1820 zboard.php in Zeroboard version 4.1pl2 to 4.1pl5 allows remote attackers to execute arbitrary PHP code via improper quoting when using the… vulnerability
- CVE-2005-1061 The secure script in LogWatch before 2.6-2 allows attackers to prevent LogWatch from detecting malicious activity via certain strings in… vulnerability
- CVE-2005-0603 viewtopic.php in phpBB 2.0.12 and earlier allows remote attackers to obtain sensitive information via a highlight parameter containing… vulnerability
- CVE-2002-1527 emumail.cgi in EMU Webmail 5.0 allows remote attackers to determine the full pathname for emumail.cgi via a malformed string containing… 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-2001-1072 Apache with mod_rewrite enabled on most UNIX systems allows remote attackers to bypass RewriteRules by inserting extra / (slash) characters… vulnerability
- CVE-2000-0115 IIS allows local users to cause a denial of service via invalid regular expressions in a Visual Basic script in an ASP page. vulnerability
Can precede · CWE (2)
Child of · CWE (1)
- CWE-697 Incorrect Comparison weakness
Referenced by CAPEC · weakness (3)
Referenced by CVE · weakness (46)
- CVE-2026-114653 A client-side encryption schema construction component in the MongoDB C# Driver places caller-supplied field identifiers into a position… vulnerability
- CVE-2026-111057 Mercury is a Python framework for sharing Jupyter notebooks as web applications and dashboards. vulnerability
- CVE-2026-111755 follow-redirects is a Node.js HTTP and HTTPS client wrapper that automatically follows redirects. vulnerability
- CVE-2026-54506 Vvveb is a powerful and easy to use CMS with page builder to build websites, blogs or ecommerce stores. vulnerability
- CVE-2026-88021 Consul and Consul Enterprise are vulnerable to an authorization bypass in the Connect service mesh that may allow a service to reach a… vulnerability
- CVE-2026-73425 Astro is a web framework for content-driven websites. vulnerability
- CVE-2026-64655 GitHub CLI (gh) is GitHub’s official command line tool. vulnerability
- CVE-2026-45065 Symfony is a PHP framework for web and console applications and a set of reusable PHP components. vulnerability
- CVE-2026-56021 Webmin allows unauthenticated attackers to read the contents of any file ending in .conf within module directories, due to a bypassable… vulnerability
- CVE-2026-47674 Hono is a Web application framework that provides support for any JavaScript runtime. vulnerability
- CVE-2026-48147 Budibase is an open-source low-code platform. vulnerability
- CVE-2026-25542 Tekton Pipelines project provides k8s-style resources for declaring CI/CD-style pipelines. vulnerability
- CVE-2026-4296 An incorrect regular expression vulnerability was identified in GitHub Enterprise Server that allowed an attacker to bypass OAuth redirect… vulnerability
- CVE-2026-39350 Istio is an open platform to connect, manage, and secure microservices. vulnerability
- CVE-2026-33347 league/commonmark is a PHP Markdown parser. vulnerability
- CVE-2026-33418 DiceBear is an avatar library for designers and developers. vulnerability
- CVE-2026-27895 LDAP Account Manager (LAM) is a webfrontend for managing entries (e.g. vulnerability
- CVE-2026-3419 Fastify incorrectly accepts malformed `Content-Type` headers containing trailing characters after the subtype token, in violation of RFC… vulnerability
- CVE-2026-25896 fast-xml-parser allows users to validate XML, parse XML to JS object, or build XML from JS object without C/C++ based libraries and no… vulnerability
- CVE-2026-25479 Litestar is an Asynchronous Server Gateway Interface (ASGI) framework. vulnerability
- CVE-2026-24398 Hono is a Web application framework that provides support for any JavaScript runtime. vulnerability
- CVE-2025-54365 fastapi-guard is a security library for FastAPI that provides middleware to control IPs, log requests, detect penetration attempts and more. vulnerability
- CVE-2025-20139 A vulnerability in chat messaging features of Cisco Enterprise Chat and Email (ECE) could allow an unauthenticated, remote attacker to… vulnerability
- CVE-2024-52289 authentik is an open-source identity provider. vulnerability
- CVE-2024-6641 The WP Hardening – Fix Your WordPress Security plugin for WordPress is vulnerable to Security Feature Bypass in all versions up to, and… vulnerability
- CVE-2024-2223 An Incorrect Regular Expression vulnerability in Bitdefender GravityZone Update Server allows an attacker to cause a Server Side Request… vulnerability
- CVE-2021-36093 It's possible to create an email which can be stuck while being processed by PostMaster filters, causing DoS. vulnerability
- CVE-2018-1109 A vulnerability was found in Braces versions 2.2.0 and above, prior to 2.3.1. vulnerability
- CVE-2020-7929 A user authorized to perform database queries may trigger denial of service by issuing specially crafted query contain a type of regex. vulnerability
- CVE-2020-3408 A vulnerability in the Split DNS feature of Cisco IOS Software and Cisco IOS XE Software could allow an unauthenticated, remote attacker to… vulnerability
Referenced by CWE · child of (2)
Referenced by CWE · has member (1)
- CWE-884 CWE Cross-section view