A Vulnerability in Implementations of SHA-3, Shake, EdDSA
eprint.iacr.org
A Vulnerability in Implementations of SHA-3, Shake, EdDSA
1–10 of 49 posts
Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#2Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#3I didn't read the whole paper, but how can this even happen? Seems like the buffer overflow would be triggered for any file larger than 4 GiB, which I assume someone has tested in the 8 years since it was released.
I skimmed the paper, and as far as I understood it:
Most cryptographic hash functions operate in fixed-size blocks (for instance, 32 bytes). Additionally, most cryptographic hash function implementations are designed to be streaming, that is, they do not receive the whole input at once. If you give them a partial input which is not a multiple of their block size, these implementations have to buffer the partial input, so that it can be combined with the next partial input (or flushed, if the next call is to finish the computation and generate the output). The arithmetic overflow which leads to the buffer overflow happens when computing how much it has to buffer, given a partial input and any previous partial input already in its internal buffer.
That is, having a file larger than 4GiB is not enough; it has to also be cut into pieces which are not a multiple of the block size (which is normally a power of two). Most users of a cryptographic hash function will either give it the input in large power-of-two pieces (for instance, 8 KiB or 64 KiB), or give it the input all at once, and thus will not hit the bug.
Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#4I didn't read the whole paper, but how can this even happen? Seems like the buffer overflow would be triggered for any file larger than 4 GiB, which I assume someone has tested in the 8 years since it was released.
Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#5The paper makes no mention of compiler warnings… but shouldn’t this cast trigger a compiler warning?
Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#6Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#7> partialBlock = (unsigned int)(dataByteLen - i); The paper makes no mention of compiler warnings… but shouldn’t this cast trigger a compiler warning?
Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#8This is over 4 months old, and is already patched in Python. Was discussed on HN at the time: https://news.ycombinator.com/item?id=33281106
Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#9> partialBlock = (unsigned int)(dataByteLen - i); The paper makes no mention of compiler warnings… but shouldn’t this cast trigger a compiler warning?
Basically, this is why you shouldn't use unsigned types unless you explicitly want them to overflow.
Re: A Vulnerability in Implementations of SHA-3, Shake, EdDSA
#10I just can’t get my head round the idea that software written and reviewed by experts and submitted to the “National Institute of Standards and Technology” with a budget of 1 billion dollars can fuck up this way.
I’m no mathematician but I would have thought implementing pure number crunching code is not rocket science.
Buffer overflow, overwrite memory, run arbitrary code, seriously? LOL, WTF.