CVE-2023-51775 Overview
CVE-2023-51775 is a Denial of Service vulnerability affecting the jose4j Java library, a widely-used implementation of the JSON Object Signing and Encryption (JOSE) specifications. The vulnerability exists in versions prior to 0.9.4 and allows attackers to cause excessive CPU consumption by supplying a large p2c (PBES2 Count) value during cryptographic operations.
Critical Impact
Attackers can exhaust server CPU resources by sending maliciously crafted JOSE tokens with inflated PBES2 iteration counts, leading to service degradation or complete denial of service for applications relying on jose4j for JWT processing.
Affected Products
- jose4j versions prior to 0.9.4
- Applications using jose4j for JSON Web Token (JWT) processing
- Services implementing JOSE-based authentication or encryption
Discovery Timeline
- 2024-02-29 - CVE-2023-51775 published to NVD
- 2025-11-03 - Last updated in NVD database
Technical Details for CVE-2023-51775
Vulnerability Analysis
This vulnerability is classified as CWE-400 (Uncontrolled Resource Consumption), a form of algorithmic complexity attack targeting the Password-Based Encryption Scheme 2 (PBES2) implementation in jose4j. The library fails to enforce proper bounds checking on the p2c parameter, which specifies the iteration count for the key derivation function used in password-based encryption.
When processing encrypted JSON Web Encryption (JWE) tokens, jose4j accepts arbitrary p2c values without validation. An attacker can craft a malicious JWE header containing an extremely large iteration count, forcing the server to perform millions or billions of cryptographic iterations. This creates an asymmetric attack where minimal attacker effort causes disproportionate computational load on the target system.
The attack is particularly dangerous because it can be executed over the network without authentication, affecting any endpoint that accepts and processes JWE tokens using vulnerable jose4j versions.
Root Cause
The root cause of this vulnerability is the absence of upper-bound validation on the p2c parameter in the PBES2 key derivation implementation. The JOSE specification allows the sender to specify the iteration count, but jose4j did not enforce reasonable limits, trusting the potentially attacker-controlled input value. This design oversight enables resource exhaustion attacks by manipulating the computational complexity of the key derivation process.
Attack Vector
The attack exploits the network-accessible nature of JWT/JWE processing endpoints. An attacker constructs a JWE token with a malicious header containing an excessively large p2c value. When the target application attempts to decrypt or validate this token, the jose4j library dutifully executes the specified number of PBKDF2 iterations, consuming significant CPU cycles.
The vulnerability can be exploited in several scenarios:
- Authentication endpoints accepting encrypted JWT tokens
- API gateways processing JWE payloads
- OAuth/OIDC implementations using jose4j for token handling
- Any microservice architecture where jose4j processes incoming tokens
The attack requires low privileges and no user interaction, making it suitable for automated exploitation against publicly accessible services.
Detection Methods for CVE-2023-51775
Indicators of Compromise
- Unusual CPU spikes on services processing JWT/JWE tokens
- Increased latency or timeouts on authentication endpoints
- Log entries showing abnormally long token processing times
- JWE headers containing p2c values exceeding expected thresholds (typically above 310,000)
Detection Strategies
- Monitor CPU utilization patterns on JWT processing services for sudden unexplained spikes
- Implement logging to capture p2c values from incoming JWE tokens and alert on anomalous values
- Deploy application performance monitoring (APM) to track token validation latency
- Review dependency manifests to identify applications using jose4j versions prior to 0.9.4
Monitoring Recommendations
- Configure alerting for sustained high CPU usage on services handling encrypted tokens
- Establish baseline metrics for token processing times and alert on statistical deviations
- Implement rate limiting on endpoints that accept JWE tokens to reduce attack surface
- Enable verbose logging during incident investigation to capture full token headers
How to Mitigate CVE-2023-51775
Immediate Actions Required
- Upgrade jose4j to version 0.9.4 or later immediately
- Audit all applications and services for jose4j dependencies, including transitive dependencies
- Implement rate limiting on authentication and token processing endpoints as a temporary measure
- Consider deploying Web Application Firewall (WAF) rules to inspect and block tokens with excessive p2c values
Patch Information
The jose4j project addressed this vulnerability in version 0.9.4 by implementing proper validation and limits on the p2c parameter. Organizations should update their Maven or Gradle dependencies to specify version 0.9.4 or later. For detailed information about the fix, see the Bitbucket Issue Report. Additionally, NetApp has published guidance for affected products in their Security Advisory.
Workarounds
- Implement input validation at the application layer to reject JWE tokens with p2c values exceeding a reasonable threshold before passing to jose4j
- Deploy reverse proxy filtering to inspect JWE headers and block requests with suspicious parameter values
- Consider temporarily disabling PBES2-based encryption schemes if not required, favoring direct key encryption methods
- Implement request timeouts on token processing operations to limit the impact of exploitation attempts
# Maven dependency update example
# Update pom.xml to specify the patched version:
# <dependency>
# <groupId>org.bitbucket.b_c</groupId>
# <artifactId>jose4j</artifactId>
# <version>0.9.4</version>
# </dependency>
# Gradle dependency update:
# implementation 'org.bitbucket.b_c:jose4j:0.9.4'
# Verify installed version:
mvn dependency:tree | grep jose4j
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


