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

[JS]: Signing and verifying JWT signature with a constant key #799

Open
1 of 2 tasks
am0o0 opened this issue Nov 7, 2023 · 11 comments
Open
1 of 2 tasks

[JS]: Signing and verifying JWT signature with a constant key #799

am0o0 opened this issue Nov 7, 2023 · 11 comments
Assignees
Labels
All For One Submissions to the All for One, One for All bounty

Comments

@am0o0
Copy link

am0o0 commented Nov 7, 2023

Query PR

github/codeql#14666

Language

Javascript

CVE(s) ID list

WIP

CWE

CWE-798

Report

Usage of a hardcoded secret key to decode and verify JWTs will cause authentication and authorization bypass which in this query I tried to model many libraries for.

Are you planning to discuss this vulnerability submission publicly? (Blog Post, social networks, etc).

  • Yes
  • No

Blog post link

No response

@am0o0 am0o0 added the All For One Submissions to the All for One, One for All bounty label Nov 7, 2023
@p- p- self-assigned this Nov 10, 2023
@p-
Copy link

p- commented Nov 27, 2023

Hey @amammad 👋
Just a reminder that a CVE is missing here.

@am0o0
Copy link
Author

am0o0 commented Nov 27, 2023

Hi Peter, Is there any deadline for finding a new/old CVE? there are many vulnerable instances on my MRVA scan but I didn't have enough time to send a vulnerability report to them.

@p-
Copy link

p- commented Nov 27, 2023

Hi Peter, Is there any deadline for finding a new/old CVE?

No, afaik there's not. (but of course a reasonable time frame is welcome)

@p-
Copy link

p- commented May 8, 2024

Hey @am0o0
some time has passed by already, have you found a CVE for this issue by coincidence?

@am0o0
Copy link
Author

am0o0 commented May 8, 2024

Hi @p-
I found many instances but I haven't reported them yet, I tried to contact some of the maintainers but they didn't response, I'll try this weekend again, maybe I found a new repository that is worth it.
I managed to talk with one of the maintainers but they told me to just create a PR on our repository and no need to report something, do you accept this as I have to disclose the vulnerability in PR? They don't want to use the repository GitHub security panel So I think It can take a lot of time to request a CVE if I want to request the CVE myself.

@p-
Copy link

p- commented May 9, 2024

I'll try this weekend again, maybe I found a new repository that is worth it.

👍

do you accept this as I have to disclose the vulnerability in PR?

Let's wait if your new attempts bear any fruits and then I can talk to the team about that. (But in general we have the CVE requirement)

@am0o0
Copy link
Author

am0o0 commented May 13, 2024

@p- I found a CVE related to this submission.
GHSA-32r3-57hp-cgfw
the sink is here the commit is the last commit before fixing the CVE.

I'm wondering why codeql couldn't track the source to sink, with my PR I can find the sink which is the jsonwebteken method for signing and verifying the JWTs but I can't find the path between the constant and the sink. something needs to be added as an additional taint step.

I also have a gist for detected instances of hardcoded constant keys from only my additions and it does not contain the previously added hardcoded secret sinks. if it can make this submission process faster please let me know.

@am0o0 am0o0 changed the title [JS]: Creating and Decoding JWT signature with constant key [JS]: Signing and verifying JWT signature with a constant key May 25, 2024
@am0o0
Copy link
Author

am0o0 commented May 25, 2024

@p- sorry for delay
I checked the source code and debugged the codeql path and everything is good but the problem is that the taint configuration does not detect the source.

could you please examine the following query yourself?
MyTest.ql.tar.gz

please create a DB of this commit https://github.com/evershopcommerce/evershop/tree/b09f2f4d1a0eb3017344cddc997078444a53af46

you can see that the source is getConfig('jwt.web_token_secret', 'secret'); which I think shouldn't be this way!
and it should be the 'secret'.

@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Test run.

For information, the evaluation workflow is the following:
Initial triage > Test run > Results analysis > Query review > Final decision > Pay > Closed

@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Results analysis.

For information, the evaluation workflow is the following:
Initial triage > Test run > Results analysis > Query review > Final decision > Pay > Closed

@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Query review.

For information, the evaluation workflow is the following:
Initial triage > Test run > Results analysis > Query review > Final decision > Pay > Closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
All For One Submissions to the All for One, One for All bounty
Projects
None yet
Development

No branches or pull requests

3 participants