Broccoli2Shell: Brotli decoder RCE in Node.js, Python and more
https://broccoli2shell.com/I think Chromium as a project would be happier if they had less unsafe code in general, and holding new dependencies (especially those like media formats, which have a long history of security issues) to that standard doesn’t seem particularly surprising.
There’s always going to be trade-offs: how much benefit does this provide (users, developers) compared with how much risk does it incur (safe/unsafe code, quantity of code you’re now on the line for the security of).
(And that’s taking that reason to not support JPEG XL at face value, ignoring any debate about it.)
2. JXL is waaay more complex than Brotli so the risk of vulnerable implementation is also higher.
They should have demanded more rigor from the Brotli library, same for countless other dependencies chromium has. But there's no irony.
https://github.com/libjxl/libjxl/pull/5062/commits/269661f71...
Storage and compression compute costs aren’t really relevant — only insofar as if there’s very little adoption, the security risk of exposing the code is there but isn’t providing user benefit.
> but it wasn't recognized as a security issue at the time and no release shipped with the fix until now
I'm always getting my dangerous RCE bugs mixed up with my harmless RCE bugs.
I'm curious how this was reported and fixed back in Feb but nobody recognized the importance. A case of AI automation and nobody at the wheel?
In any case all this sensationalism is starting to get annoying. Patch your stuff and move on.
Edit: actually, between all the sensationalism, its hard to tell from the article how many of these actually support brotli compressed request bodies in common configs vs some other use of brotli (which is bad but nowhere near as critical)
So as a hotfix I block this on my reverse proxy.
Maybe an LLM just happened to do one of those "while I'm here" fixes in Feb and because nobody reviews anything anymore..
"Fixed reading too many bytes."
LGTM!
Edit: I was close! "Detect and report invalid stream earlier." Could have been a person.
Please do consider sharing the actual evidence to keep in the history, and respect actual human authors involved, their effort, time, and humane attitude... for discoveries, competition, actual achievements to learn from and get inspiration...
You may well (and probably should) trust the maintainers and release process of Brotli, Node.js, PHP, etc. security releases more than you trust some-random-JS package deep in your front end dependency graph.
You want to reduce the risk of introducing a compromised dependency into your product, and that’s largely a question of how much you trust upstream.
As always, the easiest way to manage this is to have as few dependencies as possible. If you have a lockfile with thousands of entries, you won't be able to go through them and decide which upgrades are legitimate urgent security updates and which can wait. If you have 10? You'll manage.
Security fixes for actively exploited vulnerabilities demand an emergency response. The risk of introducing new, unknown flaws is less than risk of having an active known exploited vulnerability.
However, absent the risk of a KEV, that changes the equation. Now the risks of code changes causing breaking changes plus the risk of supply chain attacks is greater than the risk of having to put some thought and time in to manage your software library versions.
It's not like AI created this distinction, either. Neither did CI/CD. This is standard systems administration -- literally ISO/IEC 20000 ITSM. It's exactly why, traditionally, new features are often limited to major versions. It's why binary compatibility was a huge issue with RHES 20 years ago, and why distros pin versions and backport security and selective bug fixes. A developer that doesn't know this is telling on themselves why they shouldn't have write access to production. Stability matters a lot because we like to get paychecks.
Claudeslop aside, it really is a whole new world we’re in now, where the audience of a run-of-the-mill RCE CVE announcement really does need this stated.
Apache and nginx don't handle brotli out of the box.
Every time you add something you lose something...
> Security notice: Upgrade certifi, pip, and uv in response to CA certificate incident
Blimey PIP is affected? That's bad. I feel like that should have been bigger news?
- If a vulnerable dependency is in your environment as a transitive of something that's not at risk (e.g. code you don't use, code that doesn't talk to untrusted sites), code that shouldn't use it will pick up that transitive.
- Autodetection of optional stuff is often silent. E.g. libxml vs. pure-python XML parsing doesn't really act any different at load time or most of runtime, besides being faster, so it's non-obvious what's being used when.
- Probing for packages that aren't listed as a concrete dependency by importable name risks loading unintended code due to name conflicts (malicious, or accidental/caused by local files with the same name or weird PYTHONPATH).
- There are plenty of ways to get an ImportError after running a lot of Python code in a dependency before giving up! That code might mutate global state/change behavior, or do insecure things, etc. Malicious actors could take advantage of ImportError being raiseable by user code to conceal naughty behavior at import time.
I really want Python to come up with a saner way to concretely identify (avoiding name conflicts) and probe for optional dependencies at import time. try/except-ImportError ain't it.
also affects codex (gui), which ships its own git, could be more of a problem there, when the LLMs get quirky at night. still unlikely to be a problem though.
speaking of, update codex (and wipe its cache at ~/.cache/codex-runtimes), ships its own node. update python.
stuff like wireshark and imhex remain vulnerable, even on their latest repo commits, which may or may not be spicy.
also Microsoft 365 Copilot still has its own unpatched brotlidec.dll from Oct 7, if anyone uses that. no fix available for that one afaik, not sure about how it can be made to access the vulnerable decoder.
- git
- Sublime text
- VS studio
- CUDA
- .NET
- inkscape
- AzureTools
Browsers were patched back in March, but if you can get anything else that is unpatched to decode br, and most HTTP clients do by default, and you’ve figured out the right payload (yes not easy, but still), isn’t this, well, really bad? Like Heartbleed big?
I think Mozilla got it right when they abandoned the effort to rewrite the entire browser in Rust and instead focused on analysis of which modules needed priority rewrites. If a module has historically had zero memory-related bugs, then there are other higher priority things to spend time on.
That said, Google Project Zero should have had Brotli on their radar. Hopefully they still have people and resources.
Chromium _has_ been replacing certain components with ones in safe languages, and it seems like that will continue slowly (with integrating them into the existing codebase, with web compatibility risk of any changes in behaviour, with the risk of performance and power regressions).
However, why not switch to the Rust lib when it was available? I suppose people at Dropbox are now pretty happy they did in 2016: https://dropbox.tech/infrastructure/lossless-compression-wit...
It's slower, though. Too high a price to pay for safety it seems.
There is a cost to conversion.
Dropbox switched to it a decade ago, so it's probably quite product-ready.
"By the end of 2017, all modern browsers supported Brotli, and server support for it started to become more widespread."
For www users, all that data collection, surveillance and ad services traffic to enrich so-called "tech" companies acting as intermediaries, can make the www exceedingly slow
The way to "make the web faster" (or less inefficient) is to get rid of that needless traffic, and the ads it supports
SPDY,^1 HTTP/2 Server Push,^2 HTTP/3 QPACK,^3 brotli, .... make www users ("ad targets" to Google) uninformed, nonconsenting subjects in Google's failed experiments
The www already works just fine for its intended purpose (_not_ data collection, surveillance and ad services)
1. "As of 2021, no major browsers supported SPDY" https://en.wikipedia.org/wiki/SPDY
2. https://en.wikipedia.org/wiki/HTTP/2_Server_Push
3. https://foxio.io/blog/header-accordions-qpack-amplification-...
Most of the discussion here is about vulnerabilities in servers, but it looks like its mostly a client problem.
Is there a way to turn brotli off?
Going back to your point, if we kept things simple we would be a lot more secure.
Every user is different
For me I'm a text-only user not interested in graphics
I do not use a so-called "modern" browser to make HTTP requests
I don't request brotli-compressed content/resources^1
Normally I don't send an Accept-Encoding header
Almost always servers to which I connect^2 will return uncompressed text, which is what I want. No Accept-Encoding header needed
Occasionally servers will send gzip-compressed text by default and will ignore "Accept-Encoding: identity"
However the popular so-called "modern" browsers will send an Accept-Encoding header whose value includes brotli (br) by default
Unsuspecting www users are consequently opted in to Google's brotli experiment. Me, I opt out
1. I use a text-only browser (1.3MB static binary) to read HTML. I compile it without brotli support
2. Other users may connect to different servers. Preferences vary from user to user
Real carreer starter.
How many clients only accept brotli?
So say you run a SaaS that allows for something like letting people set their Avatar from an image URL which gets downloaded.
As an attacker I setup a new server that serves only brotli and then submit that URL to the SaaS.
It's so meaningless, broad and undescriptive of the actual issue. No it probably doesn't affect an HTTP server with nothing else behind it, so why is HTTP being blasted?
You might as well call it Exploit Pro Max...
AI isn't being asked to review the title, and it doesn't have experience or think, so of course it's not going to flag it.
No human reviews anything anymore so of course they aren't going to catch it.
Edit: AI for as good as it is at "writing" is terrible at writing and particularly at naming things. I had an AI name a client OpenAICompatibleEmbeddingClient. "Brooooo.. I think "compatible" is implied, who names stuff like that?!"
(Actually you eat cake and drink coffee on a funeral, but it's still called like that in some parts of Austria.)
Now, whether it's warranted or not, that's another matter, but they know how to appeal for maximum awareness/interaction.
SQL Slammer didn't actually slam anything, and applied to a single vendor among many SQL providers. Heartbleed didn't make anyone's heart bleed...I mean, at least directly. Shellshock only impacted a single shell environment, again among many. Log4Shell impacted a single logging implementation, among many. Spectre and Meltdown...I mean, who would think that related to CPU cache side channels?
These are just dumb names for people to share in referring to something. Seems silly and like a waste of time to spend effort getting upset about them.
I even read the patch for the C code (patch which, btw, seems a bit hacky to me with isSafe? methods added and whatnots but YMMV: now I understand things had to be patched in a hurry but this patch really looks like "lipstick on a buffer overflowing C pig" to me).
What's the link between Python / Node / C++ / libbrotli / Envoy / Bun: are those some all using the same C brotli encoder/decoder?
Can someone who knows more explain why all those are vulnerable?
> As for unaffected software, Apache’s standard mod_brotli does not decode Brotli
Because this one only encodes and doesn't decode and the bug is in the decoder? (for I take it mod_brotli, with such a name, still does something brotli related and isn't, say, a TOTP token generator nor a SAT solver?).
I mean overall, sheesh: could we get better explanation / better writeups when such big fuckups happen?
Google provides the Brotli implementation. Package maintainers slurp that up and create ie libbrotli-dev. When you compile node it uses that for brotli support.
I find it helpful at least...
Yes, I know HTTP 2 and 3 and SSE are attempts to make it faster and more parallel, but its still slow. Its slow because its unidirectional with a full round trip and by default its a new socket per each message. Yes, I know the real reason HTTP became and remains popular is because its sessionless... in theory. Still, there are better options available. You can do so much more with a full duplex channel.
If you want something else you can take your pick based on need from dozens of other options
SMTP is too chatty - it uses too many round trips for efficient transfer across the internet. It can take several seconds just to get to the point of sending the email data. It also duplicates information between the SMTP envelope and the email body which creates vulnerabilities when they don't match.
For APIs that don't have to work in a browser I suggest JSON lines over TCP, or over TLS.
Multiplexing is the default in HTTP/2 and 3. So you're still wrong.
https://stackoverflow.com/questions/36517829/what-does-multi...
So, for the sake of argument let’s say I am completely wrong, MDN is wrong, all of Stack Overflow is also wrong. Even still HTTP is slow. Slow as shit. Imagine trying to do a MS Teams call with 50+ participants with cameras on. It would be slow as shit for just a one-on-one call. A call with 50+ people would be ridiculously slower and would likely result in a crash from memory exhaustion.
I was also not talking about HTTP2 or 3. I was very clear about that. Reading is hard. HTTP is used in many different contexts outside the browser where 1.1 continues to dominate.
The primary reason developers want to keep HTTP around is familiarity and comfort. HTTP is great when you don’t compare to anything else or do any kind of performance tuning.