Live data from Hacker News

Google assigns a CVE for libwebp and gives it a 10.0 score

stackdiary.com

161–170 of 235 posts

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#161
post #136
post #126

Earlier quoted context omitted.

For people downvoting, could you please explain which part of this statement you agree or disagree with?

[flagged]

I want to create software that doesn’t harm users. That doesn’t at all imply that I’m not interested in computers. In fact guaranteeing safety for users shows a profound interest in computers.

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#162
post #30

Earlier quoted context omitted.

Hubris and people thinking they can safely code in memory unsafe languages (they can't)

A memory-safe language could have easily resulted in the same vulnerability. In this context, “memory-safe” means it does bounds checking on an array when you try to access an element. But the webp code does bounds checks up-front so that array accesses can be non-checked, to help performance. (If they didn’t want this performance, they could have easily used a std::vector and used bounds-checked access.) The vulnera…

> If we were to hypothesize a counterfactual world where webp was written in rust

You don't have to hypothesize. It's here:

https://github.com/image-rs/image/blob/master/src/codecs/web...

and it doesn't use unsafe indexing.

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#163
post #136
post #126

Earlier quoted context omitted.

For people downvoting, could you please explain which part of this statement you agree or disagree with?

[flagged]

> C is syntactic sugar around assembly.

Even if this is true (and I don't believe it is), it's not useful.

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#164
post #18

Android is particularly troublesome here with the number of phones out there receiving no updates, and just a single download away from being exploited. For me, personally, it's a race to see if Google can get this patched for my Pixel 5 before security updates stop in October.

A phone released in October 2020 is about to stop getting security updates?!

It stops getting guaranteed security updates, whatever that means. If this is really so serious that it enables drive-by attacks on the web, it'd be negligent not to port the fix to older OSes.

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#165
post #153
post #72

Earlier quoted context omitted.

LLMs should indeed be very good at finding vulns. It is a safe bet state actors have already done this, and have added to their stockpile of zero-day exploits. I suspect you are right that collectively we are whistling past the graveyard and the current "solution" is to make widely available LLMs explicitly not provide that kind of capability.

My experience is they're not good at this for most vulnerability classes, especially the those that are tough to discover by classical methods. Have you had any experience using them for this? Trivial vulnerabilities are easily discoverable yes -- but, they are also trivially discoverable by standard automation available today. I've found GPT-4 to be shockingly bad at vulnerability analysis for all except the most po…

I am surprised that you can even say "it's not very good." The sorts of prompts I'm imagining I would expect to trigger the "I'm afraid I can't do that Dave" safeguards every time. I guess yeah, I'm just imagining using it as an advanced fuzzer but I think the thing about using an LLM is you can take the fuzzer code and ask the LLM to just generate slight variations, feed that into a test and ask the LLM to flag ones that look like they might have been an exploit. And when it generates nonsense code, you just throw out those runs. But on the other hand hallucination feels like an advantage here since it's going to do things you never would have thought to test.

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#166
post #131

Earlier quoted context omitted.

Over a library used by billions of people a lot of times a day, those bounds checks add up to a lot of wasted time and energy if you don't strictly need them. If this is a common function in the webp library, this function is probably called something like a trillion times a day.

I think your intuition on the cost of not-taken bounds check branches is off, especially in the context of devices that spend most of their resources browsing the web, running radios, powering screen backlights. I bet any holistic measurement could not tell the difference.

> … resources browsing the web, running radios

That's the whole point of webp, though.

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#167
post #30

Earlier quoted context omitted.

Hubris and people thinking they can safely code in memory unsafe languages (they can't)

A memory-safe language could have easily resulted in the same vulnerability. In this context, “memory-safe” means it does bounds checking on an array when you try to access an element. But the webp code does bounds checks up-front so that array accesses can be non-checked, to help performance. (If they didn’t want this performance, they could have easily used a std::vector and used bounds-checked access.) The vulnera…

[deleted]

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#168
post #108

Earlier quoted context omitted.

A memory-safe language could have easily resulted in the same vulnerability. In this context, “memory-safe” means it does bounds checking on an array when you try to access an element. But the webp code does bounds checks up-front so that array accesses can be non-checked, to help performance. (If they didn’t want this performance, they could have easily used a std::vector and used bounds-checked access.) The vulnera…

Unsafe rust is not a memory-safe language.

It isn't, but there's a big difference between writing straight C and writing some unsafe Rust with safe wrappers. It's generally possible to have comparably few lines of unsafe Rust that do the heavy lifting and can be verified to maintain memory safety without sacrificing performance.

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#169

Additional timeline info, as I was curious myself. WebP is old enough that a memory safe language was not a feasible option when the project started. Android 12 was the first version to support Rust code, and came out in 2021 [0, link talks about the first year of integration]. On the iOS side (which also was affected by this), Swift 1.0 came out in ~2014. As far as I can tell, Chrome doesn't yet support a memory saf…

Is Rust in practice a memory safe language when you're doing tricks like decoding huffman-decoding huffman tables into buffers? It seems like once you optimize for performance this much, you're liable to turn off bounds checking here or there.

The point of `unsafe` in Rust is that you can generally limit `unsafe` code to a few short functions and encapsulate them in a safe interface. This means less code to review and maintaining strong guarantees in the rest of the safe Rust code.

Re: Google assigns a CVE for libwebp and gives it a 10.0 score

#170

Earlier quoted context omitted.

While yes, that's theoretically possible, do you have data to establish this? For example, having small sections of the code be marked as unsafe would allow for greater scrutiny of those sections. Also, unsafe access is more annoying to perform in Rust than in C or C++, so maybe that would have acted as a deterrent (or at least the code would have been profiled to make sure that unsafe access was worth it). https://s…

Elsewhere in the comments someone linked to this: https://dropbox.tech/infrastructure/lossless-compression-wit... It looks like dropbox experimented with disabling bounds checks in their huffman coding impl, and found that using the unsafe pattern increased throughput from 224 MB/s to 249 MB/s (11%-ish faster.) We don’t even need to hypothesize about whether webp would have elminated bounds checking, we can see that…

Thank you.
Post reply on HN