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

[jws] check signature length #1004

Merged
merged 6 commits into from
Oct 26, 2023
Merged

Commits on Oct 25, 2023

  1. Configuration menu
    Copy the full SHA
    01f1383 View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2023

  1. Check that the signature length is 2*keysize

    We have been notified that certain JWS messages with ES256 signatures
    come with 63 byte signatures instead of the desired 64, and that
    jwx successfully verifies these. Upond digging, we have found that
    PR #65 removed the previous check for the key sizes, way back in 2019.
    
    Without this check it is possible for an unpadded R value to pass
    verification. For example, R with 31 bytes worth of data without
    padding followed by S with 32 bytes can pass the verification
    because when generating math.BigInt produces a valid result.
    
    For example:
    
      Regular Signagure -> | R (32 bytes)... | S (32 bytes)... |
    
      Invalid Signature -> | R (31 bytes)... | S (32 bytes)... |
    
    The type of signature that will get past is a signature where,
    both values of R and S are valid but R is not padded at byte 0.
    
    Since the signature content must match the correct content either
    way, it is highly unlikely that this can be used for anything other
    than adding an extra byte at the end of such a signature (that is,
    the end user who produced the signature must already have the
    correct signature anwyays).
    
    However, omitting the check _does_ allow otherwise invalid signature
    to be verified correctly.
    lestrrat committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    b9f754d View commit details
    Browse the repository at this point in the history
  2. Update Changes

    lestrrat committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    b22a91d View commit details
    Browse the repository at this point in the history
  3. appease linter

    lestrrat committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    5a10545 View commit details
    Browse the repository at this point in the history
  4. Add ecutil in BUILD.bazel

    lestrrat committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    94303dd View commit details
    Browse the repository at this point in the history
  5. one more occurance of ecutil

    lestrrat committed Oct 26, 2023
    Configuration menu
    Copy the full SHA
    6c5d2ed View commit details
    Browse the repository at this point in the history