-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Java : add query to detect insecure loading of Dex File #4947
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
Out of interest, did you bughunt using this query? |
@intrigus-lgtm I found two issues through fuzzy search. |
Nice, but I meant bughunt in the sense of "The Bug Slayer" bounty. |
@intrigus-lgtm I don't have access to LGTM. So couldn't run it across all of Github. |
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qll
Outdated
Show resolved
Hide resolved
Your description talks about file permissions, but the implementation checks whether the apk file is on an external drive instead? |
@smowton Since the file permissions are controlled by the OS, and a SD Card is a removable device, a malicious actor can simply modify the content on the SD card to his pleasure. Hence, an external SD card is considered a world readable/writable storage device on Android platforms. |
Sure, then the query description should be explicit about what you're actually checking |
Hadn't realised the ball was back in my court here. Is there a bounty ticket for this one? |
@smowton I think the bounty ticket for this one is: |
Thanks, starting an evaluation and passing to seclab to review the results |
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qll
Outdated
Show resolved
Hide resolved
@pwntester @smowton I have added a few more sinks and some taint flow steps. PTAL. |
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qll
Outdated
Show resolved
Hide resolved
@smowton Changes done! |
Waiting for final review on this one |
QHelp is missing. There's an example code snippet ( |
|
@aschackmull Changes Done! |
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qhelp
Outdated
Show resolved
Hide resolved
@intrigus-lgtm changes done. I have also rebased it to the latest main |
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qhelp
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.ql
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoading.qll
Outdated
Show resolved
Hide resolved
java/ql/src/experimental/Security/CWE/CWE-094/InsecureDexLoadingBad.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.
@smowton changes done!
Co-authored-by: Chris Smowton <smowton@github.com>
Loading a DEX library located in a world-readable/ writable directory can cause arbitary code execution vulnerabilities.
This query detects instances where a dexfile from a world readable/writable directory is loaded by the app. Since anyone can write into a world writable directory, the attacker may create a new apk/dex package with the target name and have the application load and execute malicious code.