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
[C#] CWE-759: Query to detect password hash without a salt #233
Comments
|
Your submission is now in status SecLab review. For information, the evaluation workflow is the following: |
|
Some FP: Not sure if all FP can be eliminated, because the sink is hashing function, but the hash can be mixed with the salt later. Some additional possible sinks: |
|
Thanks @JarLob for the suggestions. The C# query seems to have the same issue of wrapper method calls similar to the Java query #4920. It turned out to be pretty complex to model the call stack correctly. However, addressing one will help to address the other. I will work on this one once the issue with the Java one is resolved. |
|
@JarLob I've revamped the query to handle more cases. Now ALL FPs with listed sample projects are eliminated:-) A lot of changes have been made after extensive testing. Now the query is much more comprehensive and powerful. I will add additional sinks as a separate commit, which will probably be done tomorrow. And please let me know if more scenarios could be covered. |
|
Great, lets wait for the new sinks and have a new LGTM run then. |
|
@JarLob I've committed the change of adding new sinks. As TransformFinalBlock/TransformBlock does byte array manipulation, I'm afraid it may have a higher rate of FPs. Also it already makes the password hash harder to guess therefore I didn't include it. Please let me know if you still want to add it. Please review. Thanks, |
|
I have started a new LGTM run and will get back to you. |
|
Your submission is now in status CodeQL review. For information, the evaluation workflow is the following: |
|
Your submission is now in status SecLab review. For information, the evaluation workflow is the following: |
|
Your submission is now in status FP Check. For information, the evaluation workflow is the following: |
|
Hi @luchua-bc, Unfortunately the query produces too many FPs: The FP ratio needs to be reduced before the query could be accepted. |
|
Hi @JarLob, Thanks for reviewing the PR. The jellyfin/jellyfin doesn't seem to be FP since it allows hashing without salt (empty array) in the following call stack: And for Wndrr/HaveIBeenPwned, it doesn't seem to be FP either since the processing is encoding instead of salting: Please let me know if they are actually FPs in case I miss something. For the other 6 projects, the hash is pre-joined with a salt, serves as inputs for further processing, or isn't a password. I will improve the query to reduce FPs. |
|
In case of jellyfin it falls under the |
|
One more FP: neo-project/neo |
|
The NEO project (neo-project/neo) just hashes a password twice without using a salt so it's not a FP for this check of password hash without salt in my opinion: However, the change I'm going to make shall address this issue, which is the scenario of serving as inputs for further processing and is one of the three enhanced scenarios that the query will handle. |
|
It adds salt and hashes it again in the calling function like |
|
You are right. This will be handled in third scenario of serving as inputs for further processing. |
|
I've modified the query to check those scenarios. Basically those repositories either use the password as the hash or salt to generate hashes of other pieces of information, or further process after a password hash is generated without a salt. Now the results are much cleaner. Please validate. Thanks. |
|
Your submission is now in status CodeQL review. For information, the evaluation workflow is the following: |
|
Hi @JarLob, I'm wondering whether there is an update since the PR has been in the "CodeQL review" status for several months. Would you please investigate when you have a chance? Thanks, |
|
@ghsecuritylab It has been several months without any movement on this PR. It would be greatly appreciated if its status could be checked. Thanks in advance. |
|
Thanks for the help from @hvitved, the relevant PR has been approved and merged into main. Would you please help to move this submission to the next status stage? Thanks. |
|
@xcorail - would you please have its status updated and close this PR as well? It's an old submission so it doesn't have the new review stages/gates but it's been approved for almost 4 weeks. Thanks. |
|
Your submission is now in status Final decision. For information, the evaluation workflow is the following: |
|
Your submission is now in status Pay. For information, the evaluation workflow is the following: |
|
Your submission is now in status Closed. For information, the evaluation workflow is the following: |
|
Created Hackerone report 1484086 for bounty 369630 : [233] [C#] CWE-759: Query to detect password hash without a salt Apologies about the delay @luchua-bc |
|
Thanks @xcorail a lot for the quick turn-around and the bounty:-) |
luchua-bc commentedJan 13, 2021
CVE ID(s)
List the CVE ID(s) associated with this vulnerability. GitHub will automatically link CVE IDs to the GitHub Advisory Database.
Report
Describe the vulnerability. Provide any information you think will help GitHub assess the impact your query has on the open source community.
In cryptography, a salt is some random data used as an additional input to a one-way function that hashes a password or pass-phrase. It makes dictionary attacks more difficult.
Without a salt, it is much easier for attackers to pre-compute the hash value using dictionary attack techniques such as rainbow tables to crack passwords.
This type of vulnerabilities is categorized as CWE-759 "Use of a One-Way Hash without a Salt". This query detects issues of this type.
Relevant PR - #4949
Result(s)
Provide at least one useful result found by your query, on some revision of a real project.
The text was updated successfully, but these errors were encountered: