-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Java: Sensitive broadcast #4512
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
Conversation
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
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.
Looks like a good idea, but we should use dataflow to track how intents acquire taint, rather than hard-code the structure of the put*Extra
steps.
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.java
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.java
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
Thanks @smowton for all the suggestions and I've revamped the query to address all of them. Now the query is much cleaner and more elegant, please let me know if more changes are required. |
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
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.
This is looking much better now it's phrased using dataflow -- just some smaller things to fix and the testsuite should be expanded a bit to make sure you're covering the whole query.
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
java/ql/test/experimental/query-tests/security/CWE-927/SensitiveBroadcast.java
Show resolved
Hide resolved
java/ql/test/experimental/query-tests/security/CWE-927/SensitiveBroadcast.java
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
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.
One more test case to add -- how about getExtras().putString(...)
? As this query is phrased I don't think that'll work, but it's a little tricky to phrase. Feel free to mark that case BAD (but not yet detected); again this is testing things just outside what the query is capable of to help future authors.
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
@smowton As per your suggestion, I've added one more test case Thanks for all your help with this PR. |
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.
Make sure SensitiveInfoLog.ql's behaviour is unchanged, otherwise LGTM
java/ql/src/experimental/Security/CWE/CWE-532/SensitiveInfoLog.ql
Outdated
Show resolved
Hide resolved
Suggestion from seclab review: the |
@smowton Sorry for the confusion. I've removed the newly added |
Or I can remove |
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 think this is good as it stands now -- just waiting for @github/codeql-java to weigh in as the code owners.
Thanks @smowton for all your help with this PR. |
java/ql/test/experimental/query-tests/security/CWE-927/SensitiveBroadcast.java
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.
Done (but still pending code-owner review)
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.
Qhelp could use a few more references, otherwise LGTM.
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.ql
Outdated
Show resolved
Hide resolved
Oh, and we need to autoformat:
|
Sorry that I forgot to autoformat |
java/ql/src/experimental/Security/CWE/CWE-927/SensitiveBroadcast.qhelp
Outdated
Show resolved
Hide resolved
…st.qhelp Co-authored-by: Marcono1234 <Marcono1234@users.noreply.github.com>
This PR is to address CWE-927 "Use of Implicit Intent for Sensitive Communication".
Vulnerable Android applications use an implicit intent for transmitting sensitive data to other applications. Since an implicit intent does not specify a particular application to receive the data, any application can process the intent by using an Intent Filter for that intent. This can allow untrusted applications to obtain sensitive data.
Query in this PR detects the following patterns:
Please consider to merge the PR. Thanks.