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 proof least significant bit change #68

Closed
mkhraisha opened this issue Nov 3, 2022 · 7 comments
Closed

JWS proof least significant bit change #68

mkhraisha opened this issue Nov 3, 2022 · 7 comments
Assignees
Labels
CR1 This item was processed during the first Candidate Recommendation phase. pending close (7 days) This issue will be closed after 7 days.

Comments

@mkhraisha
Copy link

Running into a rather confusing issue, hope someone hear can shed some light.
If you create a VC that outputs a proof that is a jws such as Ed25519Signature2018, and verify it then you get a correct response.
If you take the same VC then increment the last bit in the signature to a character that is within 15 characters ahead, it still returns "verified". i.e. in the case of the character g you can change it to v but not w
If you take the same VC then decrement the last bit in the signature, it fails.

    "@context": [
        "https://www.w3.org/2018/credentials/v1",
        "https://w3id.org/vc-revocation-list-2020/v1"
    ],
    "id": "urn:uuid:d1155a37-7931-4828-a819-cf0a55c57226",
    "type": [
        "VerifiableCredential"
    ],
    "issuer": "did:key:z6MktiSzqF9kqwdU8VkdBKx56EYzXfpgnNPUAGznpicNiWfn",
    "issuanceDate": "2010-01-01T19:23:24Z",
    "credentialStatus": {
        "id": "https://api.did.actor/revocation-lists/1.json#0",
        "type": "RevocationList2020Status",
        "revocationListIndex": 0,
        "revocationListCredential": "https://api.did.actor/revocation-lists/1.json"
    },
    "credentialSubject": {
        "id": "did:example:123"
    },
    "proof": {
        "type": "Ed25519Signature2018",
        "created": "2022-11-03T20:29:58Z",
        "verificationMethod": "did:key:z6MktiSzqF9kqwdU8VkdBKx56EYzXfpgnNPUAGznpicNiWfn#z6MktiSzqF9kqwdU8VkdBKx56EYzXfpgnNPUAGznpicNiWfn",
        "proofPurpose": "assertionMethod",
        "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..W288kEF5Zqvk9QSz_nznlIIHVEAWRDbosjngjUBppJRZ76E7kaTpljnh5SHzhXlS9zUgdv3HnpOHyv7iZeQaCg"
    }
}

After talking to @msporny it appears this is due to base64url encoding.

  1. would this allow me to modify the data and still get a matching signature? (current assumption is no because this is just the padding)
  2. what are the security implications?
@mkhraisha
Copy link
Author

@msporny @dlongley

@dlongley
Copy link
Contributor

dlongley commented Nov 15, 2022

@mkhraisha,

would this allow me to modify the data and still get a matching signature? (current assumption is no because this is just the padding)

No, because, like you said, it's just the padding. When you decode the signature value (whether it's modified in the way you described or not), you get the same raw signature bytes.

what are the security implications?

The same as for any other signature scheme that uses base64 encoding (like everything in JOSE).

Changing the value should not affect the integrity of the data that the signature is over (as the signature is itself separate from that and, as mentioned above, decoding the value produces the same signature bytes). However, if someone were to hash the data (including the signature value), of course the hashes would be different. Whether that is a problem for someone depends on their use of such hashes, etc.

@msporny msporny added the question Further information is requested label Jul 3, 2023
@msporny
Copy link
Member

msporny commented Jul 3, 2023

@mkhraisha it seems like your question has been answered. Is there anything further that we need to do wrt. changes to the specification or specification text? If there is a change that is needed to the specification, I expect it would be editorial in nature (like something put in the Security Considerations section) and could be done after the specification enters the Candidate Recommendation phase.

@msporny msporny added the CR1 This item was processed during the first Candidate Recommendation phase. label Jul 3, 2023
@mkhraisha
Copy link
Author

mkhraisha commented Jul 3, 2023

The question has been answered, but I think it is important to note in the security considerations post candidate rec .

@msporny
Copy link
Member

msporny commented Jul 3, 2023

The question has been answered, but I think it is important to note in the security considerations post candidate Rex.

Ok, can do. There's got to be some text out there in an IETF RFC on this given that it's a general issue w/ JOSE and its use of base64url encoding. We might just point to whatever that RFC says on the matter from our security considerations section.

@msporny msporny added ready for pr This issue is ready to be resolved via a pull request and removed question Further information is requested labels Jul 3, 2023
@msporny
Copy link
Member

msporny commented Feb 24, 2024

None of the current cryptosuites that the VCWG is standardizing use JWS encoding. All JWS cryptosuites have been abandoned by the group, so there is nothing left to say on this issue.

Marking this issue as pending close.

@msporny msporny added pending close (7 days) This issue will be closed after 7 days. and removed ready for pr This issue is ready to be resolved via a pull request labels Feb 24, 2024
@mkhraisha
Copy link
Author

I believe this can be closed.

@msporny msporny closed this as completed Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CR1 This item was processed during the first Candidate Recommendation phase. pending close (7 days) This issue will be closed after 7 days.
Projects
None yet
Development

No branches or pull requests

4 participants