# CVE-2016-9964: bottle.py vulnerable to CRLF Injection

> Attackers can inject CRLF sequences into HTTP headers via the redirect function, potentially enabling header injection attacks.

- **Severity:** Medium 6.5 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 16 Dec 2016
- **Updated:** 6 Aug 2024
- **Also known as:** DEBIAN-CVE-2016-9964, DLA-761-1, DSA-3743-1, GHSA-j6f7-hghw-g437, MGASA-2017-0031, PYSEC-2016-24, UBUNTU-CVE-2016-9964, openSUSE-SU-2024:11220-1

## What is CVE-2016-9964?

CVE-2016-9964 is a medium-severity vulnerability in Debian Debian Linux, published on 16 Dec 2016. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

redirect() in bottle.py in bottle 0.12.10 doesn't filter a "\r\n" sequence, which leads to a CRLF attack, as demonstrated by a redirect("233\r\nSet-Cookie: name=salt") call.

Weakness: CWE-93 (Improper Neutralization of CRLF Sequences)

## Which versions are affected by CVE-2016-9964?

3 open source packages ship an affected version, including bottle. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `bottle` | PyPI | From 0.10.1 | 0.12.11 |
| `bottle` | PyPI | From 0.10.1 | 0.12.11 |
| `bottle` | PyPI | From 0.10.1 | 0.12.11 |

Products: Bottlepy Bottle, Debian Debian Linux.

## How do I fix CVE-2016-9964?

Upgrade bottle to 0.12.11 or later.

## Is CVE-2016-9964 being exploited?

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

## Other vulnerabilities in Debian Debian Linux

- [CVE-2022-31799](https://insights.sbomify.com/CVE-2022-31799/): Denial of service in bottle (critical 9.8)
- [CVE-2020-28473](https://insights.sbomify.com/CVE-2020-28473/): Web Cache Poisoning (medium 6.8)
- [CVE-2014-3137](https://insights.sbomify.com/CVE-2014-3137/): Bottle does not properly limit content-types (medium 6.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2016-9964 and fix it if it is affected.

What it is: CVE-2016-9964 is a medium-severity vulnerability in Debian Debian Linux, published on 16 Dec 2016. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2016-9964 in the wild and no public exploit code.

Affected packages and fixed versions:
- bottle (PyPI): affected from 0.10.1; fixed in 0.12.11
- bottle (PyPI): affected from 0.10.1; fixed in 0.12.11
- bottle (PyPI): affected from 0.10.1; fixed in 0.12.11

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-2016-9964/ (Markdown: https://insights.sbomify.com/CVE-2016-9964/index.md)
```

## Sources

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

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