3 ms·
Edit: What I said earlier is actually wrong. The problem is that a too big uninitialized buffer could be allocated and thus memory from previous allocations cou
by legulere 12y ago
Edit: What I said earlier is actually wrong. The problem is that a too big uninitialized buffer could be allocated and thus memory from previous allocations could be read. This isn't possible in Rust because you can't read uninitialized data.
Of course reusing buffers can be dangerous and lead to information leakage, but it's not what happened with heartbleed, and the possibilities to exploit are smaller.
Old text: Actually heartbleed is a buffer over-read vulnerability that would have been prevented by rust's out of bounds checking. Of course you could allocate one huge buffer that contains sensitive data and is also used as an output buffer but this seems terribly unlikely to me.
- akerl_ 12y agoHeartbleed occurred because the size of the buffer was based on the size provided by the malicious packet, the buffer was not zeroed, and then the user-provided data was written to the buffer. If user-provided-data size was less than what you said it was, the rest of the buffer contained whatever it had previously contained.
- MichaelGG 12y agoAnd since people were able to recover SSL keys, does this not mean that this buffer was used for... everything? Having a non zeroing allocator for an entire library seems rather ambitious. It's significantly worse then just having a buffer pool for, say, incoming packets or something.
- akerl_ 12y agoOh yes, using buffers without zeroing them is a terrible idea, and sharing those buffers among different types of things is a terrible idea. I was specifically commenting on the fact that what the parent comment described as "terribly unlikely" is in fact what happened.
- legulere 12y agoThere was no buffer reuse like in the linked rust demonstration, but it was data from previous allocations.
- MichaelGG 12y agoThe article claims this is not true and the author has a good reputation. I've not looked at the OpenSSL code, but if the author has written an isomorphic example, then there no over read. Is the article incorrect?