CVE-2020-5408 Overview
Spring Security versions 5.3.x prior to 5.3.2, 5.2.x prior to 5.2.4, 5.1.x prior to 5.1.10, 5.0.x prior to 5.0.16 and 4.2.x prior to 4.2.16 use a fixed null initialization vector with CBC Mode in the implementation of the queryable text encryptor. A malicious user with access to the data that has been encrypted using such an encryptor may be able to derive the unencrypted values using a dictionary attack.
Critical Impact
Attackers with access to encrypted data can potentially recover plaintext values through dictionary attacks due to the use of a static null initialization vector in CBC mode encryption.
Affected Products
- Pivotal Software Spring Security versions 5.3.x prior to 5.3.2
- Pivotal Software Spring Security versions 5.2.x prior to 5.2.4
- Pivotal Software Spring Security versions 5.1.x prior to 5.1.10
- Pivotal Software Spring Security versions 5.0.x prior to 5.0.16
- Pivotal Software Spring Security versions 4.2.x prior to 4.2.16
- VMware Spring Security (affected versions)
Discovery Timeline
- 2020-05-14 - CVE CVE-2020-5408 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2020-5408
Vulnerability Analysis
This vulnerability represents a cryptographic implementation flaw in Spring Security's queryable text encryptor component. The core issue lies in the use of a fixed null (all-zeros) initialization vector (IV) when performing CBC (Cipher Block Chaining) mode encryption. In proper CBC mode implementation, the IV must be unique and unpredictable for each encryption operation to ensure semantic security.
When the same IV is reused across multiple encryption operations, identical plaintext blocks will produce identical ciphertext blocks. This predictability fundamentally undermines the security guarantees of the encryption scheme. An attacker with access to the encrypted data can leverage this weakness to perform a dictionary attack, systematically comparing known plaintext-ciphertext pairs against the target ciphertext to reveal the original values.
The queryable text encryptor is designed for scenarios where encrypted values need to be searchable or comparable, which inherently requires deterministic encryption. However, the implementation's use of a null IV makes it vulnerable to cryptanalysis when an attacker can observe or collect encrypted values over time.
Root Cause
The root cause is the use of a fixed null initialization vector in the CBC mode encryption implementation within Spring Security's queryable text encryptor (Encryptors.queryableText()). CWE-329 (Not Using a Random IV with CBC Mode) and CWE-330 (Use of Insufficiently Random Values) are the underlying weaknesses. CBC mode requires a unique, unpredictable IV for each encryption operation to prevent pattern analysis attacks. By using a static null IV, the encryptor produces deterministic output, allowing attackers to build dictionaries of encrypted values and reverse the encryption through comparison attacks.
Attack Vector
The attack vector is network-based and requires low-privilege authenticated access. An attacker who gains access to data encrypted using the vulnerable queryable text encryptor can perform offline dictionary attacks. The attack methodology involves:
- Collecting multiple ciphertext samples encrypted with the vulnerable encryptor
- Building a dictionary of common plaintext values and their corresponding ciphertexts
- Comparing observed ciphertexts against the dictionary to recover plaintext values
- Exploiting the deterministic nature of the encryption to identify patterns and repeated values
The attack does not require direct interaction with the application but relies on access to the encrypted data, whether through database access, log files, network interception, or other data exposure vectors.
Detection Methods for CVE-2020-5408
Indicators of Compromise
- Presence of Encryptors.queryableText() method calls in application source code
- Repeated identical ciphertext values in databases or logs indicating potential dictionary attack preparation
- Unusual database query patterns targeting encrypted columns
- Evidence of bulk data extraction from encrypted storage
Detection Strategies
- Perform static code analysis to identify usage of Encryptors.queryableText() in applications using affected Spring Security versions
- Review application dependencies for Spring Security versions 5.3.x < 5.3.2, 5.2.x < 5.2.4, 5.1.x < 5.1.10, 5.0.x < 5.0.16, or 4.2.x < 4.2.16
- Implement database activity monitoring to detect suspicious access patterns to encrypted data
- Use software composition analysis (SCA) tools to inventory vulnerable library versions across the enterprise
Monitoring Recommendations
- Enable detailed logging for data access operations involving encrypted columns
- Monitor for mass data export or unusual query volumes against sensitive encrypted data
- Implement alerting for authentication anomalies that could indicate credential theft via dictionary attacks
- Establish baseline access patterns and alert on deviations that may indicate exploitation attempts
How to Mitigate CVE-2020-5408
Immediate Actions Required
- Upgrade Spring Security to patched versions: 5.3.2+, 5.2.4+, 5.1.10+, 5.0.16+, or 4.2.16+
- Audit applications for usage of Encryptors.queryableText() and assess exposure risk
- Consider re-encrypting sensitive data after upgrading to ensure compromised data cannot be recovered
- Review access controls for any data encrypted using the vulnerable encryptor
Patch Information
VMware has released security patches addressing this vulnerability. Refer to the VMware Security Advisory for CVE-2020-5408 for official patch information and upgrade instructions. Additionally, Oracle has addressed this vulnerability in their products through Critical Patch Updates released in October 2020, January 2021, and April 2021.
Workarounds
- If immediate patching is not possible, avoid using Encryptors.queryableText() for sensitive data until the upgrade is complete
- Implement additional access controls to limit who can access encrypted data
- Consider using Encryptors.stronger() which uses proper random IVs, though this will produce non-deterministic ciphertext (not suitable for queryable use cases)
- Implement application-level encryption with properly randomized IVs as an alternative to the vulnerable encryptor
# Verify Spring Security version in Maven projects
mvn dependency:tree -Dincludes=org.springframework.security:spring-security-core
# Verify Spring Security version in Gradle projects
./gradlew dependencies --configuration runtimeClasspath | grep spring-security
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


