CVE-2026-27932: Joserfc Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-w5r5-m38g-f9f9
CVSS 7.5
CWE-770
Published
Advisory Summary

CVE-2026-27932 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Joserfc libraries in the PyPI ecosystem. The issue involves joserfc's pbes2 p2c unbounded iteration count enables denial of service (dos). Remediation is available by upgrading affected packages to version 1.6.3.

CVE-2026-27932 at a Glance

CVE Identifier CVE-2026-27932
GHSA Identifier GHSA-w5r5-m38g-f9f9
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-770: Allocation of Resources Without Limits or Throttling
Affected Product Joserfc
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-27932

To remediate this vulnerability, upgrade all affected Joserfc dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

joserfc fixed: 1.6.3
pip install joserfc>=1.6.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show joserfc

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-27932, inspect your installed packages using pip:

pip show joserfc

Analyze the terminal output to locate any version of Joserfc in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.3), your application is affected.

Note: The pip show joserfc command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Joserfc, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# 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/jwe_algs.py` **Vulnerable function:** `PBES2HSAlgKeyEncryption.decrypt_cek()` **Lines:** 283 ```python def decrypt_cek(self, recipient: Recipient[OctKey]) -> bytes: headers = recipient.headers() # ... p2c = headers["p2c"] # ← attacker-controlled integer # ... kek = self.compute_derived_key(key.get_op_key("deriveKey"), p2s, p2c) ``` The `p2c` value is then passed to `compute_derived_key` : ```python def compute_derived_key(self, key: bytes, p2s: bytes, p2c: int) -> bytes: # ... kdf = PBKDF2HMAC( algorithm=self.hash_alg, length=self.key_size // 8, salt=salt, iterations=p2c, # ← unbounded iterations backend=default_backend(), ) ``` **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.import_key(b"any-password") t0 = time.perf_counter() try: # This call will hang the thread for seconds jwe.decrypt_compact(token, key, algorithms=["PBES2-HS256+A128KW", "A128CBC-HS256"]) except Exception: pass print(f"Elapsed: {time.perf_counter() - 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.decrypt_cek()`. ```python MAX_P2C = 300000 # Example security bound # ... inside decrypt_cek ... p2c = headers["p2c"] if not isinstance(p2c, int) or p2c > MAX_P2C: raise DecodeError(f"p2c iteration count too high (max {MAX_P2C})") ``` 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.

CVE-2026-27932 Affected Joserfc Versions

1 component(s)
Fixed Versions:
1.6.3
Product / Package Ecosystem Affected Versions Fixed Version
joserfc
PyPI
< 1.6.3
1.6.3

References

Frequently Asked Questions

What is CVE-2026-27932?
CVE-2026-27932 is a security vulnerability in Joserfc involving joserfc's PBES2 p2c Unbounded Iteration Count enables Denial of Service (DoS) under CWE-770: Allocation of Resources Without Limits or Throttling.
Which Joserfc versions are affected?
Affected versions include releases prior to 1.6.3 across affected packages: joserfc.
What version fixes CVE-2026-27932?
Upgrading to 1.6.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is joserfc affected?
Yes, joserfc is affected in releases prior to 1.6.3. Upgrade your dependency to 1.6.3 or later.
What is the CVSS score of CVE-2026-27932?
CVE-2026-27932 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-27932?
CVE-2026-27932 is classified under CWE-770: Allocation of Resources Without Limits or Throttling (The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.).
How can I check PyPI dependencies for CVE-2026-27932?
Run the dependency tree command: 'pip show joserfc'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w5r5-m38g-f9f9",
  "modified" : "2026-03-04T02:00:47Z",
  "published" : "2026-03-02T18:47:37Z",
  "aliases" : [ "CVE-2026-27932" ],
  "summary" : "joserfc's PBES2 p2c Unbounded Iteration Count enables Denial of Service (DoS)",
  "details" : "# Summary \n\nA 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.\n\nThis 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.\n\n## Details\n \n**Vulnerable file:** `src/joserfc/_rfc7518/jwe_algs.py`\n**Vulnerable function:** `PBES2HSAlgKeyEncryption.decrypt_cek()` \n**Lines:** 283\n\n```python\ndef decrypt_cek(self, recipient: Recipient[OctKey]) -> bytes:\n    headers = recipient.headers()\n    # ...\n    p2c = headers[\"p2c\"]  # ← attacker-controlled integer\n    # ...\n    kek = self.compute_derived_key(key.get_op_key(\"deriveKey\"), p2s, p2c)\n```\nThe `p2c` value is then passed to `compute_derived_key` : \n\n```python\ndef compute_derived_key(self, key: bytes, p2s: bytes, p2c: int) -> bytes:\n    # ...\n    kdf = PBKDF2HMAC(\n        algorithm=self.hash_alg,\n        length=self.key_size // 8,\n        salt=salt,\n        iterations=p2c,  # ← unbounded iterations\n        backend=default_backend(),\n    )\n```\n\n**Impact on JWT Policies**\nAny 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., \nexp,`iss, aud` checks) or nested signature verification takes place. This makes existing JWT \"policies\" ineffective as a defense if the underlying algorithm is permitted.\n\n\n## PoC\n\n**Tested against joserfc 1.6.2.\nLocal Reproduction:**\n\n```python\nimport time\nfrom joserfc import jwe\nfrom joserfc.jwk import OctKey\n\n# Force joserfc to use local source if needed\n# sys.path.insert(0, \"src\")\n\n# Attacker-crafted token with 10 million iterations\n# Normally legitimate p2c is ~2048-4096. 10M iterations = ~5s DoS.\ntoken = \"eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwicDJzIjoiWjI5dVpYSm1ZdyIsInAyYyI6MTAwMDAwMDB9.dummy.dummy.dummy.dummy\"\n\nkey = OctKey.import_key(b\"any-password\")\n\nt0 = time.perf_counter()\ntry:\n    # This call will hang the thread for seconds\n    jwe.decrypt_compact(token, key, algorithms=[\"PBES2-HS256+A128KW\", \"A128CBC-HS256\"])\nexcept Exception:\n    pass\nprint(f\"Elapsed: {time.perf_counter() - t0:.2f}s\")\n```\n\n## Impact\nAn 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.\n\n## Recommendation\nMinimal fix: Implement an upper bound check for the `p2c` parameter in `PBES2HSAlgKeyEncryption.decrypt_cek()`.\n\n```python\nMAX_P2C = 300000  # Example security bound\n\n# ... inside decrypt_cek ...\np2c = headers[\"p2c\"]\nif not isinstance(p2c, int) or p2c > MAX_P2C:\n    raise DecodeError(f\"p2c iteration count too high (max {MAX_P2C})\")\n```\nAdditionally, 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "joserfc"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.6.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/authlib/joserfc/security/advisories/GHSA-w5r5-m38g-f9f9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-27932"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/authlib/joserfc/commit/696a961"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/authlib/joserfc/commit/696a9611ab982c45ee2190ed79ca8e1d8e09398f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/authlib/joserfc"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-770" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-02T18:47:37Z",
    "nvd_published_at" : "2026-03-03T23:15:56Z"
  }
}