CVE-2022-36083: Jose Remote Code Execution Vulnerability
MODERATECVE-2022-36083 is a MODERATE (CVSS 5.3) remote code execution vulnerability (CWE-834: Excessive Iteration) affecting Jose libraries in the npm ecosystem. The issue involves jose vulnerable to resource exhaustion via specifically crafted jwe. Remediation is available by upgrading affected packages to version 1.28.2, 3.20.4, 2.0.6, 4.9.2.
CVE-2022-36083 at a Glance
Security Impact
CVSS: 5.3
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:L).
How to Fix CVE-2022-36083
To remediate this vulnerability, upgrade all affected Jose dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install jose@1.28.2
npm install jose-browser-runtime@3.20.4
npm install jose-node-cjs-runtime@3.20.4
npm install jose-node-esm-runtime@3.20.4
npm install jose@2.0.6
npm install jose@3.20.4
npm install jose@4.9.2
npm install jose-browser-runtime@4.9.2
npm install jose-node-cjs-runtime@4.9.2
npm install jose-node-esm-runtime@4.9.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls jose
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2022-36083, inspect your project dependencies using npm:
npm ls jose
Analyze the terminal output to locate any version of Jose in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.28.2), your application is affected.
Note: The npm ls jose command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-834: Excessive Iteration, where the product performs an iteration or loop without sufficiently limiting the number of times that the loop is executed. In Jose, 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
CVE-2022-36083 Affected Jose Versions
10 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
jose
|
npm |
≥ 1.0.0
< 1.28.2
|
1.28.2
|
|
jose-browser-runtime
|
npm |
≥ 3.0.0
< 3.20.4
|
3.20.4
|
|
jose-node-cjs-runtime
|
npm |
≥ 3.0.0
< 3.20.4
|
3.20.4
|
|
jose-node-esm-runtime
|
npm |
≥ 3.0.0
< 3.20.4
|
3.20.4
|
|
jose
|
npm |
≥ 2.0.0
< 2.0.6
|
2.0.6
|
|
jose
|
npm |
≥ 3.0.0
< 3.20.4
|
3.20.4
|
|
jose
|
npm |
≥ 4.0.0
< 4.9.2
|
4.9.2
|
|
jose-browser-runtime
|
npm |
≥ 4.0.0
< 4.9.2
|
4.9.2
|
|
jose-node-cjs-runtime
|
npm |
≥ 4.0.0
< 4.9.2
|
4.9.2
|
|
jose-node-esm-runtime
|
npm |
≥ 4.0.0
< 4.9.2
|
4.9.2
|
References
Frequently Asked Questions
What is CVE-2022-36083?
Which Jose versions are affected?
What version fixes CVE-2022-36083?
Is jose affected?
Is jose-browser-runtime affected?
What is the CVSS score of CVE-2022-36083?
What CWE is associated with CVE-2022-36083?
How can I check npm dependencies for CVE-2022-36083?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jv3g-j58f-9mq9",
"modified" : "2022-09-16T17:44:42Z",
"published" : "2022-09-16T17:44:42Z",
"aliases" : [ "CVE-2022-36083" ],
"summary" : "JOSE vulnerable to resource exhaustion via specifically crafted JWE",
"details" : "The PBKDF2-based JWE key management algorithms expect a JOSE Header Parameter named `p2c` ([PBES2 Count](https://www.rfc-editor.org/rfc/rfc7518.html#section-4.8.1.2)), which determines how many PBKDF2 iterations must be executed in order to derive a CEK wrapping key. The purpose of this parameter is to intentionally slow down the key derivation function in order to make password brute-force and dictionary attacks more expensive.\n\nThis makes the PBES2 algorithms unsuitable for situations where the JWE is coming from an untrusted source: an adversary can intentionally pick an extremely high PBES2 Count value, that will initiate a CPU-bound computation that may take an unreasonable amount of time to finish.\n\n### Impact\n\nUnder certain conditions (see below) it is possible to have the user's environment consume unreasonable amount of CPU time.\n\n### Affected users\n\nThe impact is limited only to users utilizing the JWE decryption APIs with symmetric secrets to decrypt JWEs from untrusted parties who do not limit the accepted JWE Key Management Algorithms (`alg` Header Parameter) using the `keyManagementAlgorithms` (or `algorithms` in v1.x) decryption option or through other means.\n\nThe PBKDF2-based JWE Key Management Algorithm Identifiers are\n\n- `PBES2-HS256+A128KW`\n- `PBES2-HS384+A192KW`\n- `PBES2-HS512+A256KW`\n\ne.g.\n\n```js\nconst secret = new Uint8Array(16)\nconst jwe = '...' // JWE from an untrusted party\n\nawait jose.compactDecrypt(jwe, secret)\n```\n\nYou are NOT affected if any of the following applies to you\n\n- Your code does not use the JWE APIs\n- Your code only produces JWE tokens\n- Your code only decrypts JWEs using an asymmetric JWE Key Management Algorithm (this means you're providing an asymmetric key object to the JWE decryption API)\n- Your code only accepts JWEs produced by trusted sources\n- Your code limits the accepted JWE Key Management Algorithms using the `keyManagementAlgorithms` decryption option not including any of the PBKDF2-based JWE key management algorithms\n\n### Patches\n\n`v1.28.2`, `v2.0.6`, `v3.20.4`, and `v4.9.2` releases limit the maximum PBKDF2 iteration count to `10000` by default. It is possible to adjust this limit with a newly introduced `maxPBES2Count` decryption option.\n\n### Workarounds\n\nAll users should be able to upgrade given all stable semver major release lines have had new a patch release introduced which limits the PBKDF2 iteration count to `10000` by default. This removes the ability to craft JWEs that would consume unreasonable amount of CPU time.\n\nIf users are unable to upgrade their required library version they have two options depending on whether they expect to receive JWEs using any of the three PBKDF2-based JWE key management algorithms.\n\n- they can use the `keyManagementAlgorithms` decryption option to disable accepting PBKDF2 altogether\n- they can inspect the JOSE Header prior to using the decryption API and limit the PBKDF2 iteration count (`p2c` Header Parameter)\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an discussion in the project's [repository](https://github.com/panva/jose/discussions/new?category=q-a&title=GHSA-jv3g-j58f-9mq9%20advisory%20question)\n* Email me at [panva.ip@gmail.com](mailto:panva.ip@gmail.com)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "jose"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.0.0"
}, {
"fixed" : "1.28.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.28.1"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose-browser-runtime"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.20.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.20.3"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose-node-cjs-runtime"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.20.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.20.3"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose-node-esm-runtime"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.20.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.20.3"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "2.0.0"
}, {
"fixed" : "2.0.6"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 2.0.5"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.20.4"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 3.20.3"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.9.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.9.1"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose-browser-runtime"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.9.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.9.1"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose-node-cjs-runtime"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.9.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.9.1"
}
}, {
"package" : {
"ecosystem" : "npm",
"name" : "jose-node-esm-runtime"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.0.0"
}, {
"fixed" : "4.9.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.9.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/panva/jose/security/advisories/GHSA-jv3g-j58f-9mq9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36083"
}, {
"type" : "WEB",
"url" : "https://github.com/panva/jose/commit/03d6d013bf6e070e85adfe5731f526978e3e8e4d"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/panva/jose"
}, {
"type" : "WEB",
"url" : "https://github.com/panva/jose/releases/tag/v4.9.2"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-400", "CWE-834" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-09-16T17:44:42Z",
"nvd_published_at" : "2022-09-07T22:15:00Z"
}
}