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

Weak Hashing findings vanished from 1.1.11 ruleset? #18518

Open
davewichers opened this issue Jan 16, 2025 · 5 comments
Open

Weak Hashing findings vanished from 1.1.11 ruleset? #18518

davewichers opened this issue Jan 16, 2025 · 5 comments
Labels
question Further information is requested

Comments

@davewichers
Copy link

I maintain the OWASP Benchmark project:

Which is a test suite for testing the effectiveness of software security analysis tools. I've had codeQL scripts for scanning OWASP Benchmark for a while.

They can be found in the scripts folder here: https://github.com/OWASP-Benchmark/BenchmarkJava/tree/master/scripts

  • translateCodeQL.sh
  • runCodeQL.sh

You have to follow the codeQL install instructions listed in the translateCodeQL.sh script, then run translateCodeQL.sh and then runCodeQL.sh.

After completing, it puts the codeQL SARIF results file into the results/ folder and you can then score the tool against Benchmark by running createScoreards.sh.

I noticed that when using the latest version of CodeQL 2.20.1, with the 1.1.9 ruleset, it properly detected 69% of the Weak Hashing test cases in Benchmark (and had zero false positives). But when I upgraded to ruleset 1.1.11, it now detects none of them.

Is this on purpose? Or was a bug introduced. or mistake made, to cause those rules to go away in 1.1.11?

@davewichers davewichers added the question Further information is requested label Jan 16, 2025
@redsun82
Copy link
Contributor

Hey @davewichers, thanks a lot for reaching out with this! I'll circle this back to our internal team responsible for Java analysis 👍

@redsun82
Copy link
Contributor

Hey @davewichers, as reported in this change note, we recently removed reporting of MD5 and SHA1 hashing from the java/weak-cryptographic-algorithm to the less precise java/potentially-weak-cryptographic-algorithm, as the former was alerting on too many cases of legitimate non cryptographic usages of those hashes. Maybe you can switch to using that query instead in your benchmarking?

@davewichers
Copy link
Author

@redsun82 - the codeQL documentation related to finding out which rulepacks exist and how to use them is super confusing. Where is the list of ALL the published codeql rulepacks? I only found: codeql\java-queries and codeql\java-all, but when I try to use java-all, it says 'this is a library and does not contain queries to run'. I want to use ALL the codeQL java rules in my run. How do I do that?

@redsun82
Copy link
Contributor

Hi @davewichers, the concept of a set of queries is captured by "query suites":

I heard back from the team, and they advise to use the java-security-extended suite for the benchmark. To do so, you should provide java-security-extended or java-security-extended.qls as second positional argument to codeql database analyze. If you download the latest release for the full codeql bundle, that will be included together with precompiled queries which will make the command run faster. You can however also run the queries from a checkout of codeql, provided you give the right --search-path.

Where is the list of ALL the published codeql rulepacks?

Probably the best way to get that list is to run

codeql resolve queries

This will list all query suites with their .qls extension. The query suite argument to codeql database analyze can be provided either with or without that extension.

I'm sorry if you found the documentation lacking, we will try to make it better! 🙌

@davewichers
Copy link
Author

davewichers commented Jan 22, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants