| > Integer overflows themselves are not significant, they have to be paired with other mechanisms to be actually vulnerable No, that is not true. That's a misconception. Your sentence is true for unsigned integer overflows, but not for signed integer overflows, which are undefined behavior in C. Compilers assume that signed overflows are not possible. They exploit that assumption to perform many significant and important code optimizations, which greatly improve performance. Those optimizations can cause the program behavior to change dramatically in the case that a signed overflow would happen. In some cases, the compiled code behaves in ways that have nothing to do with how the program was written. In extreme (but real, documented) cases it can have effects like: 1. Security vulnerabilities being introduced in the compiled code, even though the source code appears to be perfectly safe. 2. Code that isn't called anywhere to be called. 3. The program crashing even though the code looks completely safe, and in fact would have been perfectly safe if the optimizations hadn't been performed. 4. And many more. These are not theoretical or hypothetical effects. They are real effects that have been demonstrated in real code compiled with widely used compilers (GCC and clang), in some cases in high-profile projects like the Linux kernel, glibc and OpenSSL. > and Rust also agrees, whether overflow checks are enabled or not does not affect the memory safety That's because in Rust, signed integer overflows are well-defined. In C, they are not well-defined. They are undefined behavior. > Unless reporters have figured out an ingenious way to exploit a single integer overflow, the OP's reaction is completely justified. I agree! It is completely justified. However, the OP's assertions that the code is perfectly safe because it looks like a harmless integer overflow and that anyone can take a look at the code and figure out that it's not a vulnerability, are not justified. It would be OK to say that the bug is unlikely to be a vulnerability. But not that it is not a vulnerability, at least, not without a much deeper look into why it is not (which would likely include looking at the disassembled code under multiple platforms, multiple compilers and multiple compiler versions). To be clear, I believe that the burden of proving whether the bug is (or is not) a vulnerability is not on the OP. I would say it would be on those who have assigned a high severity to the CVE. But that still doesn't make the assertions written by the OP correct. |
That said, I should have said "to be actually exploitable" instead of "to be actually vulnerable", because vulnerabilities do not always turn into threats or risks. My bad. If you actually wanted to point this out, thank you.
> In some cases, the compiled code behaves in ways that have nothing to do with how the program was written.
Of course. Moreover completely safe code without any UB can exacerbate existing security bugs (e.g. ROP). So should we say that such code is also vulnerable or exploitable? It would be quite a stretch IMHO. Exploits need one or more vulnerabilities to be feasiable, but they can also leverage any other code at their disposal. And some vulnerabilities are weak by their own that other vulnerabilities are needed. I meant to say that signed integer overflows themselves are such ones.
There is also a weak consensus of this separation in the form of ISO C11 Annex L (Analyzability). Analyzability itself is apparently too strong and too weak at the same time [1] and not commonly implemented AFAIK, but it does define a normative list of "critical" UBs which do not include signed integer overflows.
> But that still doesn't make the assertions written by the OP correct.
I expect Daniel Stenberg to actually write something akin to my comments when he dispute the CVE.
[1] E.g. https://marc.info/?l=llvm-dev&m=143589591927876&w=4