CWEweakness
CWE-777 Regular Expression without Anchors
Medium
Official page ↗
- Abstraction
- Variant
- Structure
- Simple
- Status
- Incomplete
- Likelihood of exploit
- Medium
- Languages
- Not Language-Specific, Python
- CWE version
- 5.0
Description
The product uses a regular expression to perform neutralization, but the regular expression omits one or more anchors that may allow malicious or malformed data to slip through.
Common consequences
• Availability, Confidentiality, Access Control: Bypass Protection Mechanism, Varies by Context — An unanchored regular expression in the context of an allowlist will possibly result in a protection mechanism failure. Malicious or malformed data may be included before or after any string matching the regular expression, allowing the data to enter trusted regions of the program. The type of malicious data that is allowed will depend on the context of the application and which anchors are omitted from the regular expression. The specific consequences will depend on what functionality the allowlist was protecting.
Potential mitigations
• [Implementation] Be sure to understand both what will be matched and what will not be matched by a regular expression. Anchoring the ends of the expression will allow the programmer to define an allowlist strictly limited to what is matched by the text in the regular expression. If you are using a package that only matches one line by default, ensure that you can match multi-line inputs if necessary.
Observed examples
• CVE-2022-30034: Chain: Web UI for a Python RPC framework does not use regex anchors to validate user login emails (CWE-777), potentially allowing bypass of OAuth (CWE-1390).
Related
Observed example · CVE (1)
- CVE-2022-30034 Flower, a web UI for the Celery Python RPC framework, all versions as of 05-02-2022 is vulnerable to an OAuth authentication bypass. vulnerability
Child of · CWE (1)
- CWE-625 Permissive Regular Expression weakness
Referenced by CVE · weakness (5)
- CVE-2026-97736 tinyauth before 5.1.3 allows rule bypass by appending an allowed route string. vulnerability
- CVE-2026-22068 Regular Expression without Anchors vulnerability in Apache Traffic Server. 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-40110 Jupyter Server is the backend for Jupyter web applications. vulnerability
- CVE-2026-39087 ntfy before 2.22.0 allows SSRF because of an unanchored regular expression for web push endpoint URLs. vulnerability