Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix p2c #1025

Merged
merged 2 commits into from
Dec 3, 2023
Merged

Fix p2c #1025

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@ Changes
=======

v1.2.27 - UNRELEASED
[Buf xies]
[Security]
* [jwe] A large number in p2c parameter for PBKDF2 based encryptions could cause a DoS attack,
similar to https://nvd.nist.gov/vuln/detail/CVE-2022-36083. All users should upgrade, as
unlike v2, v1 attempts to decrypt JWEs on JWTs by default.
[GHSA-7f9x-gw85-8grf]

[Bug xies]
* [jwk] jwk.Set(jwk.KeyOpsKey, <jwk.KeyOperation>) now works (previously, either
Set(.., <string>) or Set(..., []jwk.KeyOperation{...}) worked, but not a single
jwk.KeyOperation
Expand Down
5 changes: 5 additions & 0 deletions jwe/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,11 @@ func doDecryptCtx(dctx *decryptCtx) ([]byte, error) {
if !ok {
return nil, errors.Errorf("unexpected type for 'p2c': %T", count)
}
// in v1, this number is hardcoded to 10000. Use v2 if you need to
// finetune this value
if countFlt > 10000 {
return nil, errors.Errorf("invalid value for 'p2c'")
}
salt, err := base64.DecodeString(saltB64Str)
if err != nil {
return nil, errors.Wrap(err, "failed to b64-decode 'salt'")
Expand Down
Loading