CVE-2020-5236: Waitress Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-73m2-3pwg-5fgc
CVSS 5.7
CWE-400
Published
Advisory Summary

CVE-2020-5236 is a MODERATE (CVSS 5.7) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Waitress libraries in the PyPI ecosystem. The issue involves catastrophic backtracking in regex allows denial of service in waitress. Remediation is available by upgrading affected packages to version 1.4.3.

CVE-2020-5236 at a Glance

CVE Identifier CVE-2020-5236
GHSA Identifier GHSA-73m2-3pwg-5fgc
Severity MODERATE
CVSS v3.1 Base Score 5.7
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Waitress
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2020-5236

To remediate this vulnerability, upgrade all affected Waitress dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

waitress fixed: 1.4.3
pip install waitress>=1.4.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show waitress

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2020-5236, inspect your installed packages using pip:

pip show waitress

Analyze the terminal output to locate any version of Waitress in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.3), your application is affected.

Note: The pip show waitress command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Waitress, 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

### Impact When waitress receives a header that contains invalid characters it will cause the regular expression engine to catastrophically backtrack causing the process to use 100% CPU time and blocking any other interactions. This would allow an attacker to send a single request with an invalid header and take the service offline. Invalid header example: ``` Bad-header: xxxxxxxxxxxxxxx\x10 ``` Increasing the number of `x`'s in the header will increase the amount of time Waitress spends in the regular expression engine. This issue was introduced in version 1.4.2 when the regular expression was updated to attempt to match the behaviour required by errata associated with RFC7230. ### Patches The regular expression that is used to validate incoming headers has been updated in version 1.4.3, it is recommended that people upgrade to the new version of Waitress as soon as possible. ### Workarounds If you have deployed a reverse proxy in front of Waitress it may already be rejecting requests that include invalid headers. ### Thanks The Pylons Project would like to thank [Fil Zembowicz](https://github.com/fzembow) for reaching out and disclosing this vulnerability! ### References Catastrophic backtracking explained: https://www.regular-expressions.info/catastrophic.html ### For more information If you have any questions or comments about this advisory: - open an issue at https://github.com/Pylons/waitress/issues (if not sensitive or security related) - email the Pylons Security mailing list: pylons-project-security@googlegroups.com (if security related)

CVE-2020-5236 Affected Waitress Versions

1 component(s)
Fixed Versions:
1.4.3
Product / Package Ecosystem Affected Versions Fixed Version
waitress
PyPI
≥ 1.4.2
< 1.4.3
All 1 versions
1.4.2
1.4.3

References

Frequently Asked Questions

What is CVE-2020-5236?
CVE-2020-5236 is a security vulnerability in Waitress involving Catastrophic backtracking in regex allows Denial of Service in Waitress under CWE-400: Uncontrolled Resource Consumption.
Which Waitress versions are affected?
Affected versions include releases prior to 1.4.3 across affected packages: waitress.
What version fixes CVE-2020-5236?
Upgrading to 1.4.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is waitress affected?
Yes, waitress is affected in releases prior to 1.4.3. Upgrade your dependency to 1.4.3 or later.
What is the CVSS score of CVE-2020-5236?
CVE-2020-5236 has a CVSS v3.1 base score of 5.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2020-5236?
CVE-2020-5236 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for CVE-2020-5236?
Run the dependency tree command: 'pip show waitress'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-73m2-3pwg-5fgc",
  "modified" : "2024-11-19T15:34:34Z",
  "published" : "2020-02-04T03:07:31Z",
  "aliases" : [ "CVE-2020-5236" ],
  "summary" : "Catastrophic backtracking in regex allows Denial of Service in Waitress",
  "details" : "### Impact\n\nWhen waitress receives a header that contains invalid characters it will cause the regular expression engine to catastrophically backtrack causing the process to use 100% CPU time and blocking any other interactions.\n\nThis would allow an attacker to send a single request with an invalid header and take the service offline.\n\nInvalid header example:\n\n```\nBad-header: xxxxxxxxxxxxxxx\\x10\n```\n\nIncreasing the number of `x`'s in the header will increase the amount of time Waitress spends in the regular expression engine.\n\nThis issue was introduced in version 1.4.2 when the regular expression was updated to attempt to match the behaviour required by errata associated with RFC7230.\n\n### Patches\n\nThe regular expression that is used to validate incoming headers has been updated in version 1.4.3, it is recommended that people upgrade to the new version of Waitress as soon as possible.\n\n### Workarounds\n\nIf you have deployed a reverse proxy in front of Waitress it may already be rejecting requests that include invalid headers.\n\n### Thanks\n\nThe Pylons Project would like to thank [Fil Zembowicz](https://github.com/fzembow) for reaching out and disclosing this vulnerability!\n\n### References\n\nCatastrophic backtracking explained: https://www.regular-expressions.info/catastrophic.html\n\n### For more information\nIf you have any questions or comments about this advisory:\n\n- open an issue at https://github.com/Pylons/waitress/issues (if not sensitive or security related)\n- email the Pylons Security mailing list: pylons-project-security@googlegroups.com (if security related)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "waitress"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "1.4.2"
      }, {
        "fixed" : "1.4.3"
      } ]
    } ],
    "versions" : [ "1.4.2" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Pylons/waitress/security/advisories/GHSA-73m2-3pwg-5fgc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-5236"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Pylons/waitress/commit/6e46f9e3f014d64dd7d1e258eaf626e39870ee1f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Pylons/waitress"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/waitress/PYSEC-2020-155.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-02-04T03:06:40Z",
    "nvd_published_at" : null
  }
}