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 jwk-json-leak template matcher #11414

Merged
merged 2 commits into from
Dec 26, 2024
Merged

Conversation

seqre
Copy link
Contributor

@seqre seqre commented Dec 25, 2024

Template / PR Information

According to the RFC 7517 section 4.5:

The "kid" value is a case-sensitive string. Use of this member is OPTIONAL.

On the other hand, section 4.1 mentions:

The "kty" value is a case-sensitive string. This member MUST be present in a JWK.

With that in mind, I've changed the kid from the template's matcher to kty as there is a higher chance that this field will be present.

Template Validation

I've validated this template locally?

  • YES
  • NO

Example jwks.json file from Appendix A of the RFC:

{"keys":
 [
   {"kty":"EC",
    "crv":"P-256",
    "x":"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4",
    "y":"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM",
    "use":"enc",
    "kid":"1"},

   {"kty":"RSA",
    "n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
    "e":"AQAB",
    "alg":"RS256",
    "kid":"2011-04-29"}
 ]
}

I hosted this file locally as visible and then with the kid fields removed. The new template matches the file in both cases.

Copy link
Member

@ehsandeep ehsandeep left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seqre thank you for improving the template.

@ehsandeep ehsandeep merged commit bc1e272 into projectdiscovery:main Dec 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants