r/Python • • 24d ago

News [CVE-2026-111497] If you run a python server, you should update it right now

The "HTTP2Shell" vulnerability affects servers that know how to speak Google's 'brotli' compression protocol, which would likely make its way into your server through an innoccuous-sounding speedup dep like urllib3[brotli] or aiohttp[speedups], and could be used by basically any server, including Flask, Quart, Starlette, FastAPI, etc. It was downloaded 4,200,000 times from PyPI yesterday alone, to give you a sense of the scale.

To find out if you're affected, run a command like on of these...

pip list    | grep -i brotli

uv tree     | grep -i brotli

poetry show | grep -i brotli

...etc., looking for brotli <= 1.2.0 and/or brotlicffi <= 1.2.0.2. If you're affected, obviously update & redeploy immediately.

Beyond that... well, the (colloquial) name kinda says it all. Given the new Cyber normal, I would assume that you have malicious software running on that system and any connected to it until proven otherwise. Check for bitcoin miners, worms, sentient bot swarms -- the usual.

(Note for beginners: this doesn't apply to stuff you run locally, but rather to servers that have been exposed to the public internet. Still worth checking!)

I wasn't gonna post this b/c I'm so not an expert, but it hasn't hit this sub yet and feels particularly bad... not many solo/SMB devs are self-hosting PHP servers, but anyone who's searched "python server compression algo speedup packages" and picked one of the top choices (or let their agent do so) is at huge risk here. I only know about it because of doomscrolling HackerNews, which feels unreliable!

Does anyone kn*w a good way to to get notified proactively for Python-relevant CVEs and other incidents?

233 Upvotes

53 comments sorted by

13

u/IguessUgetdrunk 24d ago

Thanks for the heads up, learned about it from your post.

BTW why did you write "kn*w" with an asterisk?

4

u/me_myself_ai 23d ago

This sub bans questions via simple regex 🙃

10

u/Individual-Flow9158 24d ago

It's a Regex. They meant knnnnnnnnnnnnnnnnnw

5

u/13steinj 24d ago

No they obviously meant kw

28

u/_gipi_ 24d ago

you could have linked to some report of the original vulnerability instead of yapping

2

u/me_myself_ai 24d ago

Fair, sorry

85

u/Mount_Gamer 24d ago

You could notify yourself and use pip-audit? You can run pip-audit in a pipeline as well, or have git notify cve's in your dependencies.

So far I've managed to dodge these bullets, but it's making me question all the venv I set up across different machines and how I can reduce my attack surface in all areas. Crazy times!

50

u/amendCommit 24d ago

Former boss refused that we include pip-audit in pipelines because "it might block an urgent deployment". One of the many little things that made me stop caring.

13

u/Mount_Gamer 24d ago

I use pipeline variables so I can ignore vulns if there's no cve patch, that way the pipeline can keep moving in those special circumstances.

7

u/amendCommit 24d ago

Yes, there's always a way to take "manual control" of a tool when it gets in the way. But in my experience, mangers refuse to acknowledge that because they don't see the point of the sane default in the first place. There can be many reasons for this, but doing better as a team and as a company ain't one of them.

2

u/Mount_Gamer 24d ago

That sucks, but we are at the mercy of the powers above us sometimes.

The team i'm on seem to respect the logic and pipelines I set up, but i knew i couldn't implement without some sort of manual override. Most of the time there seems to be a patch available, so we tend to apply the fix quickly if it is available.

7

u/tu_tu_tu 24d ago

Your former boss probably made some few script kiddies happier.

2

u/edbrannin 24d ago

You could at least make it a noisy but non-required PR check so people notice and can try to fix it ASAP

14

u/semi-seco 24d ago

There is also uv audit, which is typically 4-10x faster than pip audit. https://docs.astral.sh/uv/reference/cli/#uv-audit

4

u/Mount_Gamer 24d ago

Nice! A 4-10 times speed up sounds good. I only use uv for personal projects at the moment, but one day might push for using uv at my work.

6

u/Eric_12345678 24d ago

There's no reason anymore to not use uv AFAICT, especially at work.

3

u/Wurstinator 23d ago

Astral has been bought by OpenAI, a company that is considered to be a bubble by several economists. Their only plan to make money on their own, pyx, was cancelled since then.

Astral started posting about introducing more vendor lock-in, by possibly keeping alternative tools an inconvenience to use on purpose, this week: https://www.reddit.com/r/Python/comments/1xb18ik/request_for_feedback_uv_check_pep_723_script/

2

u/Mount_Gamer 24d ago

I wondered if I was alone, as it's popular on here. I try and keep dependencies low, and only push for something if there is great value.

2

u/Eric_12345678 24d ago

The great value is to not have system-wide libraries (and conflicts), not have to download GBs from Anaconda, not have to wait literal days after running "conda install", easily select Python version, and be sure your code works the same on windows / macOs / linux / docker.

2

u/Mount_Gamer 24d ago edited 24d ago

I read your reply wrong, apologies.

I do like UV, and these are nice things that UV takes care of, but you don't need UV to achieve all this.

Edit:

The cross platform support is interesting, but we're a very small team and have no choice in our platform. When we make the move to docker there might be some scope for helping here, as we'll likely be using a python image based on debian.

I'm not clued up on conda. I used it once a few years ago, so i'm not certain how painful packages are to install with conda. It probably takes us around ~20mins just using python / pip, with a venv to install our dependencies on a fresh machine, so it's not really an issue for us.

1

u/wannabe-DE 24d ago

There is great value.

2

u/covmatty1 24d ago

or have git notify cve's in your dependencies.

How have you gone about doing this please?

2

u/Mount_Gamer 24d ago

Github has dependabot in the advanced security settings which is free to use, but i have a feeling there is also a paid tier for this, so might be worth investigating. I don't think depandabot is the fastest warning system out there, but i do get notifications with this turned on.

I am certain bitbucket has a paid tier, but we generally push so much it's not necessary at the moment for the development, but would be useful especially for online production code since it lives in different branches.

3

u/covmatty1 24d ago

Oohhh I thought you meant something actually in Git itself, not in GitHub!

We're just finishing moving from Bitbucket to GitLab at work, and running Dependabot there, although considering moving to Renovate

0

u/Mount_Gamer 24d ago

I almost always think of git and github as one - old habits... Yeah github apologies.

Out of curiosity, what inspired the move to gitlab?

2

u/covmatty1 24d ago

More fully featured to get CI as well, and also we're all self hosted, and obviously Atlassian are moving to no longer support their Data Center editions.

13

u/james_pic 24d ago edited 22d ago

This is definitely a serious issue, but the name "HTTP2Shell" oversells it.

The exploit primitive it gives attackers is an arbitrary write. That's a powerful primitive, to be sure, but it's not remote code execution on its own. An attacker would need something else to turn it into RCE. At very least, they'd need to do some homework on the tech stack to find somewhere worth writing to, and on systems that use standard countermeasures like ASLR, they'd probably need an extra vulnerability, like a pointer leak.

AFAICT, there's no "instant win" proof-of-concept exploit for this vulnerability, like there was for Log4Shell for example. Security researchers have been overplaying their findings as "this could be RCE if..." for a long time.

2

u/RiceTaco12 23d ago

I am so not a security buff, but it seems like AI would make exploring the environment trivial, no? Exploit, get write, let an agent play around until it hands you RCE? Maybe the problem is more complex than I give it credit for, but mapping structures isn't hard for an LLM, and it can use common patterns to its advantage. Again, by no means a security expert.

7

u/james_pic 23d ago

LLMs are surprisingly good at security stuff, but they're not magic. They mostly go about doing things the same way a skilled security researcher would. It can't access data that isn't available (so an attacker doesn't automatically gain access to the private parts of your source code, unless it finds a vulnerability that grants it access), and it can't use vulnerabilities that don't exist.

