3 ms·
So the setup is... All iMessage has to start with is some unspecified sender who has your public key and wants to send you a message. Sender will RSA-OAEP a ran
by zaroth 11y ago
So the setup is... All iMessage has to start with is some unspecified sender who has your public key and wants to send you a message. Sender will RSA-OAEP a random key to the receiver's public key, but then for some reason they are doing encrypt-then-sign, which doesn't really accomplish much because an attacker can just substitute their own signature.
The receiver can't know where the ciphertext they are being sent actually originated.... Just strip the signature from the original sender, add back your own, keep the RSA-OAEP blob which is holding the encryption key as-is, and then start tampering with the AES-CTR ciphertext. Having found an oracle (a way to know if decryption succeeded or not) in the attachment download code, it was just a matter of the hard work of making the bits dance just right to use the oracle to deduce the key.
In this attack the RSA-OAEP encrypted nonce is left alone. The fix they propose at the end is to cache this part of the message for a while to not allow replay. But I don't understand... why not instead derive authentication and encryption keys from the random 'k' and use it to append a MAC to the AES-CTR ciphertext, like an IES?
Given RSA-OAEP is "IND-CCA2", it is not vulnerable to chosen cipertext. That means it's "safe" to touch the RSA and decrypt before authenticating anything. At that point you then have enough to generate an authentication key to run an HMAC on the "hot" AES-CTR ciphertext before proceeding any further. I guess the obvious appeal of just caching the RSA'd 'k' to prevent replay instead of something like this is that neither the crypto nor even the message format have to change.
Alternatively, what you see in X25519, is the sender generates an ephemeral keypair and does ECDH with their private key and the receiver's public key to get a shared secret. Sender can then use the shared secret to do any standard authenticated symmetric encryption they want. Receiver will need the sender's ephemeral public key on their end to ECDH the same shared secret. In this case, again, as long as the asymmetric crypto is IND-CCA2 the receiver can safely figure out the shared secret and an authentication key before they have to touch any hot sauce.
Actually pulling of a working exploit with 2^18 messages while having to mangle ciphertext and keep gzip happy is really impressive! But at the same time, encrypt-then-sign with no MAC obviously will fail given an oracle, and oracles will always exist. So.... why did Apple do it this way, and why not just fix the underlying crypto and instead hack around with anti-replay?