anais-apk-forensic 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +249 -0
- package/anais.sh +669 -0
- package/analysis_tools/__pycache__/apk_basic_info.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/apk_basic_info.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/check_zip_encryption.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/check_zip_encryption.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/detect_obfuscation.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/detect_obfuscation.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/dex_payload_hunter.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/entropy_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/error_logger.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/error_logger.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/find_encrypted_payload.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/fix_apk_headers.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/fix_apk_headers.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/manifest_analyzer.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/manifest_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/network_analyzer.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/network_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/report_generator.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/report_generator.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/report_generator_modular.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/sast_scanner.cpython-313.pyc +0 -0
- package/analysis_tools/__pycache__/sast_scanner.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/so_string_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/yara_enhanced_analyzer.cpython-314.pyc +0 -0
- package/analysis_tools/__pycache__/yara_results_processor.cpython-314.pyc +0 -0
- package/analysis_tools/apk_basic_info.py +85 -0
- package/analysis_tools/check_zip_encryption.py +142 -0
- package/analysis_tools/detect_obfuscation.py +650 -0
- package/analysis_tools/dex_payload_hunter.py +734 -0
- package/analysis_tools/entropy_analyzer.py +335 -0
- package/analysis_tools/error_logger.py +75 -0
- package/analysis_tools/find_encrypted_payload.py +485 -0
- package/analysis_tools/fix_apk_headers.py +154 -0
- package/analysis_tools/manifest_analyzer.py +214 -0
- package/analysis_tools/network_analyzer.py +287 -0
- package/analysis_tools/report_generator.py +506 -0
- package/analysis_tools/report_generator_modular.py +885 -0
- package/analysis_tools/sast_scanner.py +412 -0
- package/analysis_tools/so_string_analyzer.py +406 -0
- package/analysis_tools/yara_enhanced_analyzer.py +330 -0
- package/analysis_tools/yara_results_processor.py +368 -0
- package/analyzer_config.json +113 -0
- package/apkid/__init__.py +32 -0
- package/apkid/__pycache__/__init__.cpython-313.pyc +0 -0
- package/apkid/__pycache__/__init__.cpython-314.pyc +0 -0
- package/apkid/__pycache__/apkid.cpython-313.pyc +0 -0
- package/apkid/__pycache__/apkid.cpython-314.pyc +0 -0
- package/apkid/__pycache__/main.cpython-313.pyc +0 -0
- package/apkid/__pycache__/main.cpython-314.pyc +0 -0
- package/apkid/__pycache__/output.cpython-313.pyc +0 -0
- package/apkid/__pycache__/rules.cpython-313.pyc +0 -0
- package/apkid/apkid.py +266 -0
- package/apkid/main.py +98 -0
- package/apkid/output.py +177 -0
- package/apkid/rules/apk/common.yara +68 -0
- package/apkid/rules/apk/obfuscators.yara +118 -0
- package/apkid/rules/apk/packers.yara +1197 -0
- package/apkid/rules/apk/protectors.yara +301 -0
- package/apkid/rules/dex/abnormal.yara +104 -0
- package/apkid/rules/dex/anti-vm.yara +568 -0
- package/apkid/rules/dex/common.yara +60 -0
- package/apkid/rules/dex/compilers.yara +434 -0
- package/apkid/rules/dex/obfuscators.yara +602 -0
- package/apkid/rules/dex/packers.yara +761 -0
- package/apkid/rules/dex/protectors.yara +520 -0
- package/apkid/rules/dll/common.yara +38 -0
- package/apkid/rules/dll/obfuscators.yara +43 -0
- package/apkid/rules/elf/anti-vm.yara +43 -0
- package/apkid/rules/elf/common.yara +54 -0
- package/apkid/rules/elf/obfuscators.yara +991 -0
- package/apkid/rules/elf/packers.yara +1128 -0
- package/apkid/rules/elf/protectors.yara +794 -0
- package/apkid/rules/res/common.yara +43 -0
- package/apkid/rules/res/obfuscators.yara +46 -0
- package/apkid/rules/res/protectors.yara +46 -0
- package/apkid/rules.py +77 -0
- package/bin/anais +3 -0
- package/dist/cli.js +82 -0
- package/dist/index.js +123 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/index.js +21 -0
- package/dist/utils/output.js +44 -0
- package/dist/utils/paths.js +107 -0
- package/docs/ARCHITECTURE.txt +353 -0
- package/docs/Workflow and Reference.md +445 -0
- package/package.json +70 -0
- package/rules/yara_general_rules.yar +323 -0
- package/scripts/dynamic_analysis_helper.sh +334 -0
- package/scripts/frida/dpt_dex_dumper.js +145 -0
- package/scripts/frida/frida_dex_dump.js +145 -0
- package/scripts/frida/frida_hooks.js +437 -0
- package/scripts/frida/frida_websocket_extractor.js +154 -0
- package/scripts/setup.sh +206 -0
- package/scripts/validate_framework.sh +224 -0
- package/src/cli.ts +91 -0
- package/src/index.ts +123 -0
- package/src/types/index.ts +44 -0
- package/src/utils/index.ts +6 -0
- package/src/utils/output.ts +50 -0
- package/src/utils/paths.ts +72 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2023 RedNaga. https://rednaga.io
|
|
3
|
+
* All rights reserved. Contact: rednaga@protonmail.com
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* This file is part of APKiD
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* Commercial License Usage
|
|
10
|
+
* ------------------------
|
|
11
|
+
* Licensees holding valid commercial APKiD licenses may use this file
|
|
12
|
+
* in accordance with the commercial license agreement provided with the
|
|
13
|
+
* Software or, alternatively, in accordance with the terms contained in
|
|
14
|
+
* a written agreement between you and RedNaga.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* GNU General Public License Usage
|
|
18
|
+
* --------------------------------
|
|
19
|
+
* Alternatively, this file may be used under the terms of the GNU General
|
|
20
|
+
* Public License version 3.0 as published by the Free Software Foundation
|
|
21
|
+
* and appearing in the file LICENSE.GPL included in the packaging of this
|
|
22
|
+
* file. Please visit http://www.gnu.org/copyleft/gpl.html and review the
|
|
23
|
+
* information to ensure the GNU General Public License version 3.0
|
|
24
|
+
* requirements will be met.
|
|
25
|
+
*
|
|
26
|
+
**/
|
|
27
|
+
|
|
28
|
+
include "common.yara"
|
|
29
|
+
|
|
30
|
+
rule verimatrix : protector
|
|
31
|
+
{
|
|
32
|
+
meta:
|
|
33
|
+
description = "InsideSecure Verimatrix"
|
|
34
|
+
url = "https://www.verimatrix.com/solutions/code-protection"
|
|
35
|
+
sample = "fdd6b324a267cb5287550b1ab2c7e527ad49b5ed4f4542abbc4fb5e8e2c00d3f"
|
|
36
|
+
author = "Eduardo Novella"
|
|
37
|
+
|
|
38
|
+
strings:
|
|
39
|
+
$libname = /lib\/(arm.*|x86.*)\/libmfjava\.so/
|
|
40
|
+
|
|
41
|
+
condition:
|
|
42
|
+
is_apk and $libname
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
rule virbox_apk : protector
|
|
46
|
+
{
|
|
47
|
+
meta:
|
|
48
|
+
description = "Virbox"
|
|
49
|
+
url = "https://shell.virbox.com"
|
|
50
|
+
sample = "b1a5d9d4c1916a0acc2d5c3b7c811a39ebeb2f6d42b305036473f7053bbf5fe7"
|
|
51
|
+
author = "Eduardo Novella"
|
|
52
|
+
|
|
53
|
+
strings:
|
|
54
|
+
$libs1 = "libsandhook.so"
|
|
55
|
+
$libs2 = "libsandhook-native.so"
|
|
56
|
+
$libv1 = "libv++_64.so"
|
|
57
|
+
$libv2 = "libv++.so"
|
|
58
|
+
|
|
59
|
+
condition:
|
|
60
|
+
is_apk and
|
|
61
|
+
1 of ($libs*) and
|
|
62
|
+
1 of ($libv*)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
rule vkey_apk : protector
|
|
66
|
+
{
|
|
67
|
+
meta:
|
|
68
|
+
description = "Vkey (V-OS App Protection)"
|
|
69
|
+
url = "https://www.v-key.com/products/v-os-app-protection/"
|
|
70
|
+
author = "Eduardo Novella"
|
|
71
|
+
sample = "eb7f7fd8b23ea2b55504b2d22dd6ee7a1214d822a79e848badcf720359ee78d1"
|
|
72
|
+
|
|
73
|
+
strings:
|
|
74
|
+
$lib1 = /lib\/(x86\_64|armeabi\-v7a|arm64\-v8a|x86)\/libvosWrapperEx\.so/
|
|
75
|
+
$lib2 = /lib\/(x86\_64|armeabi\-v7a|arm64\-v8a|x86)\/libvtap\.so/
|
|
76
|
+
$lib3 = /lib\/(x86\_64|armeabi\-v7a|arm64\-v8a|x86)\/libloadTA\.so/
|
|
77
|
+
$lib4 = /lib\/(x86\_64|armeabi\-v7a|arm64\-v8a|x86)\/libchecks\.so/
|
|
78
|
+
$asseta1 = "assets/firmware"
|
|
79
|
+
$asseta2 = "assets/kernel.bin"
|
|
80
|
+
$asseta3 = "assets/signature"
|
|
81
|
+
$assetb1 = "assets/vkeylicensepack"
|
|
82
|
+
$assetb2 = "assets/vkwbc_ta.bin"
|
|
83
|
+
$assetb3 = "assets/voscodesign.vky"
|
|
84
|
+
|
|
85
|
+
condition:
|
|
86
|
+
is_apk and
|
|
87
|
+
2 of ($lib*) and
|
|
88
|
+
1 of ($asseta*) and
|
|
89
|
+
1 of ($assetb*)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
rule free_rasp_old : protector
|
|
93
|
+
{
|
|
94
|
+
meta:
|
|
95
|
+
description = "FreeRASP"
|
|
96
|
+
url = "https://www.talsec.app/freerasp-in-app-protection-security-talsec"
|
|
97
|
+
sample = "e10b8772fd9b6aaf8ba030c5bcb324fb9b91f34e893a62bdf238629df856e047"
|
|
98
|
+
author = "Fare9"
|
|
99
|
+
|
|
100
|
+
strings:
|
|
101
|
+
$lib1 = /lib\/(arm.*|x86.*)\/libsecurity\.so/
|
|
102
|
+
$lib2 = /lib\/(arm.*|x86.*)\/libpolarssl\.so/
|
|
103
|
+
|
|
104
|
+
condition:
|
|
105
|
+
is_apk and all of them
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
rule ahnlab_v3_engine : protector
|
|
109
|
+
{
|
|
110
|
+
meta:
|
|
111
|
+
description = "Ahnlab V3 engine"
|
|
112
|
+
url = "https://www.ahnlab.com/en"
|
|
113
|
+
author = "whoa-mi"
|
|
114
|
+
sample = "638bad9c6336049f43ac88d7db65c743d9703d732f86f2dc094999b195d63aa2"
|
|
115
|
+
|
|
116
|
+
strings:
|
|
117
|
+
$binary1 = /lib\/(arm|x86).*\/libEngineManager\.so/
|
|
118
|
+
$binary2 = /assets\/ahnlab\/engine\/(arm|x86).*\/lib(rc|av)engine/
|
|
119
|
+
$binary3 = "assets/ahnlab/engine/rootchecker2.rcd"
|
|
120
|
+
|
|
121
|
+
condition:
|
|
122
|
+
is_apk and 2 of ($binary*)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
rule free_rasp_new : protector
|
|
126
|
+
{
|
|
127
|
+
meta:
|
|
128
|
+
description = "FreeRASP"
|
|
129
|
+
url = "https://www.talsec.app/freerasp-in-app-protection-security-talsec"
|
|
130
|
+
sample = "2b8faa038bf34474075a56e2fda7887a7df9c3c57db8a9f25547dc9374137ec9"
|
|
131
|
+
author = "Fare9"
|
|
132
|
+
|
|
133
|
+
strings:
|
|
134
|
+
$lib1 = /lib\/(arm.*|x86.*)\/libsecurity\.so/
|
|
135
|
+
$lib2 = /lib\/(arm.*|x86.*)\/libpolarssl\.so/
|
|
136
|
+
$asset = "assets/talsec"
|
|
137
|
+
|
|
138
|
+
condition:
|
|
139
|
+
is_apk and all of them
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
rule ahope_appshield : protector
|
|
143
|
+
{
|
|
144
|
+
meta:
|
|
145
|
+
description = "Ahope AppShield"
|
|
146
|
+
url = "http://www.ahope.net/sub/app-shields"
|
|
147
|
+
sample = "42a4d907caf625ff73d5b6fbbf32b59ba14d6d5a72f28b81bdc76c47db516122"
|
|
148
|
+
author = "dustty0 & Eduardo Novella"
|
|
149
|
+
|
|
150
|
+
strings:
|
|
151
|
+
$lib = /lib\/(arm.*|x86.*)\/libahope(.*)\.so/
|
|
152
|
+
|
|
153
|
+
condition:
|
|
154
|
+
is_apk and any of them
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
rule vguard : protector
|
|
158
|
+
{
|
|
159
|
+
meta:
|
|
160
|
+
description = "VGuard"
|
|
161
|
+
url = "https://www.vguard.co.kr"
|
|
162
|
+
sample = "7024bdadb53cbec86a39de845108b182ed2f7b3f0e7c0b876a948e1532ec5b9f"
|
|
163
|
+
author = "dustty0"
|
|
164
|
+
|
|
165
|
+
strings:
|
|
166
|
+
$lib = /lib\/(arm.*|x86.*)\/libedex\.so/
|
|
167
|
+
$asset1 = /assets\/dexsky\.(d|e)b(a|b|x|y)/
|
|
168
|
+
$asset2 = /assets\/dex[a-z0-9]{3}\.zip/
|
|
169
|
+
$asset3 = /assets\/vguard\.(key|enginehash)/
|
|
170
|
+
$asset4 = "assets/dexsky.ini"
|
|
171
|
+
|
|
172
|
+
condition:
|
|
173
|
+
is_apk and 2 of them
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
rule appdefence : protector
|
|
177
|
+
{
|
|
178
|
+
meta:
|
|
179
|
+
description = "ExTrus AppDefence"
|
|
180
|
+
url = "https://www.extrus.co.kr/eng/m/product_01_05.html"
|
|
181
|
+
sample = "e080380673479d2e182ad7eff5130bb72fe9a228c0a5de9852df23c4e98113b2"
|
|
182
|
+
author = "dustty0"
|
|
183
|
+
|
|
184
|
+
strings:
|
|
185
|
+
$asset = "assets/appdefence_xml"
|
|
186
|
+
|
|
187
|
+
condition:
|
|
188
|
+
is_apk and all of them
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
rule dpt_shell : protector
|
|
192
|
+
{
|
|
193
|
+
meta:
|
|
194
|
+
description = "DPT Shell"
|
|
195
|
+
url = "https://github.com/luoyesiqiu/dpt-shell"
|
|
196
|
+
sample = "0c4341700f4e685cafc9c86c9112098b75057580ba1f7163bc971347af3712ad"
|
|
197
|
+
author = "Abhi"
|
|
198
|
+
|
|
199
|
+
strings:
|
|
200
|
+
$app = "assets/app_name"
|
|
201
|
+
$app_acf = "assets/app_acf"
|
|
202
|
+
$assetlib = /assets\/(.*)\/(arm.*|x86.*)\/libdpt\.so/
|
|
203
|
+
|
|
204
|
+
condition:
|
|
205
|
+
is_apk and $assetlib and any of ($app*)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
rule build38 : protector
|
|
209
|
+
{
|
|
210
|
+
meta:
|
|
211
|
+
description = "Build38"
|
|
212
|
+
url = "https://build38.com"
|
|
213
|
+
sample = "cfbbfca598a9877a381583a7ae2f9e8cde92e7314b21152658bcba5a4e3a0fff" // com.esignus.hashwalletmanager
|
|
214
|
+
author = "Abhi"
|
|
215
|
+
|
|
216
|
+
strings:
|
|
217
|
+
$lib = /lib\/(arm.*|x86.*)\/libtak\.so/
|
|
218
|
+
$license = "__license.tak"
|
|
219
|
+
$license2 = "license.tak"
|
|
220
|
+
|
|
221
|
+
condition:
|
|
222
|
+
is_apk and 2 of them
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
rule shield_sdk : protector
|
|
226
|
+
{
|
|
227
|
+
meta:
|
|
228
|
+
description = "Shield SDK"
|
|
229
|
+
url = "https://shield.com/"
|
|
230
|
+
sample = "fb4b7f033658b3898e0448955491b448a2c78e1a2325c65fece6ad64f6f6b6d0" // com.mpl.androidapp
|
|
231
|
+
author = "Abhi"
|
|
232
|
+
|
|
233
|
+
strings:
|
|
234
|
+
$lib = /lib\/(arm.*|x86.*)\/libcashshieldabc-native-lib\.so/
|
|
235
|
+
|
|
236
|
+
condition:
|
|
237
|
+
is_apk and all of them
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
rule andres : manipulator
|
|
241
|
+
{
|
|
242
|
+
meta:
|
|
243
|
+
description = "Resources Confusion"
|
|
244
|
+
url = "https://github.com/shwenzhang/AndResGuard"
|
|
245
|
+
sample = "45610fcb6ba935db0bf1bd94d672a848852ee9665cebaab7b3d4d7497d8e730f"
|
|
246
|
+
author = "Abhi"
|
|
247
|
+
|
|
248
|
+
strings:
|
|
249
|
+
$res = /res\/[^\/]+\.xml/
|
|
250
|
+
|
|
251
|
+
condition:
|
|
252
|
+
is_apk and #res > 10
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
rule bugsmirror : protector
|
|
256
|
+
{
|
|
257
|
+
meta:
|
|
258
|
+
description = "BugsMirror"
|
|
259
|
+
url = "https://www.bugsmirror.com/"
|
|
260
|
+
sample = "c9bbf66ac86bf02663b7bc28a735881d4aeaa8d90e9b8b752e9cf337a26f0bdd"
|
|
261
|
+
author = "Abhi"
|
|
262
|
+
|
|
263
|
+
strings:
|
|
264
|
+
$lib = /lib\/(arm.*|x86.*)\/libdefender\.so/
|
|
265
|
+
$xml = /res\/xml\/(com_bugsmirror_)?(defender|bugsmirror)_authenticator\.xml/
|
|
266
|
+
$lib2 = /lib\/(arm.*|x86.*)\/libsettings\.so/
|
|
267
|
+
|
|
268
|
+
condition:
|
|
269
|
+
is_apk and 2 of them
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
rule bshield : protector
|
|
273
|
+
{
|
|
274
|
+
meta:
|
|
275
|
+
description = "BShield"
|
|
276
|
+
url = "https://bshield.io/"
|
|
277
|
+
sample = "f54fa5cfcd9a5d14a947bbd93bc7bb59e8c2b1b23cc5bcc84c66ad0143e55201"
|
|
278
|
+
author = "Abhi"
|
|
279
|
+
|
|
280
|
+
strings:
|
|
281
|
+
$asset = "assets/bshield.dat"
|
|
282
|
+
|
|
283
|
+
condition:
|
|
284
|
+
is_apk and all of them
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
rule denuvo_apk : protector
|
|
288
|
+
{
|
|
289
|
+
meta:
|
|
290
|
+
description = "Denuvo"
|
|
291
|
+
url = "https://irdeto.com/denuvo/anti-tamper"
|
|
292
|
+
sample = "f7d1cd97b5d61da16b804daf6cd1199fe822745f9066596988d30a934441f6fc"
|
|
293
|
+
author = "Abhi"
|
|
294
|
+
|
|
295
|
+
strings:
|
|
296
|
+
$tid = "assets/tid"
|
|
297
|
+
$libvmpc = "libvmpc.so"
|
|
298
|
+
|
|
299
|
+
condition:
|
|
300
|
+
is_apk and all of them
|
|
301
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) 2023 RedNaga. https://rednaga.io
|
|
3
|
+
* All rights reserved. Contact: rednaga@protonmail.com
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* This file is part of APKiD
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* Commercial License Usage
|
|
10
|
+
* ------------------------
|
|
11
|
+
* Licensees holding valid commercial APKiD licenses may use this file
|
|
12
|
+
* in accordance with the commercial license agreement provided with the
|
|
13
|
+
* Software or, alternatively, in accordance with the terms contained in
|
|
14
|
+
* a written agreement between you and RedNaga.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* GNU General Public License Usage
|
|
18
|
+
* --------------------------------
|
|
19
|
+
* Alternatively, this file may be used under the terms of the GNU General
|
|
20
|
+
* Public License version 3.0 as published by the Free Software Foundation
|
|
21
|
+
* and appearing in the file LICENSE.GPL included in the packaging of this
|
|
22
|
+
* file. Please visit http://www.gnu.org/copyleft/gpl.html and review the
|
|
23
|
+
* information to ensure the GNU General Public License version 3.0
|
|
24
|
+
* requirements will be met.
|
|
25
|
+
*
|
|
26
|
+
**/
|
|
27
|
+
|
|
28
|
+
/*
|
|
29
|
+
TODO:
|
|
30
|
+
class name length is > 255 characters
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import "dex"
|
|
34
|
+
include "common.yara"
|
|
35
|
+
|
|
36
|
+
rule abnormal_header_size : abnormal
|
|
37
|
+
{
|
|
38
|
+
meta:
|
|
39
|
+
description = "non-standard header size"
|
|
40
|
+
sample = "1d97aff8d86d164dc64e81b822c01623940e2f21ab51d2fd42172b364d5e185e"
|
|
41
|
+
|
|
42
|
+
condition:
|
|
43
|
+
/*
|
|
44
|
+
* Header size is always 112 bytes but the format allows it to be bigger. This would make it
|
|
45
|
+
* possible to do weird stuff like hide files after the normal header data.
|
|
46
|
+
*/
|
|
47
|
+
is_dex and dex.header.header_size != 0x70
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
rule non_zero_link_size : anti_disassembly
|
|
51
|
+
{
|
|
52
|
+
meta:
|
|
53
|
+
description = "non-zero link size"
|
|
54
|
+
sample = "ad006e1e152fe298e86bb540d2c56cf474a246885e87c351a3285615c8e8bb42"
|
|
55
|
+
|
|
56
|
+
condition:
|
|
57
|
+
dex.header.link_size != 0x0
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
rule non_zero_link_offset : anti_disassembly
|
|
61
|
+
{
|
|
62
|
+
meta:
|
|
63
|
+
description = "non-zero link offset"
|
|
64
|
+
sample = "5882f768d42fe1837f562023e5ea1d7e03c7b56f0c31bcbb4423726c2109faf9"
|
|
65
|
+
|
|
66
|
+
condition:
|
|
67
|
+
dex.header.link_offset != 0x0
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
rule non_little_endian : abnormal
|
|
71
|
+
{
|
|
72
|
+
meta:
|
|
73
|
+
description = "non little-endian format"
|
|
74
|
+
sample = "b82d521aa24f4f7c995ba55eaa8db9e2f4e9dd69ac0d9ddea2fb776d49ecd7a4"
|
|
75
|
+
|
|
76
|
+
condition:
|
|
77
|
+
dex.header.endian_tag != 0x12345678
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
rule data_injected_after_map : dropper
|
|
81
|
+
{
|
|
82
|
+
meta:
|
|
83
|
+
description = "injected data after map section"
|
|
84
|
+
|
|
85
|
+
condition:
|
|
86
|
+
dex.header.file_size < dex.header.map_offset + (dex.map_list.size * 12) + 4
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
rule illegal_class_names : anti_disassembly
|
|
90
|
+
{
|
|
91
|
+
meta:
|
|
92
|
+
description = "illegal class name"
|
|
93
|
+
sample = "5e980583904b08732ef7c833351ee45cfe86de55d6411a94a986cacce5b82700"
|
|
94
|
+
|
|
95
|
+
strings:
|
|
96
|
+
/*
|
|
97
|
+
* Disassemblers use class names for file names, and these file names
|
|
98
|
+
* are illegal on some file systems (looking at you, Windows)
|
|
99
|
+
*/
|
|
100
|
+
$invalid = /\x00[^\x00]{1,4}L([^\x00\x2f]+\x2f)*(CON|PRN|AUX|CLOCK\$|NUL|COM[1-9]|LPT[1-9])(\x2f[^\x00\x2f]+\x2f+)*;\x00/is
|
|
101
|
+
|
|
102
|
+
condition:
|
|
103
|
+
any of them
|
|
104
|
+
}
|