Skip to content
OpenAdvisories

Weakness (CWE)

CWE-185: Incorrect Regular Expression

Base Draft

The product specifies a regular expression in a way that causes data to be improperly matched or compared.

How to prevent it (1 mitigation)
  1. 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.

Source: MITRE CWE-185

2 results · Clear filters · Feed

  • Critical 10.0

    Mercury: Unauthenticated Remote Code Execution in /api/terminals - access control bypass

    Mercury is a Python framework for sharing Jupyter notebooks as web applications and dashboards. From 3.0.0 until 3.2.4, a missing comma in BLOCKED_PATTERNS concatenates the /lab and /api/terminals regular-expression literals. Requests to /api/terminals theref…

  • Critical 9.3

    fast-xml-parser has an entity encoding bypass via regex injection in DOCTYPE entity names

    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 callback. From 4.1.3to before 5.3.5, a dot (.) in a DOCTYPE entity name is treated as a regex wildcard during entity replace…