Summary
Jervis, a library for Job DSL plugin scripts and shared Jenkins pipeline libraries, used AES/CBC/PKCS5Padding without any form of authentication or integrity protection before version 2.2.
This design allows attackers to perform padding oracle attacks and manipulate ciphertext, potentially altering or revealing protected data when they can interact with the encryption/decryption workflow.
Affected context
The vulnerability affects environments where Jervis is used to handle sensitive values within Jenkins Job DSL scripts or shared pipeline libraries and relies on AES/CBC/PKCS5Padding for "secure" storage or transmission.
It is most relevant when encrypted data is processed in workflows where an attacker can supply or influence ciphertext and observe success/failure or error differences coming from decryption attempts.
In such contexts, data expected to be protected by encryption may be partially disclosed or silently modified.
Exploit preconditions
- Attack surface: Interfaces or workflows where Jervis-based logic encrypts and decrypts values (e.g., configuration, secrets, parameters) and where results are reflected in build behavior or error responses.
- Required access: Ability to submit or tamper with ciphertext used by Jervis (for example, by modifying stored pipeline configuration, intercepting and altering data at rest or in transit, or influencing encrypted parameters).
- Trigger point: Each time the vulnerable AES/CBC/PKCS5Padding decryption is invoked and the system exposes timing, error messages, or behavioral differences based on padding validity.
- Why exploitation is possible: The encryption is unauthenticated—it lacks a MAC, signature, or AEAD mode—so padding validity leaks information and altered ciphertext may be accepted as valid, enabling padding oracle attacks and targeted ciphertext manipulation.
Why this happens
The underlying issue is the use of AES in CBC mode with PKCS5 padding without any accompanying integrity or authenticity mechanism, such as an HMAC or an authenticated encryption mode.
This maps to CWE-327: Use of a Broken or Risky Cryptographic Algorithm because CBC without authentication is a known insecure pattern: padding oracles can reveal information about plaintext, and bit-flipping can systematically change decrypted values.
In practice, Jervis treated encryption as sufficient to protect data without enforcing integrity checks, allowing adversaries who can interact with the decryption process to exploit cryptographic weaknesses in CBC mode.
Potential impact
- Attackers may recover sensitive plaintext values (e.g., configuration secrets or tokens) via padding oracle techniques.
- Encrypted configuration parameters or policy values can be altered without detection, potentially changing Jenkins pipeline behavior.
- Pipelines may execute with attacker-controlled parameters, expanding opportunities for privilege misuse or lateral movement.
- Security assumptions about the confidentiality and integrity of encrypted data within Jervis-based workflows can be invalidated.
General mitigation guidance
Mitigation focuses on replacing unauthenticated CBC encryption with modern, integrity-protecting schemes and tightening assumptions about encrypted data.
Recommended design patterns include:
- Using authenticated encryption modes (e.g., AES-GCM, AES-CCM, or other AEAD constructions) instead of raw AES/CBC/PKCS5Padding.
- If CBC must be retained for compatibility, wrapping it with a robust encrypt-then-MAC scheme so that any decryption attempt first validates an independent MAC.
- Ensuring decryption routines run in a way that does not reveal padding or format errors through distinguishable messages, status codes, or timing differences.
- Treating all externally supplied or indirectly influenced ciphertext as untrusted input, and validating it before using the decrypted values in security-sensitive logic.
- Applying least-privilege principles to any Jenkins jobs or pipelines that depend on decrypted data, so compromised values have limited blast radius.
How teams detect issues like this
Detection typically involves reviewing cryptographic usage patterns and enforcing secure-by-default policies:
- Static analysis: Search for AES/CBC/PKCS5Padding usage without accompanying MAC or AEAD constructs; flag decryption paths that accept external ciphertext.
- Code review: Examine cryptographic helpers or utility classes used by Jervis integrations to confirm that encryption includes integrity and authenticity guarantees.
- Configuration and policy checks: Enforce organizational rules that disallow unauthenticated encryption schemes in CI/CD tooling and require approved crypto primitives.
- Automated tooling: Integrate security scanners or SAST tools into the Jenkins pipeline itself to identify risky cryptographic APIs and highlight padding-sensitive error paths.

