CVE-2024-49768: Waitress Waitress Has Request Processing Race Vulnerability

CRITICAL
Advisory Identifier: GHSA-9298-4cf8-g4wj
CVSS 9.1
CWE-367 CWE-444
Published
Advisory Summary

CVE-2024-49768 is a CRITICAL (CVSS 9.1) waitress has request processing race vulnerability (CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition) affecting Waitress libraries in the PyPI ecosystem. The issue involves waitress has request processing race condition in http pipelining with invalid first request. Remediation is available by upgrading affected packages to version 3.0.1.

CVE-2024-49768 at a Glance

CVE Identifier CVE-2024-49768
GHSA Identifier GHSA-9298-4cf8-g4wj
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition
Affected Product Waitress
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.1

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:H/I:H/A:N).

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

How to Fix CVE-2024-49768

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: 3.0.1
pip install waitress>=3.0.1
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-2024-49768, 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 3.0.1), 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-367: Time-of-check Time-of-use (TOCTOU) Race Condition, where the product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check. 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 A remote client may send a request that is exactly `recv_bytes` (defaults to 8192) long, followed by a secondary request using HTTP pipelining. When request lookahead is disabled (default) we won't read any more requests, and when the first request fails due to a parsing error, we simply close the connection. However when request lookahead is enabled, it is possible to process and receive the first request, start sending the error message back to the client while we read the next request and queue it. This will allow the secondary request to be serviced by the worker thread while the connection should be closed. ### Patches Waitress 3.0.1 fixes the race condition. ### Workarounds Disable `channel_request_lookahead`, this is set to `0` by default disabling this feature. For this vulnerability this value is required to be changed from the default. ### For more information If you have any questions or comments about this advisory: * Open an issue in https://github.com/Pylons/waitress/issues (if not sensitive or security related) * email the Pylons Security mailing list: [pylons-project-security@googlegroups.com](mailto:pylons-project-security@googlegroups.com) (if security related) ### Thanks - m4yfly and urn1ce From TianGong Team of Legendsec at Qi'anxin Group.

CVE-2024-49768 Affected Waitress Versions

1 component(s)
Fixed Versions:
3.0.1
Product / Package Ecosystem Affected Versions Fixed Version
waitress
PyPI
≥ 2.0.0
< 3.0.1
3.0.1

References

Frequently Asked Questions

What is CVE-2024-49768?
CVE-2024-49768 is a security vulnerability in Waitress involving Waitress has request processing race condition in HTTP pipelining with invalid first request under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition.
Which Waitress versions are affected?
Affected versions include releases prior to 3.0.1 across affected packages: waitress.
What version fixes CVE-2024-49768?
Upgrading to 3.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is waitress affected?
Yes, waitress is affected in releases prior to 3.0.1. Upgrade your dependency to 3.0.1 or later.
What is the CVSS score of CVE-2024-49768?
CVE-2024-49768 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2024-49768?
CVE-2024-49768 is classified under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition (The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.).
How can I check PyPI dependencies for CVE-2024-49768?
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-9298-4cf8-g4wj",
  "modified" : "2025-01-21T17:53:26Z",
  "published" : "2024-10-29T14:45:03Z",
  "aliases" : [ "CVE-2024-49768" ],
  "summary" : "Waitress has request processing race condition in HTTP pipelining with invalid first request",
  "details" : "### Impact\n\nA remote client may send a request that is exactly `recv_bytes` (defaults to 8192) long, followed by a secondary request using HTTP pipelining.\n\nWhen request lookahead is disabled (default) we won't read any more requests, and when the first request fails due to a parsing error, we simply close the connection.\n\nHowever when request lookahead is enabled, it is possible to process and receive the first request, start sending the error message back to the client while we read the next request and queue it. This will allow the secondary request to be serviced by the worker thread while the connection should be closed.\n\n### Patches\n\nWaitress 3.0.1 fixes the race condition.\n\n### Workarounds\n\nDisable  `channel_request_lookahead`, this is set to `0` by default disabling this feature. For this vulnerability this value is required to be changed from the default.\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open an issue in https://github.com/Pylons/waitress/issues (if not sensitive or security related)\n* email the Pylons Security mailing list: [pylons-project-security@googlegroups.com](mailto:pylons-project-security@googlegroups.com) (if security related)\n\n### Thanks\n\n- m4yfly and urn1ce From TianGong Team of Legendsec at Qi'anxin Group.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "waitress"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "3.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Pylons/waitress/security/advisories/GHSA-9298-4cf8-g4wj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-49768"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Pylons/waitress/commit/e4359018537af376cf24bd13616d861e2fb76f65"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Pylons/waitress"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/waitress/PYSEC-2024-210.yaml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-367", "CWE-444" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-10-29T14:45:03Z",
    "nvd_published_at" : "2024-10-29T15:15:11Z"
  }
}