Reuse of AES initialization vector in AESCipher / UsernamePasswordMako / Server
See original GitHub issueThe Server class randomly generates a fixed 16-byte initialization vector (IV) for the purpose of encrypting data. Then, via the UsernamePasswordMako class, that fixed IV makes its way to the AESCipher class, where it is consistently reused for encrypting data.
Initialization vector reuse like this is a security concern, since it leaks information about the encrypted data to attackers, regardless of the encryption mode used. For example, if the IV is reused with the same key in AES-CTR mode, the attacker will very likely be able to entirely decrypt the encrypted data: https://crypto.stackexchange.com/questions/2991/why-must-iv-key-pairs-not-be-reused-in-ctr-mode
Instead of relying on a fixed, randomly-generated IV, it would be better to randomly-generate a new IV for every encryption operation. Here are a couple of links that have more information on why that is the preferred approach:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:20 (10 by maintainers)

Top Related StackOverflow Question
@jkakavas 👋 Hello! I’m on the GitHub team responsible for sending security alerts for vulnerable versions of Python libraries. It appears that the issue described here (assigned CVE-2017-1000246) affects all versions as of its writing (
<= 4.4.0). Since its writing, version 4.5.0 was released. Can you share whether version 4.5.0 fixes this issue?As it stands now, we plan to alert
pysaml2users today on vulnerable versions<= 4.5.0(all currently released versions), providing no remediation steps as no fixed version has yet been identified. Can you please confirm that this information is accurate? Thank you! 💛The library we use to implement
AESCipheriscryptography. I’ve looked intoAES, the different modes and how they are supported. The recommended practice bycryptographyis to useFernet(spec).The interface is also very simple 👍
Fernetprovidesgenerate_key,encryptanddecrypt. Behind the scenes:I think
Fernetfills our use case and it is recommended practice. It does not useGCMorGCM-SIV(both of which are supported bycryptography, but introduce the authentication tag that needs to be kept available.)I think I will go ahead and wrap
Fernetto replaceAESCipher.I think this is reasonable 👍 Thanks!
That’s great, thanks for pointing us there - I did not know about the dependency graph.
Cheers :octocat: