Guide · Ilia Dubovskii · 17 November 2026

Py2Shell (Python2Shell, CVE-2026-111497): the Brotli RCE in Python HTTP clients

Py2Shell (or Python2Shell) is the Python face of CVE-2026-111497, the out-of-bounds write in Google's Brotli decoder also known as Node2Shell and HTTP2Shell. In Python the decoder comes from the Brotli and brotlicffi packages, and the popular HTTP clients use them automatically to decode Content-Encoding: br responses. That means a project can be exposed without ever importing Brotli. Here's how to find it, what to upgrade, and what to do if you can't yet.

The short version

1. What Py2Shell is

CVE-2026-111497 is an out-of-bounds write in Google's Brotli decoder: a crafted stream asks for a block-type switch that should stop the decoder with an error, and the vulnerable version carries on writing past the end of its buffer. It was first written up for Node.js as Node2Shell. On 23 October 2026 Python was linked to the same bug, and the Python side picked up the names Python2Shell and Py2Shell.

Python is affected because the two Brotli packages on PyPI, Brotli and brotlicffi, wrap the same C decoder. CPython itself doesn't ship one.

2. Am I affected?

You're exposed when all three are true:

  1. Brotli below 1.2.1 or brotlicffi below 1.2.1.0 is installed in the environment that runs your code.
  2. Something decodes Brotli with it. requests, urllib3, httpx, aiohttp and Scrapy do so automatically for Content-Encoding: br responses whenever either package is importable. Your code never has to mention Brotli.
  3. The data comes from somewhere you don't control: a third-party API, a webhook target, a URL a user gave you, a site you scrape, or an uploaded file containing Brotli (WOFF2 fonts, Parquet).

The typical Python exposure is outbound, the reverse of the usual web bug. A scraper, link-preview service, RSS reader or AI agent that fetches arbitrary URLs is the clearest case. So is any integration with an API that could itself be compromised.

Packages that bundle their own Brotli decoder need their own fix regardless of the PyPI packages. Pillow, pyarrow, DuckDB and ClickHouse were reported as still unpatched in late October 2026; check their advisories.

3. How to find it in your dependencies

Brotli is rarely a direct dependency. It usually arrives through an extra such as urllib3[brotli], httpx[brotli] or aiohttp[speedups], or through a framework that asks for one. So grep brotli requirements.txt often finds nothing while the image still has it.

4. What to upgrade, and the workarounds

5. How Compass helps

Compass, our open-source (Apache 2.0) operations agent for AWS, works on both sides of a bug like this one.

Before: the dependency, the workload, the pull request

During: honeytokens

What it doesn't do: inspect the HTTP responses your code receives, or see an attacker who ignores the decoys. A restart removes a foothold; the upgraded package removes the bug. That pairing contained our PHP2Shell incident in under two minutes. More about Compass.

6. FAQ

What is Py2Shell or Python2Shell?

Py2Shell and Python2Shell are names for CVE-2026-111497 as it affects Python. The Brotli and brotlicffi packages ship Google's Brotli C decoder, which has an out-of-bounds write. Python HTTP clients use those packages to decode Brotli-compressed responses automatically, so a malicious server can send data that crashes the process or, in some builds, runs code.

Is Python2Shell a bug in CPython?

No. CPython's standard library doesn't include a Brotli decoder. The vulnerable code comes from the third-party Brotli and brotlicffi packages, so the fix is upgrading those packages, not Python itself.

Which versions fix CVE-2026-111497 in Python?

Brotli 1.2.1 and brotlicffi 1.2.1.0, released on 22 and 23 October 2026. Run pip install -U "Brotli>=1.2.1" "brotlicffi>=1.2.1.0", or raise the pins in your lockfile. Earlier urllib3 guidance and its brotli extra set minimum versions that are still vulnerable, so don't rely on the extra's floor.

Am I affected if my code never imports brotli?

Possibly. requests, urllib3, httpx, aiohttp and Scrapy check whether Brotli or brotlicffi is installed and, if so, advertise and decode Brotli responses on their own. Run pip show Brotli brotlicffi in the environment that actually runs your code, such as the container image, to find out.

Does removing br from Accept-Encoding protect me?

No. A malicious server can send a Brotli-encoded response whatever you asked for, and a client with automatic decoding will decode it. Disable automatic decoding for untrusted fetches, or remove or upgrade the Brotli packages.

Are Pillow, pyarrow or DuckDB affected?

Packages that bundle their own copy of the Brotli decoder need their own fix, independent of the Brotli package on PyPI. Reports listed Pillow, pyarrow, DuckDB and ClickHouse among those still unpatched in late October 2026. Check each project's advisory, especially if you process untrusted fonts, Parquet files or images.

Written by Ilia Dubovskii, founder of Beamreach. Package versions, advisory IDs and dates were checked against the PyPI advisories and Phoenix Security's write-up on 17 November 2026. Exploitation reports for CVE-2026-111497 disagree; see the Node2Shell page for the spread.

Related: Node2Shell / HTTP2Shell (CVE-2026-111497) · The *2Shell vulnerabilities, 2021 to 2026 · PHP2Shell · AWS canary credentials · One Fake Password Is Worth More Than 10,000 Alerts (talk)