- What is CWE-185?
- The product specifies a regular expression in a way that causes data to be improperly matched or compared.
- What CVEs are caused by CWE-185?
- 22 recorded CVEs are attributed to CWE-185, including CVE-2024-2223, CVE-2026-25896, CVE-2026-27895.
- How do you prevent CWE-185?
- 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.
- How is CWE-185 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-185?
- Exploiting CWE-185 can lead to: Unexpected State, Varies by Context, Bypass Protection Mechanism.
- Is CWE-185 actively exploited?
- 22 recorded CVEs are caused by CWE-185; none are currently in CISA's KEV catalog of actively exploited flaws.