Skip to content

Commit

Permalink
Fix p2c (#1025)
Browse files Browse the repository at this point in the history
* Fix p2c handling

* Update Changes
  • Loading branch information
lestrrat authored Dec 3, 2023
1 parent 9e4f840 commit 023b88f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
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

0 comments on commit 023b88f

Please sign in to comment.