CVE-2023-52428 Overview
CVE-2023-52428 is a denial of service vulnerability in Connect2id Nimbus JOSE+JWT, a widely-used Java library for JSON Web Token (JWT) processing. The vulnerability allows an attacker to cause significant resource consumption by supplying a maliciously crafted JWE (JSON Web Encryption) token with an excessively large p2c (PBES2 iteration count) header value. When the PasswordBasedDecrypter component processes such a token using PBKDF2 (Password-Based Key Derivation Function 2), the system becomes overwhelmed attempting to perform the requested number of cryptographic iterations, leading to CPU exhaustion and service unavailability.
Critical Impact
Applications using Nimbus JOSE+JWT for password-based JWE decryption are vulnerable to resource exhaustion attacks that can render services completely unavailable without requiring authentication.
Affected Products
- Connect2id Nimbus JOSE+JWT versions prior to 9.37.2
Discovery Timeline
- 2024-02-11 - CVE CVE-2023-52428 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2023-52428
Vulnerability Analysis
The vulnerability resides in the PasswordBasedDecrypter component of Nimbus JOSE+JWT, which implements the PBES2 (Password-Based Encryption Scheme 2) algorithm for JWE decryption. PBKDF2 is intentionally designed to be computationally expensive to resist brute-force attacks against passwords. The p2c header parameter in JWE tokens specifies how many iterations the PBKDF2 function should perform during key derivation.
In vulnerable versions, the library fails to enforce a reasonable upper bound on the p2c value. An attacker can craft a malicious JWE token with an astronomically high iteration count (potentially billions of iterations), which the library will attempt to execute. This leads to prolonged CPU consumption, potentially freezing application threads and causing denial of service conditions.
Root Cause
The root cause is insufficient input validation on the p2c (PBES2-Count) header value in incoming JWE tokens. The JOSE specification (RFC 7518) does not mandate a maximum value for this parameter, and the Nimbus library prior to version 9.37.2 did not implement application-level restrictions. This allows attackers to specify arbitrarily large values that translate directly into computational work performed by the server.
Attack Vector
This vulnerability is exploitable remotely over the network without any authentication. An attacker simply needs to identify an endpoint that accepts and processes JWE tokens using password-based decryption. The attack can be executed by sending a single crafted HTTP request containing the malicious JWE token.
The attack flow proceeds as follows: the attacker constructs a JWE token with a valid structure but includes an extremely large p2c header value (e.g., 2147483647). When the application attempts to decrypt this token using PasswordBasedDecrypter, the PBKDF2 implementation begins executing the specified number of iterations. Since no upper bound check exists, the CPU becomes saturated processing the excessive iterations, starving other application threads and eventually causing service degradation or complete unavailability.
Detection Methods for CVE-2023-52428
Indicators of Compromise
- Abnormal CPU utilization spikes correlated with JWT/JWE processing endpoints
- Increased response times or timeouts on authentication or token-processing services
- Application logs showing extended processing times for JWE decryption operations
- Thread dumps revealing threads stuck in PBKDF2 key derivation operations
Detection Strategies
- Implement monitoring for JWE tokens with unusually high p2c header values exceeding reasonable thresholds (e.g., above 310,000 iterations)
- Deploy web application firewall rules to inspect and reject JWE tokens with suspicious PBES2 parameters
- Enable application performance monitoring to detect anomalous CPU consumption patterns in token processing
- Audit code dependencies to identify usage of vulnerable Nimbus JOSE+JWT versions
Monitoring Recommendations
- Configure alerts for sustained high CPU usage on application servers handling JWT operations
- Monitor thread pool exhaustion metrics in JVM-based applications
- Track request latency percentiles for endpoints that process JWE tokens
- Implement circuit breaker patterns with timeout thresholds for cryptographic operations
How to Mitigate CVE-2023-52428
Immediate Actions Required
- Upgrade Connect2id Nimbus JOSE+JWT to version 9.37.2 or later immediately
- Audit all applications and services for dependencies on vulnerable library versions
- Review and validate any JWE processing endpoints for exposure to untrusted input
- Consider implementing input validation at the application layer to reject JWE tokens with excessive p2c values
Patch Information
The vulnerability has been addressed in Nimbus JOSE+JWT version 9.37.2. The fix introduces proper validation and limits on the p2c header value to prevent excessive iteration counts. The security patch can be reviewed in the Bitbucket commit 3b3b77e. Additional details about the vulnerability are available in the Bitbucket issue tracker.
For Maven projects, update the dependency to the patched version:
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>9.37.2</version>
</dependency>
Workarounds
- If immediate upgrade is not possible, implement a custom JWE header validator that rejects tokens with p2c values exceeding a safe threshold (recommended maximum: 310,000 iterations)
- Deploy request timeout mechanisms at the application server or reverse proxy level to terminate long-running requests
- Consider temporarily disabling password-based JWE decryption endpoints until the library can be upgraded
- Implement rate limiting on endpoints that process JWE tokens to reduce the impact of repeated exploitation attempts
# Check current Nimbus JOSE+JWT version in Maven projects
mvn dependency:tree -Dincludes=com.nimbusds:nimbus-jose-jwt
# Update dependency to patched version
mvn versions:use-dep-version -Dincludes=com.nimbusds:nimbus-jose-jwt -DdepVersion=9.37.2
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

