2

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?

Mihai
  • 21
  • 3
  • 1
    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. – samuel-lucas6 Dec 28 '22 at 10:53
  • @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? – Mihai Dec 28 '22 at 12:13
  • 1
    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. – samuel-lucas6 Dec 28 '22 at 12:42
  • 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. – Mihai Dec 28 '22 at 12:57
  • 2
    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 blog post, and the entire Wikipedia page you linked. – samuel-lucas6 Dec 28 '22 at 13:59
  • 1
    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... – Mihai Dec 28 '22 at 15:41
  • 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 – enzian Jan 10 '23 at 10:46

0 Answers0