Top
Best
New

Posted by theanonymousone 1 day ago

Node2Shell evolves to HTTP2Shell, blast radius affects many HTTP libs and apps(www.aikido.dev)
313 points | 152 commentspage 3
1vuio0pswjnm7 15 hours ago|
"In 2016, the Brotli algorithm shipped in Chrome, delivering overall better compression ratios for eligible resources."

"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-...

graemep 14 hours ago||
I agree with you, but the immediate problem here seems to be that all major browsers support Brotli, and i think they all use the Google library, so they are all vulnerable.

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.

1vuio0pswjnm7 13 hours ago||
"OpenAI found this in February reported it as unauthenticated remote code execution that works in both directions, so a malicious client can take over an unpatched server and a malicious server can take over an unpatched client that accepts compressed responses."

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

davedx 22 hours ago||
Honestly it's time to get rid of C as a language used where security is a factor. Enough already. Why the hell is a lib like brotli that processes public general internet traffic, and maintained by google, not in rust?
thephyber 19 hours ago||
Security is a factor everywhere. And C is everywhere. There's not going to be a "rewrite everything in Rust" project until after there is some legit penalty for selling / offering software in C that could be more secure in another language.

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.

_flux 17 hours ago|||
I can understand why people used a C library for these apps, as when HTTP2 was specified, the C lib was the only game in down.

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.

doublerabbit 22 hours ago|||
Because these applications were created long before Rust existed.

There is a cost to conversion.

_flux 17 hours ago|||
Rust-Brotli (by Dropbox) is actually a drop-in replacement for the Brotli C lib: https://github.com/dropbox/rust-brotli#:~:text=rust-brotli%2...

Dropbox switched to it a decade ago, so it's probably quite product-ready.

Gigachad 22 hours ago||||
Brotil was actually created post rust, but before rust took off.
anthk 14 hours ago||||
Check Librsvg, or php-rust. Or tons of gtk4-rs software doing it just fine.
davedx 22 hours ago|||
It's not even an application it's a compression library
jgalt212 21 hours ago||
How may web servers only serve brotli?

How many clients only accept brotli?

michaelbuckbee 21 hours ago|
Well it's negotiated, right?

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.

cowlevel 19 hours ago|||
Just send a POST with Content-Encoding:br to any URL and hope it gets decided before the URL route is checked.
jgalt212 20 hours ago|||
> So say you run a SaaS that allows for something like letting people set their Avatar from an image URL which gets downloaded.

That's a clever example, but why would you do that? The avatar should be a static resource. As such, I'd only provide an upload file dialog.

thephyber 20 hours ago|||
Gravitar was super popular for a year or two.

Quit being overly pedantic about how contrived the example is and struggle with the underlying fact that the compression type is negotiated between the client and server. If the compression happens on the HTTP request (as some of the comments here suggest), then the server must use that compression method or it fails to read the body of the request.

jgalt212 11 hours ago||
> how contrived the example is

That's basically one of the core ingredients of security. Build a threat model.

ceejayoz 19 hours ago||||
Lots of apps will, for example, bring in your Google avatar (i.e. they fetch its URL for ingestion) as a default avatar if you use them for SSO. Slack included, IIRC.
CJefferson 16 hours ago|||
I can almost certainly make my browser submit its file upload POST with the compression of my choice and your server will accept it.
jgalt212 11 hours ago||
apache does not accept brotli by default. so while the first part is true, the second part is only true for some X% of websites.
TacticalCoder 21 hours ago||
I really don't understand how so many different things are affected by the same brotli bug/exploit.

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?

Rapzid 21 hours ago||
Yes. All these language runtimes compile against common libraries. Compression libs are one of the most common common libraries that platforms like node, ruby, dotnet, python, and etc need to compile.

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.

thephyber 20 hours ago||
Brotli was a library released by the Google team that developed it. There weren't lots of independent implementations; they were all from the same source code.
rfgplk 19 hours ago||
Or you can roll your own and not rely on the literal disaster that Google developed. Brotli is trivial to implement.
devdudejeremy 17 hours ago||
[flagged]
chelseahermes 20 hours ago||
[flagged]
Zestymarble45 23 hours ago||
[flagged]
rfgplk 19 hours ago||
As I've mentioned numerous times at this point, relying on third party code is a massive liability (supply chain attacks/sloppy code). My hand rolled brotli implementation is not only faster than libbrotli but also immune to this vulnerability (yes, I checked). Roll your own code people.
ethin 18 hours ago|
Would you also apply this to cryptography or, well, really any security library? Because I hope the answer will be no...
austin-cheney 19 hours ago|
Why are we still so reliant on HTTP? HTTP came out in 1990 (36 years ago) and the most common version of HTTP still in use, 1.1 (RFC2616), came out in 1999 (27 years ago)?

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.

singpolyma3 19 hours ago||
We don't need new versions of http or SMTP because they're already simple and great and they're dumb protocols so there's not much you could ever add

If you want something else you can take your pick based on need from dozens of other options

cowlevel 19 hours ago||
HTTP 1 is full of parser differential vulnerabilities, which 2 fixes. That is probably its biggest flaw.

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.

rfgplk 19 hours ago||
Most header parsing bugs that affect HTTP1.1 can also affect 2+3. Not in the same style but there are quite a few overlapping ones.
cowlevel 14 hours ago||
Only when 2/3 translates to 1, as in request smuggling attacks at a reverse proxy.
cowlevel 19 hours ago|||
"by default its a new socket for each message" is misinformation - keepalive is the default since HTTP 1.1 (1999).
austin-cheney 16 hours ago||
Keep alive is not default behavior, so my prior comment was still more correct.
tredre3 15 hours ago|||
All webservers (apache, nginx, litespeed, caddy) have keep-alive enabled by default. All browsers also support it. Whether it's actually used/negotiated on most connections, I don't know, and if you want to be pedantic you're right that it can't be default by definition since you need the header to use it. But I suspect it actually is used for most connections nowadays.

Multiplexing is the default in HTTP/2 and 3. So you're still wrong.

austin-cheney 13 hours ago||
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/...

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.

cowlevel 14 hours ago|||
Keepalive is literally the default. You have to send an additional header if you don't want to use keepalive.
rfgplk 19 hours ago||
Agreed. The issue with all these archaic standards is that they were rolled decades ago back when certain practices were either outright not being employed OR that hardware wasn't fast enough. Ironically, HTTP itself is a literal nightmare to parse (performance wise) on top of having like... ten? distinct vulnerability classes. The world desperately needs new standards.
cowlevel 19 hours ago||
Just open a TCP socket and send JSON messages. Or if you want a bit more efficiency, fixed-format binary messages, but remember to include a version number.
rfgplk 19 hours ago||
For custom server implementations, agreed. But the web still depends on HTTP and we sadly need the major infra providers to agree on a new standard otherwise HTTP isn't going anywhere
cowlevel 14 hours ago||
Web uses web protocols, notweb uses notweb protocols. When I write an XMPP bot it has to speak XMPP, not HTTP. I could write my video game server to use XMPP but why the heck would I do that? If I choose a badly fitting protocol, it's on me.
graemep 14 hours ago||
I think one problem there is that a lot of places block other ports. Was that not why websockets runs on http ports?
cowlevel 8 hours ago||
Websockets have to be careful not to enable a client-side SSRF by accessing anything you couldn't already access with an <img> tag. They can use any port except the ones that are generally prohibited for browser HTTP requests, such as 25 and 6667.