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]: Query To Detect Denial Of Service Vulnerability #809

Closed
1 of 2 tasks
Malayke opened this issue Dec 18, 2023 · 9 comments
Closed
1 of 2 tasks

[Go]: Query To Detect Denial Of Service Vulnerability #809

Malayke opened this issue Dec 18, 2023 · 9 comments
Assignees
Labels
All For One Submissions to the All for One, One for All bounty

Comments

@Malayke
Copy link

Malayke commented Dec 18, 2023

Query PR

github/codeql#15130

Language

GoLang

CVE(s) ID list

CWE

CWE-770

Report

  1. What is the vulnerability?

The vulnerability in Go occurs when the built-in make function is used to create slices from user-controlled sources with a maliciously large value. This can lead to excessive memory allocation and potentially result in a denial of service attack. By providing inputs that exceed the expected memory and capacity constraints, attackers can overwhelm the system and cause it to become unresponsive.

  1. How does the vulnerability work?

The vulnerability arises when the make function is used to create slices from user-controlled sources with a size parameter that exceeds a certain threshold. This triggers excessive memory allocation, which can lead to a denial of service. Attackers exploit this vulnerability by providing inputs that go beyond the intended boundaries, overwhelming the system and rendering it unresponsive.

  1. What strategy do you use in your query to find the vulnerability?

The query searches for code patterns where the make function is used to create slices from user-controlled sources. It then checks if the provided size exceeds a specific threshold, indicating a potential vulnerability.

  1. How have you reduced the number of false positives?

To minimize false positives, the query includes specific criteria that exclude potential false positives. It verifies if a size comparison has been applied to the second parameter passed to the make function. This helps differentiate between legitimate instances and potentially vulnerable ones.

  1. Other information?

To reproduce the vulnerability, follow these steps:

  1. Clone the repository: git clone https://github.com/distribution/distribution
  2. Checkout the specific branch: git checkout -b v2.8.2-beta.1
  3. Generate the database.
  4. Run the query to identify potential vulnerabilities in the codebase.

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

  • Yes
  • No

Blog post link

No response

@Malayke Malayke added the All For One Submissions to the All for One, One for All bounty label Dec 18, 2023
@sylwia-budzynska sylwia-budzynska self-assigned this Dec 18, 2023
@sylwia-budzynska
Copy link

sylwia-budzynska commented Dec 18, 2023

Hello @Malayke 👋 could you provide a CodeQL database with the vulnerable version of the codebase, which contains the CVE?

@Malayke
Copy link
Author

Malayke commented Dec 18, 2023

Hi @sylwia-budzynska , this is the CodeQL database link of https://github.com/distribution/distribution vulnerable version

@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

@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Final decision.

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 Pay.

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

@xcorail
Copy link
Contributor

xcorail commented Mar 6, 2024

Hi @Malayke can you please provide a public email address, or send one to me privately?

@Malayke
Copy link
Author

Malayke commented Mar 7, 2024

Hi @xcorail I've already sent an email to your GitHub email address.

@xcorail
Copy link
Contributor

xcorail commented Mar 7, 2024

Created Hackerone report 2407167 for bounty 557823 : [809] [Go]: Query To Detect Denial Of Service Vulnerability

@xcorail xcorail closed this as completed Mar 7, 2024
@ghsecuritylab
Copy link
Collaborator

Your submission is now in status Closed.

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

4 participants