CVE-2026-27932: joserfc PBES2 p2c Unbounded Iteration Count enables Denial of Service (DoS)

Published Mar 2, 2026
·
Updated

Summary

A resource exhaustion vulnerability in joserfc allows an unauthenticated attacker to cause a Denial of Service (DoS) via CPU exhaustion. When the library decrypts a JSON Web Encryption (JWE) token using Password-Based Encryption (PBES2) algorithms, it reads the p2c (PBES2 Count) parameter directly from the token's protected header. This parameter defines the number of iterations for the PBKDF2 key derivation function. Because joserfc does not validate or bound this value, an attacker can specify an extremely large iteration count (e.g., 2^31 - 1), forcing the server to expend massive CPU resources processing a single token.

This vulnerability exists at the JWA layer and impacts all high-level JWE and JWT decryption interfaces if PBES2 algorithms are allowed by the application's policy.

Details Vulnerable file: src/joserfc/rfc7518/jwealgs.py Vulnerable function: PBES2HSAlgKeyEncryption.decryptcek() Lines: 283

python def decryptcek(self, recipient: Recipient[OctKey]) -> bytes: headers = recipient.headers() # ... p2c = headers["p2c"] # ← attacker-controlled integer # ... kek = self.computederivedkey(key.getopkey("deriveKey"), p2s, p2c) The p2c value is then passed to computederivedkey :

python def computederivedkey(self, key: bytes, p2s: bytes, p2c: int) -> bytes: # ... kdf = PBKDF2HMAC( algorithm=self.hashalg, length=self.keysize // 8, salt=salt, iterations=p2c, # ← unbounded iterations backend=defaultbackend(), )

Impact on JWT Policies Any JWT policy configured to allow PBES2 key management algorithms (e.g., PBES2-HS256+A128KW) is vulnerable. Because the DoS occurs during the decryption phase, the attack is triggered before any claim validation (e.g., exp,iss, aud checks) or nested signature verification takes place. This makes existing JWT "policies" ineffective as a defense if the underlying algorithm is permitted.

PoC

Tested against joserfc 1.6.2. Local Reproduction:

python import time from joserfc import jwe from joserfc.jwk import OctKey

Force joserfc to use local source if needed sys.path.insert(0, "src")

Attacker-crafted token with 10 million iterations Normally legitimate p2c is ~2048-4096. 10M iterations = ~5s DoS. token = "eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwicDJzIjoiWjI5dVpYSm1ZdyIsInAyYyI6MTAwMDAwMDB9.dummy.dummy.dummy.dummy"

key = OctKey.importkey(b"any-password")

t0 = time.perfcounter() try: # This call will hang the thread for seconds jwe.decryptcompact(token, key, algorithms=["PBES2-HS256+A128KW", "A128CBC-HS256"]) except Exception: pass print(f"Elapsed: {time.perfcounter() - t0:.2f}s")

Impact An unauthenticated remote attacker can exhaust the CPU resources of a server by sending a small number of crafted JWE/JWT tokens. Each token will occupy a worker thread/process for a duration proportional to the p2c value (up to several minutes or hours depending on the integer value). This results in a complete Denial of Service for legitimate users.

Recommendation Minimal fix: Implement an upper bound check for the p2c parameter in PBES2HSAlgKeyEncryption.decryptcek().

python MAXP2C = 300000 # Example security bound

... inside decryptcek ... p2c = headers["p2c"] if not isinstance(p2c, int) or p2c > MAXP2C: raise DecodeError(f"p2c iteration count too high (max {MAXP2C})") Additionally, applications should only enable PBES2 algorithms if password-based encryption is specifically required and should enforce a strict algorithms allowlist in their JWT/JWE policies.

Other sources

joserfc is a Python library that provides an implementation of several JSON Object Signing and Encryption (JOSE) standards. In 1.6.2 and earlier, a resource exhaustion vulnerability in joserfc allows an unauthenticated attacker to cause a Denial of Service (DoS) via CPU exhaustion. When the library decrypts a JSON Web Encryption (JWE) token using Password-Based Encryption (PBES2) algorithms, it reads the p2c (PBES2 Count) parameter directly from the token's protected header. This parameter defines the number of iterations for the PBKDF2 key derivation function. Because joserfc does not validate or bound this value, an attacker can specify an extremely large iteration count (e.g., 2^31 - 1), forcing the server to expend massive CPU resources processing a single token. This vulnerability exists at the JWA layer and impacts all high-level JWE and JWT decryption interfaces if PBES2 algorithms are allowed by the application's policy.

MITRE

Affected Software

2 affected componentsFixes available
pip/joserfc<1.6.3
1.6.3
Hsiaoming Joserfc Python<=1.6.2

Event History

Mar 2, 2026
Advisory Published
via GitHub·06:47 PM
Data Sourced
via GitHub·06:47 PM
DescriptionSeverityWeaknessAffected Software
Mar 3, 2026
CVE Published
via MITRE·10:48 PM
Data Sourced
via MITRE·10:48 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:15 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:15 PM
RemedyAffected Software
Dec 18, 58147
Event
via FIRST·09:47 AM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-27932?

CVE-2026-27932 is classified as a Denial of Service (DoS) vulnerability due to potential resource exhaustion.

2

How does CVE-2026-27932 affect joserfc?

CVE-2026-27932 allows an unauthenticated attacker to exploit the joserfc library, leading to CPU exhaustion while decrypting JWE tokens.

3

How do I fix CVE-2026-27932?

To mitigate CVE-2026-27932, upgrade to joserfc version 1.6.3 or later.

4

Is CVE-2026-27932 exploitable without authentication?

Yes, CVE-2026-27932 can be exploited by an unauthenticated attacker.

5

What parameters contribute to the vulnerability in CVE-2026-27932?

The p2c (PBES2 Count) parameter during password-based encryption contributes to the resource exhaustion vulnerability in CVE-2026-27932.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203