CVE-2022-21195: Url regex Denial of Service Vulnerability
MODERATECVE-2022-21195 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-1333: Inefficient Regular Expression Complexity) affecting Url regex libraries in the PyPI ecosystem. The issue involves regular expression denial of service in url_regex. Remediation is available in the latest vendor maintenance releases.
CVE-2022-21195 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2022-21195
To remediate this vulnerability, upgrade all affected Url regex dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install url_regex>=Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show url_regex
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2022-21195, inspect your installed packages using pip:
pip show url_regex
Analyze the terminal output to locate any version of Url regex in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The pip show url_regex command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1333: Inefficient Regular Expression Complexity, where the product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential. In Url regex, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-21195 Affected Url regex Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
url_regex
|
PyPI |
≤ 1.0.4
|
|
References
Frequently Asked Questions
What is CVE-2022-21195?
Which Url regex versions are affected?
What version fixes CVE-2022-21195?
Is url_regex affected?
What is the CVSS score of CVE-2022-21195?
What CWE is associated with CVE-2022-21195?
How can I check PyPI dependencies for CVE-2022-21195?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-hg3w-7hj9-m3f7",
"modified" : "2022-05-25T20:35:04Z",
"published" : "2022-05-21T00:00:25Z",
"aliases" : [ "CVE-2022-21195" ],
"summary" : "Regular expression denial of service in url_regex",
"details" : "All versions of package url-regex are vulnerable to Regular Expression Denial of Service (ReDoS) which can cause the CPU usage to crash.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "url_regex"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"last_affected" : "1.0.4"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21195"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/AlexFlipnote/url_regex"
}, {
"type" : "WEB",
"url" : "https://github.com/AlexFlipnote/url_regex/blob/master/url_regex/url_regex.py"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-PYTHON-URLREGEX-2347643"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1333" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-05-25T20:35:04Z",
"nvd_published_at" : "2022-05-20T20:15:00Z"
}
}