Score:2

Why is using ChaCha20 for disk encryption insecure?

be flag

https://en.wikipedia.org/wiki/Disk_encryption_theory

Why do we use XTS over CTR for disk encryption?

If we used ChaCha20 (without authentication) by simply encrypting each disk sector with the same random key and with the block number as the nonce (no additional data), how would this break the properties of the security model outlined in the Wikipedia link above, under "Problem definition"?

The ChaCha keystream bits will be different for each plaintext block within all sectors, either because the blocks from different sectors have different nonces (the block number), or because the keystream blocks within a sector, despite having the same nonce, will be generated with different (successive) counter values.

Moreover, each sector is cryptographically tied to its location, because the nonce is the block number, so copying an encrypted sector to an unused sector and requesting its decryption (see Wikipedia link, adversary 3) will not decrypt correctly.

What am I missing here?

samuel-lucas6 avatar
bs flag
Where did you hear it was insecure? This seems to have been answered in the links you provided. In sum, the main issue with stream ciphers is that they fail catastrophically if the nonce is repeated with the same key, and they're malleable, which is something XTS mode attempts to address. Chances are the former will happen, which is a problem if the attacker has access to the disk on different occasions.
Mihai avatar
be flag
@samuel-lucas6 The wikipedia article said stream ciphers are not an option because, I assume, this same issue, repeating nonces. What would it be likely for the nonce to be repeated if the attacker has access to the disk on different occasions (under the scheme provided in the question post)? Also, what do you mean by malleable?
samuel-lucas6 avatar
bs flag
Yes, if you re-encrypt with the same nonce to update data. Malleable means you can flip bits to modify the plaintext and such modifications won't be detected because there's no MAC.
Mihai avatar
be flag
oh... so the attacker can modify an updated encrypted sector/block with an old version hmmm does this happen with xts? Thanks for your answers btw.
samuel-lucas6 avatar
bs flag
Modifications to the ciphertext randomise the block of plaintext with XTS. This limits what the attacker can do, but this isn't the same as message authentication and can still be used to cause damage. I would recommend reading some of the other XTS questions on here, [this](https://sockpuppet.org/blog/2014/04/30/you-dont-want-xts/) blog post, and the entire Wikipedia page you linked.
Mihai avatar
be flag
Thanks for the info... I just realised that flippin a ciphertext bit will flip only the correspondign bit after decryption, and manipulating a ciphertext bit will randomize only that bit during decryption, as opposed to AES where a single bit change diffuses on the whole block... I guess this is enough of a reason to not use stream ciphers for disk encryption, too much fine-grain control...
enzian avatar
ck flag
A comment in the cryptsetup project suggest a short nonce may be a problem: https://gitlab.com/cryptsetup/cryptsetup/-/issues/668#note_684603769 . There is an open MR to add xchacha: https://gitlab.com/cryptsetup/cryptsetup/-/merge_requests/420
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.