Skip to content

Numerous design flaws #5

@tarcieri

Description

@tarcieri

Designing a transport encryption protocol is among the most difficult undertakings in cryptography. It's something that I would leave in the hands of a professional cryptographer who is already well-versed in the attacks on TLS.

Your project more or less duplicates the functionality of spiped:

https://www.tarsnap.com/spiped.html

However, you have made a number of mistakes in your design:

  • There is no reason to use RC4 in new protocols. RC4 has known biases which can be used for plaintext recovery. ChaCha20 is faster than RC4 and substantially more secure
  • There is no reason to use AES-CFB in new protocols. Use AES-GCM.
  • No cryptographic MAC is applied to the ciphertext, leaving you vulnerable to ciphertext malleability attacks. Your protocol is, in fact, less secure than SSLv3. Again, use AES-GCM, or ChaCha20+Poly1305
  • MD5 is used as a KDF. That's gross. Use HKDF with a hash function considered secure today, like SHA-256 or SHA-512, or a keyed hash like Blake2
  • AES-256 is used with a key derived from 128-bits entropy. That's pointless. If you have 128-bits entropy for your keying material, use AES-128
  • The same key is used in both directions, increasing the chances of IV reuse. Ideally you use a separate key for each direction
  • I can't even figure out the IV strategy here. I hope some high level API is picking your IVs randomly
  • No defense against replay attacks

...and that's what I found after looking at it for about 20 minutes.

You should probably be using spiped or TLS in PSK mode

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions