# CVE-2019-16786: HTTP Request Smuggling: Invalid Transfer-Encoding in Waitress

> Waitress mishandles Transfer-Encoding headers, allowing HTTP request smuggling that can bypass security controls or poison caches.

- **Severity:** High 7.1 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 Dec 2019
- **Updated:** 5 Aug 2024
- **Also known as:** DEBIAN-CVE-2019-16786, GHSA-g2xc-35jw-c63p, PYSEC-2019-137, UBUNTU-CVE-2019-16786

## What is CVE-2019-16786?

CVE-2019-16786 is a high-severity vulnerability in Debian Debian Linux, published on 20 Dec 2019. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Waitress through version 1.3.1 would parse the Transfer-Encoding header and only look for a single string value, if that value was not chunked it would fall through and use the Content-Length header instead. According to the HTTP standard Transfer-Encoding should be a comma separated list, with the inner-most encoding first, followed by any further transfer codings, ending with chunked. Requests sent with: "Transfer-Encoding: gzip, chunked" would incorrectly get ignored, and the request would use a Content-Length header instead to determine the body size of the HTTP message. This could allow for Waitress to treat a single request as multiple requests in the case of HTTP pipelining. This issue is fixed in Waitress 1.4.0.

Weakness: CWE-444 (Inconsistent Interpretation of HTTP Requests)

## Which versions are affected by CVE-2019-16786?

3 open source packages ship an affected version, including waitress. It affects 5 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `waitress` | PyPI | All versions | 1.3.1 |
| `waitress` | PyPI | All versions | 1.4.0 |
| `waitress` | PyPI | All versions | 1.4.0 |

Products: Agendaless Waitress, Debian Debian Linux, Fedoraproject Fedora, Oracle Communications Cloud Native Core Network Function Cloud Native Environment, Redhat Openstack.

## How do I fix CVE-2019-16786?

Upgrade waitress to a fixed version for your release line: 1.3.1 or 1.4.0.

## Is CVE-2019-16786 being exploited?

There is no known exploitation of CVE-2019-16786 in the wild and no public exploit code.

## Other vulnerabilities in Debian Debian Linux

- [CVE-2024-49768](https://insights.sbomify.com/CVE-2024-49768/): Waitress has request processing race condition in HTTP pipelining with invalid first request (critical 9.1)
- [CVE-2024-49769](https://insights.sbomify.com/CVE-2024-49769/): Waitress has a denial of service leading to high CPU usage/resource exhaustion (high 7.5)
- [CVE-2022-24761](https://insights.sbomify.com/CVE-2022-24761/): HTTP Request Smuggling in waitress (high 7.5)
- [CVE-2019-16792](https://insights.sbomify.com/CVE-2019-16792/): HTTP Request Smuggling: Content-Length Sent Twice in Waitress (high 7.1)
- [CVE-2019-16789](https://insights.sbomify.com/CVE-2019-16789/): HTTP Request Smuggling in Waitress: Invalid whitespace characters in headers (high 7.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2019-16786 and fix it if it is affected.

What it is: CVE-2019-16786 is a high-severity vulnerability in Debian Debian Linux, published on 20 Dec 2019. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2019-16786 in the wild and no public exploit code.

Affected packages and fixed versions:
- waitress (PyPI): affected all versions; fixed in 1.3.1
- waitress (PyPI): affected all versions; fixed in 1.4.0
- waitress (PyPI): affected all versions; fixed in 1.4.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2019-16786/ (Markdown: https://insights.sbomify.com/CVE-2019-16786/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2019-16786
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2019-16786
- OSV: https://osv.dev/vulnerability/CVE-2019-16786

---
From sbomify Insights: https://insights.sbomify.com/CVE-2019-16786/
Summaries are generated and may contain mistakes; the official description above is the record.
