Summary
The Jervis library used for Job DSL plugin scripts and shared Jenkins pipeline libraries relied on PKCS#1 v1.5 padding (PKCS1Encoding) for RSA encryption, which is susceptible to Bleichenbacher-style padding oracle attacks.
In environments where an attacker can observe padding error behavior or response differences, this weakness can allow gradual decryption or recovery of sensitive encrypted data that should remain confidential.
Affected context
This issue affects systems that integrate the Jervis library for Jenkins-related scripting and pipelines, where RSA encryption is performed using PKCS1Encoding.
The vulnerability becomes relevant when:
- RSA encryption is used for protecting sensitive data (e.g., secrets, tokens, or configuration),
- An attacker can interact with or observe a component that attempts to decrypt attacker-influenced ciphertexts,
- And the system's error handling or timing behavior reveals whether padding is valid or invalid.
Not every deployment will expose a practical oracle, but those that do are at risk of adaptive chosen-ciphertext attacks.
Exploit preconditions
- Attack surface: Any service, endpoint, or job that uses Jervis' RSA functionality and exposes distinguishable responses when decryption fails versus succeeds.
- Required access: Ability to submit or influence ciphertexts that are later decrypted by the vulnerable code, plus the ability to observe the system's responses, timing, or error patterns.
- Trigger point: Decryption attempts that process attacker-controlled ciphertexts using PKCS1Encoding with RSA.
- Why exploitation is possible: PKCS#1 v1.5 padding is vulnerable to Bleichenbacher padding oracle attacks, where subtle differences in error handling or response behavior can be iteratively abused to decrypt data without direct access to the private key.
Why this happens
The root cause is the use of a cryptographically weak padding scheme (PKCS#1 v1.5) for RSA operations in a context where padding oracle conditions may arise.
This maps to CWE-327: Use of a Broken or Risky Cryptographic Algorithm, because although RSA itself remains sound, the chosen padding mode is known to enable adaptive chosen-ciphertext attacks.
By continuing to use PKCS1Encoding instead of a more robust scheme such as OAEP, the implementation implicitly trusts that decryption error behavior will never be observable to attackers, which is a fragile and often incorrect assumption in complex CI/CD and automation environments.
Potential impact
- Attackers could decrypt captured ciphertexts, recovering sensitive information such as secrets, access tokens, or confidential configuration data.
- Long-term compromise of encrypted data archives or logs if they were protected using the vulnerable scheme.
- Facilitation of further lateral movement or privilege escalation if decrypted secrets are used for authentication or authorization.
- Erosion of trust in the integrity of secure provisioning or deployment processes that rely on encrypted values.
General mitigation guidance
Mitigation focuses on adopting stronger cryptographic padding schemes and avoiding error behaviors that leak cryptographic internals.
General defensive patterns include:
- Prefer OAEP (Optimal Asymmetric Encryption Padding) for RSA encryption, using modern, well-reviewed cryptographic libraries.
- Design APIs and services so that decryption errors are handled uniformly, without revealing whether a failure was due to padding, key mismatch, or other internal conditions.
- Limit where and how decryption is performed: centralize cryptographic operations in a minimal, hardened component instead of distributing them broadly across job scripts and pipelines.
- Apply strict key management practices, ensuring that RSA keys used by build or pipeline systems are rotated periodically and stored in secure hardware-backed or managed key services.
- When changing padding modes, plan migration paths for existing encrypted data, such as re-encrypting values on first use or through a controlled rotation workflow.
How teams detect issues like this
Effective detection relies on recognizing the use of risky cryptographic primitives and patterns:
- Static analysis and code scanning: Configure rules to flag uses of PKCS#1 v1.5 padding modes (e.g., PKCS1Encoding, "RSA/ECB/PKCS1Padding") and recommend OAEP-based alternatives.
- Code review signals: During reviews of pipeline libraries, Jenkins shared libraries, and cryptographic utilities, look for direct cryptographic primitive usage and verify that modern schemes and parameters are used.
- Policy enforcement: Introduce security guidelines or linters that prevent merging code that introduces deprecated or risky cryptographic algorithms or padding schemes.
- Runtime monitoring: Where feasible, log and monitor repeated decryption failures or unusual error patterns that could indicate probing for a padding oracle, while still avoiding detailed error disclosure to clients.
- Automated tooling: Use general-purpose application security testing tools and dependency analyzers that can highlight use of known-weak cryptography in third-party libraries and internal code.

