-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Java: Add query for improper webview certificate validation #9663
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: Add query for improper webview certificate validation #9663
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some quick comments, I'll do a more detailed review later.
java/ql/lib/semmle/code/java/security/AndroidWebViewCertificateValidationQuery.qll
Outdated
Show resolved
Hide resolved
java/ql/lib/semmle/code/java/security/AndroidWebViewCertificateValidationQuery.qll
Outdated
Show resolved
Hide resolved
java/ql/src/Security/CWE/CWE-295/ImproperWebViewCertifiacteValidation.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/Security/CWE/CWE-295/ImproperWebViewCertificateValidation.ql
Outdated
Show resolved
Hide resolved
java/ql/src/change-notes/2022-06-22-improper-webview-certificate-validation.md
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go for a performance evaluation and LGTM run for FP ratio. But otherwise looks good to me, just added a minor suggestion.
java/ql/src/Security/CWE/CWE-295/ImproperWebViewCertificateValidation.qhelp
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joefarebrother 👋🏻 - I carried out an editorial review and this LGTM ✨
Just a couple of clarifying comments.
@@ -0,0 +1,18 @@ | |||
/** | |||
* @name Android `WebView` that accepts all certificates | |||
* @description Trusting all certificates allows an attacker to perform a machine-in-the-middle attack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, commenting here to check that machine-in-the-middle attack
is a thing (I've only ever heard of man-in-the-middle
attacks 🙊 ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be man-in-the-middle, thanks
Edit In fact both names are accepted, but I'll go with man-in-the-middle as it's the more common name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought you used machine-in-the-middle
as a gender-neutral term :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact I copied it from another file. But that reasoning makes sense; I'll keep it as machine then
<overview> | ||
<p> | ||
If the <code>onReceivedSslError</code> method of an Android <code>WebViewClient</code> always calls <code>proceed</code> on the given <code>SslErrorHandler</code>, it trusts any certificate. | ||
This allows an attacker to perform a machine-in-the-middle attack against the application, therefore breaking any security Transport Layer Security (TLS) gives. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as on the ql file (double-checking)
(gender-neutral language) This reverts commit d5ab330.
0c9dfb0
to
dd83c17
Compare
Is this ready to merge? @atorralba |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code and LGTM results look good to me. If DCA is happy, I think we can merge! :)
This query finds implentations of
WebViewClient.onRecievedSslError
that unconditionaly callSslErrorHandler.proceed
and thus accept all certificates.