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

Go: new query for detect DOS vulnerability #15130

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

Malayke
Copy link
Contributor

@Malayke Malayke commented Dec 18, 2023

This is part of All for one, one for all query submission, I'm going to submit an issue in github/securitylab for this pull request too.

slices created with the built-in make function from user-controlled sources using a maliciously large value possibly leading to a denial of service.

@ghsecuritylab
Copy link
Collaborator

Hello Malayke 👋
You have submitted this pull request as a bug bounty report in the github/securitylab repository and therefore this pull request has been put into draft state to give time for the GitHub Security Lab to assess the PR. When GitHub Security Lab has finished assessing your pull request, it will be marked automatically as Ready for review. Until then, please don't change the draft state.

In the meantime, feel free to make changes to the pull request. If you'd like to maximize payout for your this and future submissions, here are a few general guidelines, that we might take into consideration when reviewing a submission.

  • the submission models widely-used frameworks/libraries
  • the vulnerability modeled in the submission is impactful
  • the submission finds new true positive vulnerabilities
  • the submission finds very few false positives
  • code in the submission is easy to read and will be easy to maintain
  • documentation is written clearly, highlighting the impact of the issue it finds and is written without grammatical or other errors. The code samples clearly show the vulnerability
  • the submission includes tests, change note etc.

Please note that these are guidelines, not rules. Since we have a lot of different types of submissions, the guidelines might vary for each submission.

Happy hacking!

@ghsecuritylab ghsecuritylab marked this pull request as draft December 18, 2023 16:02
@ghsecuritylab ghsecuritylab marked this pull request as ready for review December 18, 2023 16:40
@owen-mc
Copy link
Contributor

owen-mc commented Dec 18, 2023

Are you aware of the existing query go/ql/src/Security/CWE-190/AllocationSizeOverflow.ql? This seems very closely related. Can you comment on whether they overlap?

@Malayke
Copy link
Contributor Author

Malayke commented Dec 19, 2023

I carefully read the code of AllocationSizeOverflow. If I understand correctly, AllocationSizeOverflow restricts the input of the source to the Marshal function, and the query focuses on whether there will be an overflow.

According to my testing, when the make slice is very large and exceeds the maximum value, it will trigger a panic error, but the program will continue to run normally and not cause denial of service. If it does not exceed the maximum value, the program will run normally but consume a large amount of memory. In this case, the program will exhaust the memory resources, leading to denial of service.

The query I wrote specifically checks whether the size of the make slice is directly defined by an untrusted source. From the results of the two queries, it seems that AllocationSizeOverflow cannot detect the vulnerabilities of the two CVEs I mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants