fix(deps): update module github.com/lestrrat-go/jwx to v1.2.29 [security] #169
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
v1.2.20
->v1.2.29
GitHub Vulnerability Alerts
GHSA-rm8v-mxj3-5rmq
Summary
Decrypting AES-CBC encrypted JWE has Potential Padding Oracle Attack Vulnerability.
Details
On v2.0.10, decrypting AES-CBC encrypted JWE may return an error "failed to generate plaintext from decrypted blocks: invalid padding":
https://github.com/lestrrat-go/jwx/blob/8840ffd4afc5839f591ff0e9ba9034af52b1643e/jwe/internal/aescbc/aescbc.go#L210-L213
Reporting padding error causes Padding Oracle Attack Vulnerability.
RFC 7516 JSON Web Encryption (JWE) says that we MUST NOT do this.
In addition, the time to remove padding depends on the length of the padding.
It may leak the length of the padding by Timing Attacks.
https://github.com/lestrrat-go/jwx/blob/796b2a9101cf7e7cb66455e4d97f3c158ee10904/jwe/internal/aescbc/aescbc.go#L33-L66
To mitigate Timing Attacks, it MUST be done in constant time.
Impact
The authentication tag is verified, so it is not an immediate attack.
CVE-2023-49290
Summary
too high p2c parameter in JWE's alg PBES2-* could lead to a DOS attack
Details
The JWE key management algorithms based on PBKDF2 require a JOSE Header Parameter called p2c (PBES2 Count). This parameter dictates the number of PBKDF2 iterations needed to derive a CEK wrapping key. Its primary purpose is to intentionally slow down the key derivation function, making password brute-force and dictionary attacks more resource- intensive.
Therefore, if an attacker sets the p2c parameter in JWE to a very large number, it can cause a lot of computational consumption, resulting in a DOS attack
PoC
Impact
It's a kind of Dos attack, the user's environment could potentially utilize an excessive amount of CPU resources.
CVE-2024-21664
Summary
Calling
jws.Parse
with a JSON serialized payload where thesignature
field is present whileprotected
is absent can lead to a nil pointer dereference.Details
This seems to also affect other functions that calls
Parse
internally, likejws.Verify
.My understanding of these functions from the docs is that they are supposed to fail gracefully on invalid input and don't require any prior validation.
Based on the stack trace in the PoC, the issue seems to be that the processing done in
jws/message.go:UnmarshalJSON()
assumes that if asignature
field is present, then aprotected
field is also present. If this is not the case, then the subsequent call togetB64Value(sig.protected)
will dereferencesig.protected
, which isnil
.PoC
Reproducer:
Result:
Impact
The vulnerability can be used to crash / DOS a system doing JWS verification.
CVE-2024-28122
Summary
This vulnerability allows an attacker with a trusted public key to cause a Denial-of-Service (DoS) condition by crafting a malicious JSON Web Encryption (JWE) token with an exceptionally high compression ratio. When this token is processed by the recipient, it results in significant memory allocation and processing time during decompression.
Details
The attacker needs to obtain a valid public key to compress the payload. It needs to be valid so that the recipient can use to successfully decompress the payload. Furthermore in context JWT processing in the v2 versions, the recipient must explicitly allow JWE handling .
The attacker then crafts a message with high compression ratio, e.g. a payload with very high frequency of repeating patterns that can decompress to a much larger size. If the payload is large enough, recipient who is decompressing the data will have to allocate a large amount of memory, which then can lead to a denial of service.
The original report includes a reference to [1], but there are some very subtle differences between this library and the aforementioned issue. The most important aspect is that the referenced issue focuses on JWT processing, whereas this library is intentionally divided into parts that comprise JOSE, i.e. JWT, JWS, JWE, JWK. In particular, v2 of this library does not attempt to handle JWT payload enveloped in a JWE message automatically (v1 attempted to do this automatically, but it was never stable).
Reflecting this subtle difference, the approach taken to mitigate this vulnerability is slightly different from the referenced issue. The referenced issue limits the size of JWT when parsing, but the fixes for this library limits the maximum size of the decompressed data when decrypting JWE messages. Therefore the fix in this library is applicable regardless of the usage context, and a limit is now imposed on the size of the message that our JWE implementation can handle.
Proof of Concept
Modified from the original report to fit the vulnerability better:
References
[1] CVE-2024-21319
Release Notes
lestrrat-go/jwx (github.com/lestrrat-go/jwx)
v1.2.29
Compare Source
v1.2.29 07 Mar 2024
[Security]
[jwe] Added
jwe.Settings(jwe.WithMaxDecompressBufferSize(int64))
to specify themaximum size of a decompressed JWE payload. The default value is 10MB. If you
are compressing payloads greater than this, you need to explicitly set it.
Unlike in v2, there is no way to set this globally. Please use v2 if this is required.
v1.2.28
Compare Source
v1.2.27
Compare Source
v1.2.26
: [SECURITY] v1.2.26Compare Source
v1.2.25
Compare Source
v1.2.24
Compare Source
v1.2.23
Compare Source
v1.2.22
Compare Source
v1.2.21
Compare Source
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.