-
Notifications
You must be signed in to change notification settings - Fork 261
Security: random nonces/IVs and GCM auth enforcement for v3.4/v3.5 sessions #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4d07864
294a965
cdc351c
d4a148c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| from __future__ import print_function # python 2.7 support | ||
| import base64 | ||
| import logging | ||
| import time | ||
| import os | ||
|
|
||
| for clib in ('pyca/cryptography', 'PyCryptodomex', 'PyCrypto', 'pyaes'): | ||
| Crypto = Crypto_modes = AES = CRYPTOLIB = None | ||
|
|
@@ -52,9 +52,15 @@ def get_encryption_iv( cls, iv ): | |
| raise NotImplementedError( 'Crypto library does not support GCM' ) | ||
| if iv is True: | ||
| if log.isEnabledFor( logging.DEBUG ): | ||
| # Debug mode: fixed IV for troubleshooting and packet analysis | ||
| iv = b'0123456789ab' | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the debug mode hardcoded iv was by design to help with troubleshooting. We should revert this (debug conditional). @jasonacox-sam can you do that?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done ✅ — Restored the debug-conditional IV in if iv is True:
if log.isEnabledFor( logging.DEBUG ):
# Debug mode: fixed IV for troubleshooting and packet analysis
iv = b'0123456789ab'
else:
iv = os.urandom(12)Production traffic now uses — Sam ⚙️ |
||
| else: | ||
| iv = str(time.time() * 10)[:12].encode('utf8') | ||
| # GCM nonce: must be unique per (key, message). A time-derived | ||
| # or constant nonce reuses the value across messages under the | ||
| # same session key, which breaks GCM confidentiality and allows | ||
| # tag forgery. The IV is transmitted in the frame, so a random | ||
| # value is fully wire-compatible. | ||
| iv = os.urandom(12) | ||
| return iv | ||
|
|
||
| @classmethod | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.