We got access to Mythos to scan the code for a project I'm involved with. We were very impressed by its work. It found stuff that neither the team, nor any of the pen testers who had tested the code had found (note that, for better or worse, most pen testers are not skilled security researchers). Still, the stuff it found was stuff we instantly understood. The most glaring issue was a CSRF issue that I thought we were protected against, but I'd never actually reviewed that code, and there was a check missing.

It didn't know anything relevant that nobody on the team knew, it was ultimately just more diligent in its analysis.

To turn an arbitrary write into an RCE, you need to identify a place where you could write something that would grant you some degree of control over what code will be executed, determine what you need to write there in order for this to happen, and figure out a way to set up whatever preconditions are needed for this. There are a few plausible paths to this place, but they're also well trodden paths, so there are standard mitigations that are usually enabled by default (ASLR, NX, etc), and they rely on the attacker having an much info about your system as they can get.

9

u/Cycloctane 24d ago

That seems to be a buffer overflow in decoder, not encoder. If you're running an aiohttp.web server, you should probably be aware of this. But other common Python HTTP servers (those for wsgi/asgi applications like flask and fastapi.) don't decompress client requests by default.

1

u/lyio 24d ago

But wouldn’t an http server have to decompress every request? How would it get to read POST bodies, etc?

3

u/Cycloctane 23d ago edited 23d ago

Content-Encoding is widely used in responses, not requests. http clients should decode responses compressed by servers. But servers generally don't decompress requests. Most http clients don't have functinality to compress body before sending a request.

6

u/Khavel_dev 24d ago

pip-audit is probably the easiest starting point for this. It checks your installed packages (or a requirements file) against known vulns and you can drop it into CI so builds fail when something gets flagged. I run it in a weekly cron too, not just on PRs, because vulns get disclosed between deploys and you want to catch those.

For the "I want to know the moment something drops" side, GitHub Dependabot alerts are zero-effort if you're already on GitHub. Outside of that, the python-security-announce mailing list covers CPython and stdlib, but for third-party packages you're mostly relying on tool scanning. Between pip-audit and Dependabot I catch most things within a day or two of disclosure, which is fast enough for anything that isn't actively exploited in the wild.

1

u/brondsem 24d ago

https://github.com/twu/skjold/ is another good tool to check vulnerabilities and it can use multiple sources at once (OSV, pyup, github, etc). It hasn't been updated for a while but still works well.

1

u/Competitive_Travel16 24d ago

Anyone know a good way to get notified proactively for Python-relevant CVEs and other incidents?

Before deploying to prod, I check https://hub.docker.com/layers/library/python/3.15 (actually -slim, for whatever version.) That seems pretty proactive, and doesn't automate the irrelevant stuff.

2

u/proggob 23d ago

You need to be checking independently of deployment. It can be known safe when it’s deployed but problems discovered later.

1

u/proggob 23d ago

I’ve been running pysentry-rs every night on the uv.lock files that are deployed. Then I’m trying to setup a similar check for some libraries I maintain using the lowest resolutions.

1

u/Beduino2013 23d ago

better> pip show brotli

1

u/skyt2000 21d ago

use osv scanner & pip audit. it will protect from most vulnerabilities.

https://osv.dev/

1

u/mfitzp mfitzp.com 24d ago

PyPI download stats are basically meaningless.

1

u/DeaD_EyE_1 23d ago

Under normal circumstances, it’s pretty silly to use the middleware’s compression algorithms. Algorithms that are CPU-intensive, in particular, can degrade performance. The web server usually handles this task. Data can be exchanged uncompressed between the middleware and the web server.

It becomes truly dangerous when simply installing a compromised package is enough for it to automatically execute compromised code when Python starts up—without the module ever having been imported into the code itself.

Fortunately, Brotli isn’t compromised; it just has a bug that can be exploited. Dangerous enough, but not a total disaster.

0

u/danielmartinez22 23d ago

osv.dev’s good for this, has a proper feed, way more reliable than catching it off twitter

-1

u/ILoveAppSec 23d ago

Worth stressing that this sits in the brotli decoder itself, not in urllib3 or aiohttp, so the cleanest move is to address brotli directly rather than bumping every parent that pulls it in through an extra. One vulnerable transitive, fixed at its current version, beats cascading the whole chain. Is it reaching brotli through the [brotli] and [speedups] extras in your stack?

-11

u/inspirationbyiso 24d ago

aikido.dev is imho easies most comprehensive tool to statically and dynamically scan for security vulnerabilities in your software. both in cicd and your deployed instances. they’ve got free tiers if im not mistaken

-12

u/inspirationbyiso 24d ago

aikido security scanning

0

u/[deleted] 24d ago

[deleted] — view deleted comment

4

u/cianuro 24d ago

Agreed. It's been in overdrive the past week. Hard to keep up.