Executive brief
Net::BitTorrent, a Perl library for BitTorrent communications, uses a weak and predictable method for generating encryption keys. This allows an unauthorized observer on the network to intercept and decrypt supposedly private data transfers. Because the encryption keys are generated using a non-secure random number generator, the protection intended to prevent internet service providers or other third parties from monitoring traffic is effectively bypassed.
Technical details
Net::BitTorrent (up to v2.0.1) utilizes Perl's built-in rand() function, a non-cryptographic drand48-class generator, to derive 160-bit Diffie-Hellman private keys for Message Stream Encryption (MSE). Because the handshake also transmits cleartext random padding generated from the same PRNG sequence immediately after the private key is drawn, a passive network observer can recover the PRNG state from the padding. This allows the attacker to reconstruct the private key, compute the shared secret using the peer's public key, and derive the RC4 keys to decrypt the entire session. The vulnerability is located in KeyExchange.pm and MSE.pm. As of the advisory, no patch is available, and users are advised to replace rand() with a cryptographic source like Crypt::URandom.
Affected products
- SANKO Net::BitTorrent through 2.0.1
Timeline
- 2026-06-28: advisory: GitHub Security Advisory published by maintainer
- 2026-06-30: disclosed: CVE published to NVD