Sitelet https://web.archive.org/web/20240604110441/https://github.com/github/codeql/pull/3720
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

Java: SSRF query #3720

Closed
wants to merge 2 commits into from
Closed

Java: SSRF query #3720

wants to merge 2 commits into from

Conversation

luchua-bc
Copy link
Contributor

@luchua-bc luchua-bc commented Jun 15, 2020 •

Server Side Request Forgery (SSRF) is an attack vector that abuses an application to interact with the internal/external network or the machine itself, frequently through the attack vector of URL mishandling.

In an SSRF attack, the attacker can abuse functionality on the server to read or update internal resources, e.g. cloud server meta-data, internal REST interface, and protected files.

This query detects the following two scenarios:

  • Java networking uri.openConnection() and its derived uri.openStream(), which is a shorthand for openConnection().getInputStream(), from remote source
  • Apache HTTPRequest constructed from remote source

There are two existing queries in the CodeQL repository that handle two important/specific cases of this vulnerability category:

  • CWE-319 for cleartext HTTP connection
  • CWE-036 for the special case of openConnection().getInputStream() leading to local file disclosure

Thus this query has a broader scope and also covers the frequently used Apache HTTP library.

Please consider to merge the PR. Thanks.

@luchua-bc luchua-bc requested a review from a team as a code owner June 15, 2020 16:29
@luchua-bc luchua-bc changed the title SSRF query Java: SSRF query Jun 16, 2020
Copy link
Contributor

@Marcono1234 Marcono1234 left a comment

Choose a reason for hiding this comment

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

Is there already a sanitizer check to prevent the query matching the 'GOOD' cases as well?

java/ql/src/experimental/Security/CWE/CWE-918/SSRF.qhelp Outdated Show resolved Hide resolved
java/ql/src/experimental/Security/CWE/CWE-918/SSRF.qhelp Outdated Show resolved Hide resolved
@adityasharad adityasharad changed the base branch from master to main August 14, 2020 18:34
@smowton smowton self-assigned this Oct 13, 2020
@smowton
Copy link
Contributor

smowton commented Oct 14, 2020

Hello, apologies for our slow response on this: we've been backlogged with requests and are just now clearing the queue.

Because this PR has the same topic as #3454 but was both submitted later and has a smaller feature-set (e.g., the other PR supports a broader range of HTTP client libraries), I'm sorry to say we can't accept this submission.

If you are able to improve upon that PR, please do submit changes based on top of that branch, and we will be happy to assess their contribution relative to the baseline.

@smowton smowton closed this Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants