← Lab /Security & privacy

Default IV in aes-js and pyaes causes widespread key/IV reuse bugs

Aes-js and pyaes provide a fixed default IV, leading to key/IV reuse vulnerabilities that affect thousands of downstream projects.

Security & privacy Trail of Bits 18 Feb 2026 Disclosure Real-world evidence

Published as “Carelessness versus craftsmanship in cryptography”

Why it matters

The default IV leads to key/IV reuse, allowing attackers to recover secrets and impersonate VPN users.

Summary

Trail of Bits examined the popular JavaScript and Python AES libraries aes-js and pyaes and discovered that both supply a fixed default IV (0x000...01) when none is provided, causing key/IV reuse in CTR mode. This design flaw is present in hundreds of thousands of repositories that depend on these libraries. The researchers demonstrated a real-world impact by finding strongMan VPN Manager encrypting private keys with the default IV, enabling credential extraction and impersonation. They worked with the strongMan maintainer to replace pyaes, adopt AES-GCM-SIV, add per-entry keys, and provide migration scripts, fully fixing the issue.

What they found 2

  1. aes-js and pyaes supply a fixed default IV when none is specified

    “when instantiating AES in CTR mode, aes-js and pyaes do not require an IV. Instead, if no IV is specified, libraries will supply a default IV of 0x00000000_00000000_00000000_00000001”

  2. strongMan encrypts PKCS#8 keys with pyaes CTR mode using the default IV

    “strongMan stored PKCS#8-encoded keys in a SQLite database, encrypted with AES. As you’ve probably guessed, it used pyaes to encrypt them in CTR mode, relying on the default IV.”

Caveats 3

  • We also picked out a large number of programs where the security impact of key/IV reuse was minimal or overshadowed by larger security concerns.
  • aes-js hasn’t been updated since 2018. pyaes hasn’t been touched since 2017.
  • In November 2025, we reached out to the maintainer via email and via X, but we received no response.

What’s new here 4

  • Identification of a default IV of 0x00000000_00000000_00000000_00000001 in aes-js and pyaes.
  • Quantification of library adoption: ~850 npm dependents, ~700,000 GitHub repos for aes-js and ~23,000 for pyaes.
  • Demonstration of a concrete exploit in strongMan VPN Manager using the default IV to recover private keys.
  • Collaboration with strongMan maintainer to replace the library, switch to AES-GCM-SIV, and add migration tooling.