Waitress has request processing race condition in HTTP pipelining with invalid first request
Published 29 Oct 2024 · Updated 21 Jan 2025
Is your project on an affected waitress?
Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- >=2.0.0 <3.0.1
- Fixed in
- 3.0.1
pip install 'waitress>=3.0.1'Details
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.
Is GHSA-9298-4cf8-g4wj in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected waitress, and gives you the command that fixes it.
More advisories for waitress
- HighCVE-2024-49769Waitress vulnerable to DoS leading to high CPU usage/resource exhaustion · 29 Oct 2024
- HighCVE-2022-31015Uncaught Exception (due to a data race) leads to process termination in Waitress · 2 Jun 2022
- HighCVE-2022-24761HTTP Request Smuggling in waitress · 18 Mar 2022
- MediumCVE-2020-5236Catastrophic backtracking in regex allows Denial of Service in Waitress · 4 Feb 2020
- MediumCVE-2019-16789HTTP Request Smuggling in Waitress: Invalid whitespace characters in headers (Follow-up) · 6 Jan 2020
- HighGHSA-m5ff-3wj3-8ph4HTTP Request Smuggling: Invalid whitespace characters in headers in Waitress · 26 Dec 2019
References
- Linkgithub.com/Pylons/waitress/security/advisories/GHSA-9298-4cf8-g4wj
- Advisorynvd.nist.gov/vuln/detail/CVE-2024-49768
- Linkgithub.com/Pylons/waitress/commit/e4359018537af376cf24bd13616d861e2fb76f65
- Packagegithub.com/Pylons/waitress
- Linkgithub.com/pypa/advisory-database/tree/main/vulns/waitress/PYSEC-2024-210.yaml
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.