Open HaleenUptain opened 1 year ago
Hey @HaleenUptain, thanks for letting us know about this FP! After review, it looks like you're right: we're flagging the use of the string ECB
in cryptographic algorithms as problematic, but we fail to check whether it co-occurs with RSA
.
We're going to track this internally and fix the issue, together with considering your suggestions about the recommendations and fix examples, when we have capacity for it.
Thanks again!
I just read this https://crypto.stackexchange.com/a/26539 and for me knowing very little about cryptography then it does seem like this is not insecure.
You could still argue that it is far better to write RSA/none/OAEPWITHSHA-512ANDMGF1PADDING
instead of RSA/ECB/OAEPWITHSHA-512ANDMGF1PADDING
: So the change could be to remove this from the two existing alerts and then create a new alert suggesting to change the MODE_OF_OPERATION
to none
in case of RSA
: Because that is what is implicitly done. I do not have enough experience with the design of alerts to know if that would be a very low severity alert?
Description of the false positive
CodeQL is generating false positive alerts on Java applications that implement RSA cryptography securely. It is risky for Developers to get in the habit of just “Dismissing Alerts”. Instead, I would rather work with the GHAS Engineering team so the CodeQL scanner is continuously improved to better recognize and handle correctly without generating these alerts in the first place.
Code samples or links to source code
Not only does this code generate "Use of a broken or risky cryptographic algorithm" and "Use of a potentially broken or risky cryptographic algorithm" false positive alerts, examples on how to implement Java using RSA algorithm with recommended padding scheme is missing from these two alert recommendations. In addition to eliminating these two false positives, adding this Java RSA example to these two alert recommendations would be helpful.