chore(all): update module github.com/lestrrat-go/jwx/v2 to v2.0.21 [SECURITY] #4106
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:
v2.0.19
->v2.0.21
GitHub Vulnerability Alerts
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/v2)
v2.0.21
Compare Source
v2.0.21 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 and want to decompress it during
a call to
jwe.Decrypt
, you need to explicitly set a value large enough tohold that data.
The same option can be passed to
jwe.Decrypt
to control this behavior ona per-message basis.
[jwe] Added documentation stating that
jwe.WithMaxBufferSize
option will berenamed in future versions, i.e. v3
v2.0.20
Compare Source
v2.0.20 20 Feb 2024
[New Features]
jwe.Settings(WithMaxBufferSize(int64))
to set the maximum size ofinternal buffers. The default value is 256MB. Most users do not need to change
this value.
jws.WithCompact()
andjws.WithJSON()
to be passed tojws.Parse()
andjws.Verify()
. These options control the expected serialization format for theJWS message.
jwt.WithCompactOnly()
to specify that only compact serialization canbe used for
jwt.Parse()
. Previously, by virtue ofjws.Parse()
allowing eitherJSON or Compact serialization format,
jwt.Parse()
also alloed JSON serializationwhere as RFC7519 explicitly states that only compact serialization should be
used. For backward compatibility the default behavior is not changed, but you
can set this global option for jwt:
jwt.Settings(jwt.WithCompactOnly(true))
[Miscellaneous]
public keys. This would allow you to pass private keys where public keys are
expected.
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 has been generated by Mend Renovate. View repository job log here.