|
35 | 35 |
|
36 | 36 | Quark-Engine is also bundled with [Kali Linux](https://tools.kali.org/tools-listing), [BlackArch](https://blackarch.org/mobile.html).
|
37 | 37 | :shipit: A trust-worthy, practical tool that's ready to boost up your malware reverse engineering. <https://twitter.com/quarkengine>
|
38 |
| -# Quark Script - Ecosystem for Mobile Security Tools |
39 |
| -### Innovative & Interactive |
| 38 | + |
| 39 | +## Quark Script - Ecosystem for Mobile Security Tools |
| 40 | + |
| 41 | +#### Innovative & Interactive |
40 | 42 | The goal of Quark Script aims to provide an innovative way for mobile security researchers to analyze or pentest the targets.
|
41 | 43 |
|
42 | 44 | Based on Quark, we integrate decent tools as Quark Script APIs and make them exchange valuable intelligence to each other. This enables security researchers to __interact__ with staged results and perform __creative__ analysis with Quark Script.
|
43 | 45 |
|
44 |
| -### Dynamic & Static Analysis |
| 46 | +#### Dynamic & Static Analysis |
45 | 47 | In Quark script, we integrate not only static analysis tools (e.g. Quark itself) but also dynamic analysis tools (e.g. [objection](https://github.com/sensepost/objection)).
|
46 | 48 |
|
47 |
| -### Re-Usable & Sharable |
| 49 | +#### Re-Usable & Sharable |
48 | 50 | Once the user creates a Quark script for specific analysis scenario. The script can be used in another targets. Also, the script can be shared to other security researchers. This enables the exchange of knowledges.
|
49 | 51 |
|
50 |
| -### More APIs to come |
| 52 | +#### More APIs to come |
51 | 53 | Quark Script is now in a beta version. We'll keep releasing practical APIs and analysis scenarios.
|
52 | 54 |
|
53 |
| -## Introduce of Quark Script APIs |
| 55 | +### Introduce of Quark Script APIs |
| 56 | + |
| 57 | +<details> |
| 58 | +<summary><b> Rule(rule.json) </b></summary> |
| 59 | + |
| 60 | +<br> |
54 | 61 |
|
55 |
| -### Rule(rule.json) |
56 | 62 | * Description: Making detection rule a rule instance
|
57 | 63 | * params: Path of a single Quark rule
|
58 | 64 | * return: Quark rule instance
|
59 | 65 |
|
60 |
| -### runQuarkAnalysis(SAMPLE_PATH, ruleInstance) |
| 66 | +</details> |
| 67 | + |
| 68 | +<details> |
| 69 | +<summary><b> runQuarkAnalysis(SAMPLE_PATH, ruleInstance) </b></summary> |
| 70 | + |
| 71 | +<br> |
| 72 | + |
61 | 73 | * Description: Given detection rule and target sample, this instance runs the basic Quark analysis.
|
62 | 74 | * params: 1. Target file 2. Quark rule object
|
63 | 75 | * return: quarkResult instance
|
64 | 76 |
|
65 |
| -### quarkResultInstance.behaviorOccurList |
| 77 | +</details> |
| 78 | +<details> |
| 79 | +<summary><b> quarkResultInstance.behaviorOccurList </b></summary> |
| 80 | + |
| 81 | +<br> |
| 82 | + |
66 | 83 | * Description: List that stores instances of detected behavior in different part of the target file.
|
67 | 84 | * params: none
|
68 | 85 | * return: detected behavior instance
|
69 | 86 |
|
70 |
| -### behaviorInstance.firstAPI.fullName |
| 87 | +</details> |
| 88 | +<details> |
| 89 | +<summary><b> behaviorInstance.firstAPI.fullName </b></summary> |
| 90 | + |
| 91 | +<br> |
| 92 | + |
71 | 93 | * Description: Show the name of the first key API called in this behavior.
|
72 | 94 | * params: none
|
73 | 95 | * return: API name
|
74 | 96 |
|
75 |
| -### behaviorInstance.secondAPI.fullName |
| 97 | +</details> |
| 98 | +<details> |
| 99 | +<summary><b> behaviorInstance.secondAPI.fullName </b></summary> |
| 100 | + |
| 101 | +<br> |
| 102 | + |
76 | 103 | * Description: Show the name of the second key API called in this behavior.
|
77 | 104 | * params: none
|
78 | 105 | * return: API name
|
79 | 106 |
|
80 |
| -### behaviorInstance.hasUrl(none) |
| 107 | +</details> |
| 108 | +<details> |
| 109 | +<summary><b> behaviorInstance.hasUrl(none) </b></summary> |
| 110 | + |
| 111 | +<br> |
| 112 | + |
81 | 113 | * Description: Check if the behavior contains urls.
|
82 | 114 | * params: none
|
83 | 115 | * return: python list containing all detected urls.
|
84 | 116 |
|
85 |
| -### behaviorInstance.methodCaller |
| 117 | +</details> |
| 118 | +<details> |
| 119 | +<summary><b> behaviorInstance.methodCaller </b></summary> |
| 120 | + |
| 121 | +<br> |
| 122 | + |
86 | 123 | * Description: Find method who calls this behavior (API1 & API2).
|
87 | 124 | * params: none
|
88 | 125 | * return: method instance
|
89 | 126 |
|
90 |
| -### methodInstance.getXrefFrom(none) |
| 127 | +</details> |
| 128 | +<details> |
| 129 | +<summary><b> methodInstance.getXrefFrom(none) </b></summary> |
| 130 | + |
| 131 | +<br> |
| 132 | + |
91 | 133 | * Description: Find out who call this method.
|
92 | 134 | * params: none
|
93 | 135 | * return: python list containing caller methods.
|
94 | 136 |
|
95 |
| -### methodInstance.getXrefTo(none) |
| 137 | +</details> |
| 138 | +<details> |
| 139 | +<summary><b> methodInstance.getXrefTo(none) </b></summary> |
| 140 | + |
| 141 | +<br> |
| 142 | + |
96 | 143 | * Description: Find out who this method called.
|
97 | 144 | * params: none
|
98 | 145 | * return: python list containing tuples (callee methods, index).
|
99 | 146 |
|
100 |
| -### Objection(none) |
| 147 | +</details> |
| 148 | +<details> |
| 149 | +<summary><b> Objection(none) </b></summary> |
| 150 | + |
| 151 | +<br> |
| 152 | + |
101 | 153 | * Description: Create an instance for Objection (dynamic analysis tool).
|
102 | 154 | * params: Monitoring IP:port
|
103 | 155 | * return: objection instance
|
104 | 156 |
|
105 |
| -### objInstance.hookMethod(method, watchArgs, watchBacktrace, watchRet) |
| 157 | +</details> |
| 158 | +<details> |
| 159 | +<summary><b> objInstance.hookMethod(method, watchArgs, watchBacktrace, watchRet) </b></summary> |
| 160 | + |
| 161 | +<br> |
| 162 | + |
106 | 163 | * Description: Hook the target method with Objection.
|
107 | 164 | * params: 1. method: the tagrget API. (type: str or method instance) 2. watchArgs: Return Args information if True. (type: boolean) 3. watchBacktrace: Return backtrace information if True. (type: boolean) 4. watchRet: Return the return information of the target API if True (type: boolean).
|
108 | 165 | * return: none
|
109 | 166 |
|
110 |
| -## Analyzing real case (InstaStealer) using Quark Script |
| 167 | +</details> |
| 168 | + |
| 169 | +### Analyzing real case (InstaStealer) using Quark Script |
111 | 170 |
|
112 |
| -### Quark Script that dynamic hooks the method containing urls |
| 171 | +#### Quark Script that dynamic hooks the method containing urls |
113 | 172 | The scenario is simple! We'd like to dynamic hooking the methods in the malware that contains urls. We can use APIs above to write Quark Script.
|
114 | 173 |
|
115 | 174 | ```python
|
@@ -164,13 +223,13 @@ print("\nSee the hook results in Objection's terminal.")
|
164 | 223 | > 3. Or a rooted Android Device (Google Pixel 6) with frida installed.\
|
165 | 224 | Check the root guideline [here](https://forum.xda-developers.com/t/guide-root-pixel-6-with-magisk-android-12-1.4388733/), frida install guideline is the [same](https://frida.re/docs/android/) with Android Virtual Machine.
|
166 | 225 |
|
167 |
| -### Quark Script Result |
| 226 | +#### Quark Script Result |
168 | 227 | 
|
169 | 228 |
|
170 |
| -### Logs on the Objection terminal (hooking) |
| 229 | +#### Logs on the Objection terminal (hooking) |
171 | 230 | 
|
172 | 231 |
|
173 |
| -### Method (callComponentMethod) with urls is detected triggered! |
| 232 | +#### Method (callComponentMethod) with urls is detected triggered! |
174 | 233 | 
|
175 | 234 |
|
176 | 235 | ## Quark Web Report
|
|
0 commit comments