-
Notifications
You must be signed in to change notification settings - Fork 14
Optimize the document of Quark Script CWE-312 and CWE-798 and fix the run-on version of Ubuntu to 22.04 #48
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
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.
We could remove CWE-312/agent.js since it's an empty file. What do you think?
That sounds great. |
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.
LGTM. Thank @JerryTasi.
mv -vn $GITHUB_WORKSPACE/CWE-*/*.js test_ground/
This reverts commit f0db960.
runs-on: ubuntu-22.04
Delete CWE-312/agent.js
mv -vn $GITHUB_WORKSPACE/CWE-*/*.js test_ground/
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.
LGTM. Thank @JerryTasi.
Detect CWE-312 in Android Application
This scenario seeks to find cleartext storage of sensitive data in the APK file.
CWE-312: Cleartext Storage of Sensitive Information
We analyze the definition of CWE-312 and identify its characteristics.
See CWE-312 for more details.
Code of CWE-312 in ovaa.apk
We use the ovaa.apk sample to explain the vulnerability code of CWE-312.
CWE-312 Detection Process Using Quark Script API
Let’s use the above APIs to show how the Quark script finds this vulnerability.
We have designed a Frida script
agent.js
to hook a specified method and get the arguments when the method is called. It can be found in quark-engine/quark/script/frida.To begin with, we hook the method
putString
to catch its arguments. Then, we check if sensitive information like email or password is passed. Finally, we usecheckClearText
imported from Ares to check if the arguments are cleartext. If both YES, CWE-312 vulnerability might be caused.Quark Script: CWE-312.py
Frida Script: agent.js
Quark Script Result
Detect CWE-798 in Android Application
This scenario seeks to find hard-coded credentials in the APK file.
CWE-798: Use of Hard-coded Credentials
We analyze the definition of CWE-798 and identify its characteristics.
See CWE-798 for more details.
Code of CWE-798 in ovaa.apk
We use the ovaa.apk sample to explain the vulnerability code of CWE-798.
CWE-798 Detection Process Using Quark Script API
Let’s use the above APIs to show how the Quark script finds this vulnerability.
First, we design a detection rule
findSecretKeySpec.json
to spot on behavior using the constructorSecretKeySpec
. Second, we get all the parameter values from this constructor. Then, we parse the AES key from the parameter values. Finally, we check if the AES key is hardcoded in the APK file. If the answer is YES, BINGO!!! We find hard-coded credentials in the APK file.Quark Script: CWE-798.py
Quark Rule: findSecretKeySpec.json
Quark Script Result