Ecosyste.ms: Advisories
An open API service providing security vulnerability metadata for many open source software ecosystems.
Security Advisories: GSA_kwCzR0hTQS1qdjNnLWo1OGYtOW1xOc4AAu1m
JOSE vulnerable to resource exhaustion via specifically crafted JWE
The PBKDF2-based JWE key management algorithms expect a JOSE Header Parameter named p2c
(PBES2 Count), 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.
This 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.
Impact
Under certain conditions (see below) it is possible to have the user's environment consume unreasonable amount of CPU time.
Affected users
The 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.
The PBKDF2-based JWE Key Management Algorithm Identifiers are
PBES2-HS256+A128KW
PBES2-HS384+A192KW
PBES2-HS512+A256KW
e.g.
const secret = new Uint8Array(16)
const jwe = '...' // JWE from an untrusted party
await jose.compactDecrypt(jwe, secret)
You are NOT affected if any of the following applies to you
- Your code does not use the JWE APIs
- Your code only produces JWE tokens
- 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)
- Your code only accepts JWEs produced by trusted sources
- 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
Patches
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.
Workarounds
All 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.
If 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.
- they can use the
keyManagementAlgorithms
decryption option to disable accepting PBKDF2 altogether - they can inspect the JOSE Header prior to using the decryption API and limit the PBKDF2 iteration count (
p2c
Header Parameter)
For more information
If you have any questions or comments about this advisory:
- Open an discussion in the project's repository
- Email me at [email protected]
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1qdjNnLWo1OGYtOW1xOc4AAu1m
Source: GitHub Advisory Database
Origin: Unspecified
Severity: Moderate
Classification: General
Published: about 2 years ago
Updated: over 1 year ago
CVSS Score: 5.3
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Identifiers: GHSA-jv3g-j58f-9mq9, CVE-2022-36083
References:
- https://github.com/panva/jose/security/advisories/GHSA-jv3g-j58f-9mq9
- https://nvd.nist.gov/vuln/detail/CVE-2022-36083
- https://github.com/panva/jose/commit/03d6d013bf6e070e85adfe5731f526978e3e8e4d
- https://github.com/panva/jose/releases/tag/v4.9.2
- https://github.com/advisories/GHSA-jv3g-j58f-9mq9
Blast Radius: 25.1
Affected Packages
npm:jose-node-esm-runtime
Dependent packages: 1Dependent repositories: 1
Downloads: 1,025 last month
Affected Version Ranges: >= 4.0.0, <= 4.9.1, >= 3.0.0, <= 3.20.3
Fixed in: 4.9.2, 3.20.4
All affected versions: 3.8.0, 3.9.0, 3.10.0, 3.11.0, 3.11.1, 3.11.2, 3.11.3, 3.11.4, 3.11.5, 3.11.6, 3.12.0, 3.12.1, 3.12.2, 3.12.3, 3.13.0, 3.14.0, 3.14.1, 3.14.2, 3.14.3, 3.14.4, 3.15.0, 3.15.1, 3.15.2, 3.15.3, 3.15.4, 3.15.5, 3.16.0, 3.16.1, 3.17.0, 3.18.0, 3.19.0, 3.20.0, 3.20.1, 3.20.2, 3.20.3, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.2.0, 4.2.1, 4.3.0, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.3.6, 4.3.7, 4.3.8, 4.3.9, 4.4.0, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.6.0, 4.6.1, 4.6.2, 4.7.0, 4.8.0, 4.8.1, 4.8.3, 4.9.0, 4.9.1
All unaffected versions: 3.20.4, 4.9.2, 4.9.3, 4.10.0, 4.10.1, 4.10.2, 4.10.3, 4.10.4, 4.11.0, 4.11.1, 4.11.2, 4.11.3, 4.11.4, 4.12.0, 4.12.1, 4.12.2, 4.13.0, 4.13.1, 4.13.2, 4.14.0, 4.14.1, 4.14.2, 4.14.3, 4.14.4, 4.14.5, 4.14.6, 4.15.0, 4.15.1, 4.15.2, 4.15.3, 4.15.4, 4.15.5, 5.0.0, 5.0.1, 5.0.2, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, 5.3.0, 5.4.0, 5.4.1, 5.5.0, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.7.0, 5.8.0, 5.9.0, 5.9.1, 5.9.2, 5.9.3, 5.9.4, 5.9.5, 5.9.6
npm:jose-node-cjs-runtime
Dependent packages: 6Dependent repositories: 5
Downloads: 8,732 last month
Affected Version Ranges: >= 4.0.0, <= 4.9.1, >= 3.0.0, <= 3.20.3
Fixed in: 4.9.2, 3.20.4
All affected versions: 3.7.1, 3.9.0, 3.10.0, 3.11.0, 3.11.1, 3.11.2, 3.11.3, 3.11.4, 3.11.5, 3.11.6, 3.12.0, 3.12.1, 3.12.2, 3.12.3, 3.13.0, 3.14.0, 3.14.1, 3.14.2, 3.14.3, 3.14.4, 3.15.0, 3.15.1, 3.15.2, 3.15.3, 3.15.4, 3.15.5, 3.16.0, 3.16.1, 3.17.0, 3.18.0, 3.19.0, 3.20.0, 3.20.1, 3.20.2, 3.20.3, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.2.0, 4.2.1, 4.3.0, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.3.6, 4.3.7, 4.3.8, 4.3.9, 4.4.0, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.6.0, 4.6.1, 4.6.2, 4.7.0, 4.8.0, 4.8.1, 4.8.3, 4.9.0, 4.9.1
All unaffected versions: 3.20.4, 4.9.2, 4.9.3, 4.10.0, 4.10.1, 4.10.2, 4.10.3, 4.10.4, 4.11.0, 4.11.1, 4.11.2, 4.11.3, 4.11.4, 4.12.0, 4.12.1, 4.12.2, 4.13.0, 4.13.1, 4.13.2, 4.14.0, 4.14.1, 4.14.2, 4.14.3, 4.14.4, 4.14.5, 4.14.6, 4.15.0, 4.15.1, 4.15.2, 4.15.3, 4.15.4, 4.15.5, 5.0.0, 5.0.1, 5.0.2, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, 5.3.0, 5.4.0, 5.4.1, 5.5.0, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.7.0, 5.8.0, 5.9.0, 5.9.1, 5.9.2, 5.9.3, 5.9.4, 5.9.5, 5.9.6
npm:jose-browser-runtime
Dependent packages: 6Dependent repositories: 10
Downloads: 22,678 last month
Affected Version Ranges: >= 4.0.0, <= 4.9.1, >= 3.0.0, <= 3.20.3
Fixed in: 4.9.2, 3.20.4
All affected versions: 3.8.0, 3.9.0, 3.10.0, 3.11.0, 3.11.1, 3.11.2, 3.11.3, 3.11.4, 3.11.5, 3.11.6, 3.12.0, 3.12.1, 3.12.2, 3.12.3, 3.13.0, 3.14.0, 3.14.1, 3.14.2, 3.14.3, 3.14.4, 3.15.0, 3.15.1, 3.15.2, 3.15.3, 3.15.4, 3.15.5, 3.16.0, 3.16.1, 3.17.0, 3.18.0, 3.19.0, 3.20.0, 3.20.1, 3.20.2, 3.20.3, 4.0.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.2.0, 4.2.1, 4.3.0, 4.3.2, 4.3.3, 4.3.4, 4.3.5, 4.3.6, 4.3.7, 4.3.8, 4.3.9, 4.4.0, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.6.0, 4.6.1, 4.6.2, 4.7.0, 4.8.0, 4.8.1, 4.8.3, 4.9.0, 4.9.1
All unaffected versions: 3.20.4, 4.9.2, 4.9.3, 4.10.0, 4.10.1, 4.10.2, 4.10.3, 4.10.4, 4.11.0, 4.11.1, 4.11.2, 4.11.3, 4.11.4, 4.12.0, 4.12.1, 4.12.2, 4.13.0, 4.13.1, 4.13.2, 4.14.0, 4.14.1, 4.14.2, 4.14.3, 4.14.4, 4.14.5, 4.14.6, 4.15.0, 4.15.1, 4.15.2, 4.15.3, 4.15.4, 4.15.5, 5.0.0, 5.0.1, 5.0.2, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, 5.3.0, 5.4.0, 5.4.1, 5.5.0, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.7.0, 5.8.0, 5.9.0, 5.9.1, 5.9.2, 5.9.3, 5.9.4, 5.9.5, 5.9.6
npm:jose
Dependent packages: 1,109Dependent repositories: 54,898
Downloads: 49,762,001 last month
Affected Version Ranges: >= 4.0.0, <= 4.9.1, >= 3.0.0, <= 3.20.3, >= 2.0.0, <= 2.0.5, >= 1.0.0, <= 1.28.1
Fixed in: 4.9.2, 3.20.4, 2.0.6, 1.28.2
All affected versions: 1.9.2, 1.10.0, 1.10.1, 1.10.2, 1.11.0, 1.12.0, 1.12.1, 1.13.0, 1.14.0, 1.15.0, 1.15.1, 1.16.0, 1.16.1, 1.16.2, 1.17.0, 1.17.1, 1.17.2, 1.18.0, 1.18.1, 1.18.2, 1.19.0, 1.20.0, 1.21.0, 1.21.1, 1.22.0, 1.22.1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