Summary
Jervis, a library used for Job DSL plugin scripts and shared Jenkins pipeline libraries, previously derived AES initialization vectors (IVs) deterministically from a passphrase. This breaks fundamental cryptographic assumptions and can allow attackers who observe ciphertexts to infer patterns, mount cryptanalytic attacks, or potentially recover sensitive data.
The issue becomes risky in environments where Jervis is used to encrypt or protect secrets (such as credentials or tokens) in Jenkins-related automation, especially when the same passphrase is reused across multiple encryption operations.
Affected context
This vulnerability affects setups where:
- Jervis is used as a library in Job DSL plugin scripts or shared Jenkins pipeline libraries.
- AES encryption is performed using Jervis with passphrase-based encryption.
- The same passphrase is reused across multiple encryption operations.
- Attackers can observe or obtain ciphertexts produced by the vulnerable encryption routine.
The risk is higher in CI/CD environments where Jervis protects secrets that control build, deployment, or infrastructure access.
Exploit preconditions
- Attack surface: Indirect, via access to data encrypted by Jervis (e.g., configuration files, logs, artifacts, or SCM-stored encrypted blobs).
- Required access: Ability to read ciphertexts generated using the deterministic-IV scheme, and in some scenarios the ability to trigger repeated encryptions with the same passphrase.
- Trigger point: Any operation where Jervis uses AES with an IV deterministically derived from a passphrase instead of generating a fresh random IV for each encryption.
- Why exploitation is possible: Deterministic IVs remove the randomness required for secure block cipher modes, making ciphertexts for similar or identical plaintexts correlate in predictable ways and potentially enabling pattern leakage or more advanced cryptanalytic attacks against the protected data.
Why this happens
The root cause lies in incorrect cryptographic design and implementation, where the AES initialization vector is derived deterministically from a passphrase rather than generated randomly for each encryption operation.
This maps primarily to:
- CWE-327: Use of a Broken or Risky Cryptographic Algorithm – the encryption scheme misuses AES by failing to supply a non-repeating, unpredictable IV, undermining the security guarantees of standard block cipher modes.
- CWE-340: Generation of Predictable Values – the IV, which must be unpredictable and non-repeating, is instead derived in a predictable, deterministic way.
As a result, encrypting multiple messages with the same passphrase can reveal structural information about the plaintexts and, in some contexts, help an attacker recover sensitive data.
Potential impact
- Leakage of patterns between different encrypted secrets, even when their plaintext values differ.
- Increased susceptibility to cryptanalysis targeting the encryption scheme, potentially leading to partial or full recovery of plaintext data.
- Compromise of credentials, tokens, or other secrets stored or transmitted in encrypted form via Jervis.
- Facilitation of privilege escalation in CI/CD pipelines if decrypted secrets grant access to build, deployment, or infrastructure systems.
- Long-term exposure of historical secrets if old ciphertexts remain accessible and were produced using the deterministic IV scheme.
General mitigation guidance
Effective mitigation focuses on adopting robust cryptographic practices and minimizing the impact of predictable values in encryption schemes:
- Use standard, well-reviewed cryptographic constructions that require a unique, random IV or nonce for every encryption operation.
- Rely on high-level, authenticated encryption primitives (e.g., AEAD modes) provided by reputable cryptographic libraries rather than designing custom schemes.
- Separate concerns between key derivation and encryption:
- Use a dedicated key derivation function (e.g., password-based KDF) for deriving keys from passphrases.
- Generate IVs or nonces using a cryptographically secure random number generator, not from passphrases.
- Reduce the trust placed in long-lived passphrases by:
- Rotating keys and secrets regularly.
- Avoiding re-use of the same passphrase for multiple unrelated encryption contexts.
- Apply least-privilege principles to any systems that handle decrypted secrets so that compromise of a single secret or key has limited blast radius.
How teams detect issues like this
Detection can focus on both code-level and configuration-level indicators of weak cryptographic usage:
- Static analysis and code review:
- Look for IVs or nonces derived from passphrases, configuration values, or other deterministic inputs.
- Flag any cryptographic code that computes IVs via hashing, concatenation, or transformation of a password or key instead of using a secure random source.
- Identify custom cryptographic wrappers around AES that do not clearly separate key derivation, IV generation, and encryption.
- Policy and tooling:
- Enforce secure cryptography patterns via code-review checklists and internal guidelines, explicitly forbidding deterministic IV derivation.
- Use automated scanning tools or linters configured to detect misuse of cryptographic APIs and predictable IV or nonce generation.
- Periodically audit encryption configurations and usage patterns in CI/CD systems, focusing on how secrets are protected and which libraries or helpers are used.

