CWE•Base•Draft•2 recent CVEs
CWE-186Overly Restrictive Regular Expression
Description
A regular expression is overly restrictive in a way that does not match all intended values.
Common consequences
- Access Control→Bypass Protection Mechanism,Varies by ContextAn overly restrictive regexp misses some potentially security-relevant values, leading to either false positives *or* false negatives, depending on how the regexp is being used within the code.
Potential mitigations
- ImplementationRegular 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 your regular expression to thorough testing techniques such as equivalence partitioning, boundary value analysis, and robustness. After testing and a reasonable confidence le