Update document for Quark Script CWE-749#383
Merged
haeter525 merged 5 commits intoSep 20, 2022
Merged
Conversation
Codecov ReportBase: 77.92% // Head: 77.92% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #383 +/- ##
=======================================
Coverage 77.92% 77.92%
=======================================
Files 62 62
Lines 4629 4629
=======================================
Hits 3607 3607
Misses 1022 1022
Flags with carried forward coverage won't be shown. Click here to find out more. Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
bbdca84 to
ce2781b
Compare
fbfe51d to
78cb321
Compare
Member
|
The script LGTM! |
2481a1f to
6c13531
Compare
Member
|
Thanks for the great work. @haeter525 please help me merge this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CWE-749 Documentaion
API Spec
methodInstance.getArguments(none)
Detect CWE-749 in Android Application (MSTG-Android-Java.apk)
This scenario seeks to find exposed methods or functions in the APK file. See CWE-749 for more details.
Let's use this APK and the above APIs to show how Quark script find this vulnerability.
First, we design a detection rule
configureJsExecution.jsonto spot on behavior using methodsetJavascriptEnabled. Then, we use APImethodInstance.getArgumentsto check if it enables JavaScript execution on websites. Finally, we look for calls to methodaddJavaScriptInterfacein the caller method. If yes, the APK exposes methods or functions to websites. That causes CWE-749 vulnerability.Quark Script CWE-749.py
configureJsExecution.json
{ "crime": "Configure JavaScript execution on websites", "permission": [], "api": [ { "class": "Landroid/webkit/WebView;", "method": "getSettings", "descriptor": "()Landroid/webkit/WebSettings;" }, { "class": "Landroid/webkit/WebSettings;", "method": "setJavaScriptEnabled", "descriptor": "(Z)V" } ], "score": 1, "label": [] }Quark Script Result