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,991 @@
|
|
|
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
|
+
import "elf"
|
|
30
|
+
include "common.yara"
|
|
31
|
+
|
|
32
|
+
rule ollvm_v3_4 : obfuscator
|
|
33
|
+
{
|
|
34
|
+
meta:
|
|
35
|
+
description = "Obfuscator-LLVM version 3.4"
|
|
36
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
37
|
+
sample = "cd16ad33bf203dbaa9add803a7a0740e3727e8e60c316d33206230ae5b985f25"
|
|
38
|
+
author = "Eduardo Novella"
|
|
39
|
+
|
|
40
|
+
strings:
|
|
41
|
+
// "Obfuscator-clang version 3.4 (tags/RELEASE_34/final) (based on LLVM 3.4svn)"
|
|
42
|
+
$clang_version = "Obfuscator-clang version 3.4 "
|
|
43
|
+
$based_on = "(based on LLVM 3.4"
|
|
44
|
+
|
|
45
|
+
condition:
|
|
46
|
+
is_elf and all of them
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
rule ollvm_v3_5 : obfuscator
|
|
50
|
+
{
|
|
51
|
+
meta:
|
|
52
|
+
description = "Obfuscator-LLVM version 3.5"
|
|
53
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
54
|
+
sample = "664214969f1b94494a8fc0491407f4440032fc5c922eb0664293d0440c52dbe7"
|
|
55
|
+
author = "Eduardo Novella"
|
|
56
|
+
|
|
57
|
+
strings:
|
|
58
|
+
// "Obfuscator- clang version 3.5.0 (tags/RELEASE_350/final) (based on LLVM 3.5.0svn)"
|
|
59
|
+
$clang_version = "Obfuscator- clang version 3.5.0 "
|
|
60
|
+
$based_on = "(based on LLVM 3.5"
|
|
61
|
+
|
|
62
|
+
condition:
|
|
63
|
+
is_elf and all of them
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
rule ollvm_v3_6_1 : obfuscator
|
|
67
|
+
{
|
|
68
|
+
meta:
|
|
69
|
+
description = "Obfuscator-LLVM version 3.6.1"
|
|
70
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
71
|
+
sample = "d84b45856b5c95f7a6e96ab0461648f22ad29d1c34a8e85588dad3d89f829208"
|
|
72
|
+
author = "Eduardo Novella"
|
|
73
|
+
|
|
74
|
+
strings:
|
|
75
|
+
// "Obfuscator-LLVM clang version 3.6.1 (tags/RELEASE_361/final) (based on Obfuscator-LLVM 3.6.1)"
|
|
76
|
+
$clang_version = "Obfuscator-LLVM clang version 3.6.1 "
|
|
77
|
+
$based_on = "(based on Obfuscator-LLVM 3.6.1)"
|
|
78
|
+
|
|
79
|
+
condition:
|
|
80
|
+
is_elf and all of them
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
rule ollvm_v4_0 : obfuscator
|
|
84
|
+
{
|
|
85
|
+
meta:
|
|
86
|
+
description = "Obfuscator-LLVM version 4.0"
|
|
87
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
88
|
+
sample = "aaba570388d0fe25df45480ecf894625be7affefaba24695d8c1528b974c00df"
|
|
89
|
+
author = "Eduardo Novella"
|
|
90
|
+
|
|
91
|
+
strings:
|
|
92
|
+
// "Obfuscator-LLVM clang version 4.0.1 (based on Obfuscator-LLVM 4.0.1)"
|
|
93
|
+
$clang_version = "Obfuscator-LLVM clang version 4.0.1 "
|
|
94
|
+
$based_on = "(based on Obfuscator-LLVM 4.0.1)"
|
|
95
|
+
|
|
96
|
+
condition:
|
|
97
|
+
is_elf and all of them
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
rule ollvm_v5_0_strenc : obfuscator
|
|
101
|
+
{
|
|
102
|
+
meta:
|
|
103
|
+
description = "Obfuscator-LLVM version 5.0 (string encryption)"
|
|
104
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
105
|
+
sample = "a794a080a92987ce5ed9cf5cd872ef87f9bfb9acd4c07653b615f4beaff3ace2"
|
|
106
|
+
author = "Eduardo Novella"
|
|
107
|
+
|
|
108
|
+
strings:
|
|
109
|
+
// "Obfuscator-LLVM clang version 5.0.2 (based on Obfuscator-LLVM 5.0.2)"
|
|
110
|
+
$clang_version = "Obfuscator-LLVM clang version 5.0."
|
|
111
|
+
$based_on = "(based on Obfuscator-LLVM 5.0."
|
|
112
|
+
$strenc = /\.datadiv_decode[\d]{18,20}/ // Enumerating elf.symtab_entries fails!
|
|
113
|
+
|
|
114
|
+
condition:
|
|
115
|
+
is_elf and
|
|
116
|
+
all of them
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
rule ollvm_v6_0_strenc : obfuscator
|
|
120
|
+
{
|
|
121
|
+
meta:
|
|
122
|
+
description = "Obfuscator-LLVM version 6.0 (string encryption)"
|
|
123
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
124
|
+
sample = "f3a2e6c57def9a8b4730965dd66ca0f243689153139758c44718b8c5ef9c1d17"
|
|
125
|
+
author = "Eduardo Novella"
|
|
126
|
+
|
|
127
|
+
strings:
|
|
128
|
+
// "Obfuscator-LLVM clang version 6.0.0 (trunk) (based on Obfuscator-LLVM 6.0.0)"
|
|
129
|
+
// "Obfuscator-LLVM clang version 6.0.0 (trunk) (based on Obfuscator-LLVM 6.0.0git-b9ea5776)"
|
|
130
|
+
$clang_version = "Obfuscator-LLVM clang version 6.0."
|
|
131
|
+
$based_on = "(based on Obfuscator-LLVM 6.0."
|
|
132
|
+
|
|
133
|
+
condition:
|
|
134
|
+
is_elf and
|
|
135
|
+
all of them and
|
|
136
|
+
for any i in (0..elf.symtab_entries): (elf.symtab[i].name matches /\.datadiv_decode[\d]{18,20}/)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
rule ollvm_v6_0 : obfuscator
|
|
140
|
+
{
|
|
141
|
+
meta:
|
|
142
|
+
description = "Obfuscator-LLVM version 6.0"
|
|
143
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
144
|
+
author = "Eduardo Novella"
|
|
145
|
+
|
|
146
|
+
strings:
|
|
147
|
+
// "Obfuscator-LLVM clang version 6.0.0 (trunk) (based on Obfuscator-LLVM 6.0.0)"
|
|
148
|
+
// "Obfuscator-LLVM clang version 6.0.0 (trunk) (based on Obfuscator-LLVM 6.0.0git-b9ea5776)"
|
|
149
|
+
$clang_version = "Obfuscator-LLVM clang version 6.0."
|
|
150
|
+
$based_on = "(based on Obfuscator-LLVM 6.0."
|
|
151
|
+
|
|
152
|
+
condition:
|
|
153
|
+
is_elf and
|
|
154
|
+
all of them and
|
|
155
|
+
not ollvm_v6_0_strenc
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
rule ollvm_v8_strenc : obfuscator
|
|
159
|
+
{
|
|
160
|
+
meta:
|
|
161
|
+
description = "Obfuscator-LLVM version 8.x (string encryption)"
|
|
162
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
163
|
+
url2 = "https://github.com/heroims/obfuscator"
|
|
164
|
+
sample = "2c720f5ec740f4c8571dbba205eadba483556c5c387fe88ff25192b25552da0f"
|
|
165
|
+
author = "Eduardo Novella"
|
|
166
|
+
|
|
167
|
+
strings:
|
|
168
|
+
/*
|
|
169
|
+
[0x0000a5bc]> izzq~+obfuscator,ollvm,clang
|
|
170
|
+
0x1 263 262 Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
|
|
171
|
+
0x108 155 154 Obfuscator-LLVM clang version 8.0.0 (https://github.com/heroims/obfuscator.git 29d9dc8c1bd662f3a73d1b1b009266af1786b7b8) (based on Obfuscator-LLVM 8.0.0)
|
|
172
|
+
*/
|
|
173
|
+
$ollvm = "Obfuscator-LLVM clang version 8."
|
|
174
|
+
$strenc = /\.datadiv_decode[\d]{18,20}/
|
|
175
|
+
|
|
176
|
+
condition:
|
|
177
|
+
is_elf and all of them
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
rule ollvm_v8 : obfuscator
|
|
181
|
+
{
|
|
182
|
+
meta:
|
|
183
|
+
description = "Obfuscator-LLVM version 8.x"
|
|
184
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
185
|
+
url2 = "https://github.com/heroims/obfuscator"
|
|
186
|
+
sample = "2c720f5ec740f4c8571dbba205eadba483556c5c387fe88ff25192b25552da0f"
|
|
187
|
+
author = "Eduardo Novella"
|
|
188
|
+
|
|
189
|
+
strings:
|
|
190
|
+
/*
|
|
191
|
+
[0x0000a5bc]> izzq~+obfuscator,ollvm,clang
|
|
192
|
+
0x1 263 262 Android (4751641 based on r328903) clang version 7.0.2 (https://android.googlesource.com/toolchain/clang 003100370607242ddd5815e4a043907ea9004281) (https://android.googlesource.com/toolchain/llvm 1d739ffb0366421d383e04ff80ec2ee591315116) (based on LLVM 7.0.2svn)
|
|
193
|
+
0x108 155 154 Obfuscator-LLVM clang version 8.0.0 (https://github.com/heroims/obfuscator.git 29d9dc8c1bd662f3a73d1b1b009266af1786b7b8) (based on Obfuscator-LLVM 8.0.0)
|
|
194
|
+
*/
|
|
195
|
+
$ollvm = "Obfuscator-LLVM clang version 8."
|
|
196
|
+
|
|
197
|
+
condition:
|
|
198
|
+
is_elf and
|
|
199
|
+
all of them and
|
|
200
|
+
not ollvm_v8_strenc
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
rule ollvm_v9 : obfuscator
|
|
204
|
+
{
|
|
205
|
+
meta:
|
|
206
|
+
description = "Obfuscator-LLVM version 9.x"
|
|
207
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
208
|
+
sample = "a794a080a92987ce5ed9cf5cd872ef87f9bfb9acd4c07653b615f4beaff3ace2"
|
|
209
|
+
sample2 = "198bee8db8765c3e2db35a65ac0ba3232f361b344c3fb74879cbf2f163bafe5a"
|
|
210
|
+
author = "Eduardo Novella"
|
|
211
|
+
|
|
212
|
+
strings:
|
|
213
|
+
/* Android (dev based on r365631) clang version 9.0.6 (https://android.googlesource.com/toolchain/llvm-project)
|
|
214
|
+
(based on Obfuscator-LLVM 9.0.6svn)
|
|
215
|
+
|
|
216
|
+
Android (ollvm based on r365631c3) clang version 9.0.9 (https://android.googlesource.com/toolchain/llvm-project a2a1e703c0edb03ba29944e529ccbf457742737b) (based on OLLVM 9.0.9svn)
|
|
217
|
+
*/
|
|
218
|
+
$ollvm = /\(based on (Obfuscator-LLVM|OLLVM) 9\./
|
|
219
|
+
|
|
220
|
+
condition:
|
|
221
|
+
is_elf and all of them
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
rule ollvm_v9_a : obfuscator
|
|
225
|
+
{
|
|
226
|
+
meta:
|
|
227
|
+
description = "Obfuscator-LLVM version 9.x"
|
|
228
|
+
url = "https://github.com/o2e/OLLVM-9.0.1"
|
|
229
|
+
sample = "198bee8db8765c3e2db35a65ac0ba3232f361b344c3fb74879cbf2f163bafe5a"
|
|
230
|
+
author = "Eduardo Novella"
|
|
231
|
+
|
|
232
|
+
strings:
|
|
233
|
+
// clang version 9.0.1 (https://github.com/o2e/OLLVM-9.0.1.git 769bcbf3fe6a7d865a7afa9a70dbe907ad905cfb)
|
|
234
|
+
$clang_version = /clang version \d\.\d\.\d (.*)OLLVM(.*)9\./
|
|
235
|
+
|
|
236
|
+
condition:
|
|
237
|
+
is_elf and
|
|
238
|
+
any of them and
|
|
239
|
+
not ollvm_v9
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
rule ollvm_v9_strenc : obfuscator
|
|
243
|
+
{
|
|
244
|
+
meta:
|
|
245
|
+
description = "Obfuscator-LLVM version 9.x (string encryption)"
|
|
246
|
+
sample = "2314ec0053d829d424a82f702188fcb525cefce4feeef096f0855339b897a5d1"
|
|
247
|
+
author = "Eduardo Novella"
|
|
248
|
+
|
|
249
|
+
strings:
|
|
250
|
+
$clang_version = /clang version \d\.\d\.\d /
|
|
251
|
+
$strenc = /\.datadiv_decode[\d]{18,20}/
|
|
252
|
+
$ollvm = "(based on Obfuscator-LLVM 9."
|
|
253
|
+
|
|
254
|
+
condition:
|
|
255
|
+
is_elf and
|
|
256
|
+
not ollvm_v9 and
|
|
257
|
+
all of them
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
rule ollvm_tll : obfuscator
|
|
261
|
+
{
|
|
262
|
+
meta:
|
|
263
|
+
description = "Obfuscator-LLVM TLL (string encryption)"
|
|
264
|
+
url = "https://github.com/yazhiwang/ollvm-tll"
|
|
265
|
+
sample = "1f010330e9ac90f00d11aa37fdca25c437ad6f4b1302f6d7aa48b91ef22cc107"
|
|
266
|
+
author = "Eduardo Novella"
|
|
267
|
+
|
|
268
|
+
strings:
|
|
269
|
+
/**
|
|
270
|
+
.datadiv_decode7760209850571766755
|
|
271
|
+
Android clang version 5.0.300080 (based on LLVM 5.0.300080)
|
|
272
|
+
clang version 6.0.0 (tags/RELEASE_600/final) (https://github.com/yazhiwang/ollvm-tll.git a38559e4c13359073102793c0a734bb1add3d5ff)
|
|
273
|
+
*/
|
|
274
|
+
$clang_version = /clang version \d\.\d\.\d \(tags\/RELEASE\_\d+\/final\)/
|
|
275
|
+
$strenc = /\.datadiv_decode[\d]{18,20}/
|
|
276
|
+
$url = "https://github.com/yazhiwang/ollvm-tll"
|
|
277
|
+
|
|
278
|
+
condition:
|
|
279
|
+
is_elf and all of them
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
rule ollvm_tll_a : obfuscator
|
|
283
|
+
{
|
|
284
|
+
meta:
|
|
285
|
+
description = "Obfuscator-LLVM TLL (string encryption)"
|
|
286
|
+
url = "https://github.com/yazhiwang/ollvm-tll"
|
|
287
|
+
sample = "0e5992066f177e2495a2a424201e146c29b78b63a9eb94bce6765691a47e6fd7"
|
|
288
|
+
author = "Eduardo Novella"
|
|
289
|
+
|
|
290
|
+
strings:
|
|
291
|
+
/**
|
|
292
|
+
clang version 6.0.0 (tags/RELEASE_600/final) (git@github.com:enovella/ollvm-tll.git a38559e4c13359073102793c0a734bb1add3d5ff)
|
|
293
|
+
*/
|
|
294
|
+
$version = /clang version \d+\.\d+\.\d+ \(.*\) \(.*\/ollvm\-tll\.git [0-9a-f]{40}\)/
|
|
295
|
+
|
|
296
|
+
condition:
|
|
297
|
+
is_elf and all of them and not ollvm_tll
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
rule ollvm_armariris : obfuscator
|
|
301
|
+
{
|
|
302
|
+
meta:
|
|
303
|
+
description = "Armariris Obfuscator-LLVM (string encryption)"
|
|
304
|
+
url = "https://github.com/GoSSIP-SJTU/Armariris"
|
|
305
|
+
sample = "d22c2f53bab6fa2ab7bdb4f7acabb419e3ee3163bb758c4f7a013d07a8b09e12" // aka malware Joker
|
|
306
|
+
author = "Eduardo Novella"
|
|
307
|
+
|
|
308
|
+
strings:
|
|
309
|
+
// clang version 3.9.1 (tags/RELEASE_391/final)
|
|
310
|
+
// clang version 5.0.1 (tags/RELEASE_501/final)
|
|
311
|
+
// .datadiv_decode14660921177804423408
|
|
312
|
+
$clang_version = /clang version \d\.\d\.\d \(tags\/RELEASE\_\d+\/final\)/
|
|
313
|
+
|
|
314
|
+
condition:
|
|
315
|
+
is_elf and $clang_version and
|
|
316
|
+
not ollvm_tll and
|
|
317
|
+
for any i in (0..elf.symtab_entries): (elf.symtab[i].name matches /\.datadiv_decode[\d]{18,20}/)
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
rule ollvm_strenc : obfuscator
|
|
321
|
+
{
|
|
322
|
+
meta:
|
|
323
|
+
description = "Obfuscator-LLVM version unknown (string encryption)"
|
|
324
|
+
sample = "73f34f7dd5f5c2eff33fc48371c850a2a3ff0355a2bfa014467478ccb30309e3"
|
|
325
|
+
author = "Eduardo Novella"
|
|
326
|
+
|
|
327
|
+
strings:
|
|
328
|
+
$strenc = /\.datadiv_decode[\d]{18,20}/
|
|
329
|
+
|
|
330
|
+
condition:
|
|
331
|
+
is_elf and $strenc and
|
|
332
|
+
not ollvm_tll and
|
|
333
|
+
not ollvm_armariris and
|
|
334
|
+
not ollvm_v5_0_strenc and
|
|
335
|
+
not ollvm_v6_0_strenc and
|
|
336
|
+
not ollvm_v8_strenc and
|
|
337
|
+
not ollvm_v9_strenc
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
rule ollvm_v_regex : obfuscator
|
|
341
|
+
{
|
|
342
|
+
meta:
|
|
343
|
+
description = "Obfuscator-LLVM"
|
|
344
|
+
url = "https://github.com/o2e/OLLVM-9.0.1"
|
|
345
|
+
sample = "198bee8db8765c3e2db35a65ac0ba3232f361b344c3fb74879cbf2f163bafe5a"
|
|
346
|
+
author = "Eduardo Novella"
|
|
347
|
+
|
|
348
|
+
strings:
|
|
349
|
+
// clang version 9.0.1 (https://github.com/o2e/OLLVM-9.0.1.git 769bcbf3fe6a7d865a7afa9a70dbe907ad905cfb)
|
|
350
|
+
$clang_version = /clang version \d\.\d\.\d (.*)OLLVM/
|
|
351
|
+
|
|
352
|
+
condition:
|
|
353
|
+
is_elf and
|
|
354
|
+
any of them and
|
|
355
|
+
not ollvm_v9 and
|
|
356
|
+
not ollvm_v9_a
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
rule ollvm : obfuscator
|
|
360
|
+
{
|
|
361
|
+
meta:
|
|
362
|
+
description = "Obfuscator-LLVM version unknown"
|
|
363
|
+
url = "https://github.com/obfuscator-llvm/obfuscator/wiki"
|
|
364
|
+
author = "Eduardo Novella"
|
|
365
|
+
|
|
366
|
+
strings:
|
|
367
|
+
$ollvm1 = "Obfuscator-LLVM "
|
|
368
|
+
$ollvm2 = "Obfuscator-clang "
|
|
369
|
+
$ollvm3 = "Obfuscator- clang "
|
|
370
|
+
|
|
371
|
+
condition:
|
|
372
|
+
is_elf and
|
|
373
|
+
any of them and
|
|
374
|
+
not ollvm_v3_4 and
|
|
375
|
+
not ollvm_v3_5 and
|
|
376
|
+
not ollvm_v3_6_1 and
|
|
377
|
+
not ollvm_v4_0 and
|
|
378
|
+
not ollvm_v5_0_strenc and
|
|
379
|
+
not ollvm_v6_0 and
|
|
380
|
+
not ollvm_v6_0_strenc and
|
|
381
|
+
not ollvm_strenc and
|
|
382
|
+
not ollvm_v8 and
|
|
383
|
+
not ollvm_v8_strenc and
|
|
384
|
+
not ollvm_v9 and
|
|
385
|
+
not ollvm_v9_strenc and
|
|
386
|
+
not ollvm_v_regex
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
rule alipay : obfuscator
|
|
390
|
+
{
|
|
391
|
+
meta:
|
|
392
|
+
description = "Alipay"
|
|
393
|
+
url = "https://www.jianshu.com/p/477af178d7d8"
|
|
394
|
+
sample = "cbfec478f4860cb503ecb28711fe4767a68b7819d9a0c17cf51aaa77e11eb19a"
|
|
395
|
+
author = "Eduardo Novella"
|
|
396
|
+
|
|
397
|
+
strings:
|
|
398
|
+
/**
|
|
399
|
+
__obfuscator_version
|
|
400
|
+
Alipay Obfuscator (based on LLVM 4.0.1)
|
|
401
|
+
Alipay clang version 4.0.1 (based on LLVM 4.0.1.Alipay.Obfuscator.Trial)
|
|
402
|
+
*/
|
|
403
|
+
$a = "Alipay clang version "
|
|
404
|
+
$b = "Alipay Obfuscator (based on LLVM "
|
|
405
|
+
$c = "Alipay.Obfuscator."
|
|
406
|
+
|
|
407
|
+
condition:
|
|
408
|
+
any of them and is_elf
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
rule byteguard_0_9_3 : obfuscator
|
|
412
|
+
{
|
|
413
|
+
meta:
|
|
414
|
+
description = "ByteGuard 0.9.3"
|
|
415
|
+
sample = "eed4f7b907fe2173935d307dfb0d6aa7098f69db8dfb65e49affd7b7a6c0a5e4"
|
|
416
|
+
samples = "https://koodous.com/rulesets/5862/apks"
|
|
417
|
+
author = "Eduardo Novella"
|
|
418
|
+
|
|
419
|
+
strings:
|
|
420
|
+
// clang version 6.0.0 (Byteguard 0.6) (git@sysrepo.byted.org:dingbaozeng/native_obfuscator.git 448f20ff6eb06dd336dd81846d6a7dc8ba8c961b)
|
|
421
|
+
// Apple LLVM version 6.0.0 (ByteGuard 0.9.3-af515063)
|
|
422
|
+
$version = /(Apple LLVM|clang) version \d+\.\d+\.\d+ \(Byte(G|g)uard(-| )0\.9\.3/
|
|
423
|
+
|
|
424
|
+
condition:
|
|
425
|
+
is_elf and all of them
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
rule byteguard_0_9_2 : obfuscator
|
|
429
|
+
{
|
|
430
|
+
meta:
|
|
431
|
+
description = "ByteGuard 0.9.2"
|
|
432
|
+
sample = "178b1ef3c4ac563604c8a262f0e3651f56995768c8aa13ccc845f33bd6eb0ac2"
|
|
433
|
+
samples = "https://koodous.com/rulesets/5862/apks"
|
|
434
|
+
author = "Eduardo Novella"
|
|
435
|
+
|
|
436
|
+
strings:
|
|
437
|
+
// clang version 5.0.2 (Byteguard-0.9.2-255c7b5e)
|
|
438
|
+
$version = /(Apple LLVM|clang) version \d+\.\d+\.\d+ \(Byte(G|g)uard(-| )0\.9\.2/
|
|
439
|
+
|
|
440
|
+
condition:
|
|
441
|
+
is_elf and all of them
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
rule byteguard_unknown : obfuscator
|
|
445
|
+
{
|
|
446
|
+
meta:
|
|
447
|
+
description = "ByteGuard unknown version"
|
|
448
|
+
author = "Eduardo Novella"
|
|
449
|
+
|
|
450
|
+
strings:
|
|
451
|
+
$clang_version = /(Apple LLVM|clang) version \d+\.\d+\.\d+ \(Byte(G|g)uard/
|
|
452
|
+
|
|
453
|
+
condition:
|
|
454
|
+
is_elf and $clang_version and
|
|
455
|
+
not byteguard_0_9_2 and
|
|
456
|
+
not byteguard_0_9_3
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
rule ollvm_lsposed : obfuscator
|
|
460
|
+
{
|
|
461
|
+
meta:
|
|
462
|
+
description = "LSPosed Obfuscator-LLVM (string encryption)"
|
|
463
|
+
url = "https://github.com/LSPosed/LSPosed.github.io/releases"
|
|
464
|
+
sample = "90ffa13afcf084aa3717a59cf5812517223c6cc4a6265cb191c929ef3a198c95/" // Momo, shamiko, and root hiders
|
|
465
|
+
author = "Eduardo Novella"
|
|
466
|
+
|
|
467
|
+
strings:
|
|
468
|
+
// Android (dev, based on r416183c1) clang version 12.0.8 (...)
|
|
469
|
+
// decrypt.e94930e06527fedf
|
|
470
|
+
$exports = /decrypt\.[0-9a-f]{14,16}/
|
|
471
|
+
|
|
472
|
+
condition:
|
|
473
|
+
is_elf and
|
|
474
|
+
#exports > 5
|
|
475
|
+
// for any i in (0..elf.symtab_entries): (elf.symtab[i].name matches /decrypt\.[0-9a-f]{14,16}/)
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
rule firehash : obfuscator
|
|
479
|
+
{
|
|
480
|
+
meta:
|
|
481
|
+
description = "Firehash"
|
|
482
|
+
url = "https://firehash.grayhash.com/"
|
|
483
|
+
author = "Eduardo Novella"
|
|
484
|
+
|
|
485
|
+
// original : https://firehash.grayhash.com/static/sample/dodocrackme_original.apk
|
|
486
|
+
// firehashed : https://firehash.grayhash.com/static/sample/dodocrackme_obfuscated.apk
|
|
487
|
+
sample = "38e2170a5f272ecae97dddb0dac0c1f39f7f71a4639477764a9154557106dd94"
|
|
488
|
+
|
|
489
|
+
// original : 6352f6d0cdc85a42de3ccfd9226dfec28280aa835227acc507043a4403b7e700
|
|
490
|
+
sample2 = "c98af9a777d9633559b7903e21b61b845f7e1766afa74ef85e3380f41265e6b5"
|
|
491
|
+
|
|
492
|
+
// original : 727be6789e8f4f6eab66288f957b58800e47a4bacebacc0dd700e8f9a374f116
|
|
493
|
+
sample3 = "423dc9866d1c5f32cabfeb254030d83e11db4d807394a8ff09be47d8bfc38f18"
|
|
494
|
+
|
|
495
|
+
strings:
|
|
496
|
+
// Library below heuristic is found inside of is normally named "libaurorabridge.so"
|
|
497
|
+
$segment = ".firehash"
|
|
498
|
+
$opcodes_arm = {
|
|
499
|
+
04 00 2D E5 // STR R0, [SP,#var_4]!
|
|
500
|
+
00 00 0F E1 // MRS R0, CPSR
|
|
501
|
+
01 00 51 E1 // CMP R1, R1
|
|
502
|
+
02 00 00 ?A // BNE loc_F0854
|
|
503
|
+
00 F0 29 E1 // MSR CPSR_cf, R0
|
|
504
|
+
04 00 9D E4 // LDR R0, [SP+4+var_4],#4
|
|
505
|
+
?? ?? ?? EA // B loc_F0828
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
condition:
|
|
509
|
+
elf.machine == elf.EM_ARM and all of them
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
rule advobfuscator : obfuscator
|
|
513
|
+
{
|
|
514
|
+
meta:
|
|
515
|
+
description = "ADVobfuscator"
|
|
516
|
+
url = "https://github.com/andrivet/ADVobfuscator"
|
|
517
|
+
author = "Eduardo Novella"
|
|
518
|
+
sample = "357f0c2ad6bf5cf60c671b090eab134251db63993f52aef512bde5bfa4a1b598"
|
|
519
|
+
|
|
520
|
+
strings:
|
|
521
|
+
$s_01 = "_ZNK17ObfuscatedAddressIPFiiiPciS0_S0_EE8originalEv"
|
|
522
|
+
$s_02 = "_ZNK17ObfuscatedAddressIPFiPcEE8originalEv"
|
|
523
|
+
$s_03 = "_ZNK17ObfuscatedAddressIPFvPciEE8originalEv"
|
|
524
|
+
$s_04 = "_ZNK17ObfuscatedAddressIPFvPcS0_EE8originalEv"
|
|
525
|
+
$s_05 = "_ZNK17ObfuscatedAddressIPFvvEE8originalEv"
|
|
526
|
+
$s_06 = "_Z14ObfuscatedCallI17ObfuscatedAddressIPFvvEEJEEvT_DpOT0_"
|
|
527
|
+
$s_07 = "_ZNK17ObfuscatedAddressIPFiPviEE8originalEv"
|
|
528
|
+
$s_08 = "_ZNK17ObfuscatedAddressIPFvPcEE8originalEv"
|
|
529
|
+
$s_09 = "_ZNK17ObfuscatedAddressIPFvP7_JNIEnvEE8originalEv"
|
|
530
|
+
$s_10 = "_ZNK17ObfuscatedAddressIPFvPcS0_iiEE8originalEv"
|
|
531
|
+
$s_11 = "_ZNK17ObfuscatedAddressIPFvcEE8originalEv"
|
|
532
|
+
$s_12 = "_ZNK17ObfuscatedAddressIPFvPviiEE8originalEv"
|
|
533
|
+
$s_13 = /\_ZN\dandrivet\d\dADVobfuscator\d\dMetaString.*decryptEv/
|
|
534
|
+
|
|
535
|
+
condition:
|
|
536
|
+
any of them and is_elf
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
rule arxan_arm32 : obfuscator
|
|
540
|
+
{
|
|
541
|
+
meta:
|
|
542
|
+
description = "Arxan"
|
|
543
|
+
url = "https://www.arxan.com/resources/technology/app-code-obfuscation"
|
|
544
|
+
sample = "5bbb241d41c4150798b5800e62afcb6f49e05755d2fd89c7a9f7e356609c9012"
|
|
545
|
+
author = "Eduardo Novella"
|
|
546
|
+
|
|
547
|
+
strings:
|
|
548
|
+
// Prolog breakage 1 ARM32
|
|
549
|
+
$a = {
|
|
550
|
+
00 10 90 E5 // LDR R1, [R0]
|
|
551
|
+
00 00 81 E0 // ADD R0, R1, R0
|
|
552
|
+
03 10 00 E0 // AND R1, R0, R3
|
|
553
|
+
02 20 A0 E3 // MOV R2, #2
|
|
554
|
+
92 01 01 E0 // MUL R1, R2, R1
|
|
555
|
+
03 00 20 E0 // EOR R0, R0, R3
|
|
556
|
+
01 00 80 E0 // ADD R0, R0, R1
|
|
557
|
+
00 F0 A0 E1 // MOV PC, R0
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// Prolog breakage 2 Thumb2
|
|
561
|
+
$b = {
|
|
562
|
+
4F F0 01 00 // MOV.W R0, #1
|
|
563
|
+
02 A1 // ADR R1, loc_191658
|
|
564
|
+
01 FB 00 F0 // MUL.W R0, R1, R0
|
|
565
|
+
87 46 // MOV PC, R0
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// Prolog breakage 3 ARM32
|
|
569
|
+
$c = {
|
|
570
|
+
?? ?? ?? E?
|
|
571
|
+
91 00 00 E0 // MUL R0, R1, R0
|
|
572
|
+
00 F0 A0 E1 // MOV PC, R0
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
condition:
|
|
576
|
+
(#a > 5 or #b > 5 or #c > 10) and elf.machine == elf.EM_ARM
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
rule arxan_arm64 : obfuscator
|
|
580
|
+
{
|
|
581
|
+
meta:
|
|
582
|
+
description = "Arxan"
|
|
583
|
+
url = "https://www.arxan.com/resources/technology/app-code-obfuscation"
|
|
584
|
+
sample = "444ae35cea294ca0268adbddf1c39e8a45fcbb4c967c55f23449cf0d1ae6fce6"
|
|
585
|
+
author = "Eduardo Novella"
|
|
586
|
+
|
|
587
|
+
strings:
|
|
588
|
+
/*
|
|
589
|
+
* Prolog breakage 1 ARM64
|
|
590
|
+
* This is how Arxan breaks the functions in basic blocks' sets making the static reverse engineering task very hard to follow.
|
|
591
|
+
* This is a updated version of the previous Arxan 32bits rule.
|
|
592
|
+
*/
|
|
593
|
+
$a = {
|
|
594
|
+
09 01 0? 8A // AND X9, X8, X11/X12
|
|
595
|
+
4A 00 80 D2 // MOV X10, #2
|
|
596
|
+
29 7D 0A 9B // MUL X9, X9, X10
|
|
597
|
+
08 01 0? CA // EOR X8, X8, X11/X12
|
|
598
|
+
08 01 09 8B // ADD X8, X8, X9
|
|
599
|
+
00 01 1F D6 // BR X8
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
$b = {
|
|
603
|
+
28 00 80 D2 // MOV X8, #1
|
|
604
|
+
69 00 00 10 // ADR X9, loc_XXX
|
|
605
|
+
28 7D 08 9B // MUL X8, X9, X8
|
|
606
|
+
00 01 1F D6 // BR X8
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
condition:
|
|
610
|
+
(#a > 3 or #b > 3) and elf.machine == elf.EM_AARCH64
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
rule dexguard_native : obfuscator
|
|
614
|
+
{
|
|
615
|
+
meta:
|
|
616
|
+
description = "DexGuard"
|
|
617
|
+
url = "https://www.guardsquare.com/en/products/dexguard"
|
|
618
|
+
sample = "ad25035a9ff2ccf44535fd0e5c9d3390f9ba2c4cd68ddf2aa69608494c48ea9e"
|
|
619
|
+
|
|
620
|
+
strings:
|
|
621
|
+
// "Java_com_guardsquare_dexguard_runtime_detection_HookDetector"
|
|
622
|
+
$hook_detector = {
|
|
623
|
+
00 4A 61 76 61 5F 63 6F 6D 5F 67 75 61 72 64 73 71 75 61 72 65 5F
|
|
624
|
+
64 65 78 67 75 61 72 64 5F 72 75 6E 74 69 6D 65 5F 64 65 74 65 63
|
|
625
|
+
74 69 6F 6E 5F 48 6F 6F 6B 44 65 74 65 63 74 6F 72
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
condition:
|
|
629
|
+
is_elf
|
|
630
|
+
and any of them
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
rule dexguard_native_a : obfuscator
|
|
634
|
+
{
|
|
635
|
+
meta:
|
|
636
|
+
description = "DexGuard 9.x"
|
|
637
|
+
url = "https://www.guardsquare.com/en/products/dexguard"
|
|
638
|
+
sample = "71b11059820c358fb14a0917430e07cf254e15d5b3337471ad172ad5ceccfa2a"
|
|
639
|
+
author = "Eduardo Novella"
|
|
640
|
+
|
|
641
|
+
strings:
|
|
642
|
+
// Library name is libdgrt (probably DexGuard RunTime)
|
|
643
|
+
$libdgrt = { 006c 6962 6467 7274 2e73 6f00 } // libdgrt.so
|
|
644
|
+
$s_java_o_ = { 00 4a61 7661 5f6f 5f } // Java_o_
|
|
645
|
+
$s_jnionload = { 004a 4e49 5f4f 6e4c 6f61 6400 } // JNI_OnLoad
|
|
646
|
+
$s_basename = { 00 6261 7365 6e61 6d65 00 }
|
|
647
|
+
$s_mprotect = { 006d 7072 6f74 6563 7400 }
|
|
648
|
+
$s_dirname = { 00 6469 726e 616d 6500 }
|
|
649
|
+
|
|
650
|
+
condition:
|
|
651
|
+
is_elf
|
|
652
|
+
and $libdgrt
|
|
653
|
+
and 4 of ($s_*)
|
|
654
|
+
and not dexguard_native
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
rule dexguard_native_arm64 : obfuscator
|
|
658
|
+
{
|
|
659
|
+
meta:
|
|
660
|
+
description = "DexGuard 9.x"
|
|
661
|
+
url = "https://www.guardsquare.com/en/products/dexguard"
|
|
662
|
+
sample = "fc3fae3de64eceab969b7d91e3a5fbc45c7407bb8d1a5d5018caa86947604713"
|
|
663
|
+
author = "FrenchYeti & Eduardo Novella"
|
|
664
|
+
|
|
665
|
+
strings:
|
|
666
|
+
// Frida detection into /proc/%d/maps
|
|
667
|
+
$hook1 = {
|
|
668
|
+
0b 1d 00 12 // and w11,bf,#0xff
|
|
669
|
+
48 15 40 38 // ldrb bf,[x10], #0x1
|
|
670
|
+
29 25 1b 53 // ubfiz w9,w9,#0x5,#0xa
|
|
671
|
+
29 01 0b 4a // eor w9,w9,w11
|
|
672
|
+
88 ff ff 35 // cbnz bf,LAB_00106e44
|
|
673
|
+
e8 c1 86 52 // mov bf,#0x360f
|
|
674
|
+
3f 01 08 6b // cmp w9,bf
|
|
675
|
+
}
|
|
676
|
+
$hook2 = {
|
|
677
|
+
6c 1d 00 12 // and w12, w11, #0xff
|
|
678
|
+
4b 15 40 38 // ldrb w11, [x10],#1
|
|
679
|
+
29 25 1b 53 // ubfiz w9, w9, #5, #0xa
|
|
680
|
+
29 01 0c 4a // eor w9, w9, w12
|
|
681
|
+
8b ff ff 35 // cbnz w11, loc_85f4
|
|
682
|
+
ea c1 86 52 // mov w10, #0x360f
|
|
683
|
+
3f 01 0a 6b // cmp w9, w10
|
|
684
|
+
}
|
|
685
|
+
$hook3 = {
|
|
686
|
+
/* ?? ?? ??*/ // Prolog breakage
|
|
687
|
+
e? c1 86 52 // mov w8, #0x360f
|
|
688
|
+
1f 00 0? 6b // cmp w0, w8
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
// Recurring patterns used into several string decryption
|
|
692
|
+
$str1 = {
|
|
693
|
+
6c 69 69 38 // ldrb w12,[x11, x9, LSL ]
|
|
694
|
+
8c ?? ?? 11 // add w12,w12,??
|
|
695
|
+
6c 69 29 38 // strb w12,[x11, x9, LSL ]
|
|
696
|
+
29 05 00 91 // add x9,x9,#0x1
|
|
697
|
+
3f ?? ?? f1 // cmp x9,??
|
|
698
|
+
ec 17 9f 1a // cset w12,??
|
|
699
|
+
}
|
|
700
|
+
$str2 = {
|
|
701
|
+
30 ?? cc 9b 10 fe ?? d3 10 a6 0d 9b 6f 69 69 38 d0 69 70 38
|
|
702
|
+
0f 02 0f 4a 6f 69 29 38 29 05 00 91 3f ?? ?? f1 ef 17 9f 1a
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
// Prolog breakage
|
|
706
|
+
/**
|
|
707
|
+
jint JNI_OnLoad(JavaVM *vm, void *reserved)
|
|
708
|
+
{
|
|
709
|
+
jint result;
|
|
710
|
+
__asm { BR X8 }
|
|
711
|
+
return result;
|
|
712
|
+
}
|
|
713
|
+
*/
|
|
714
|
+
$prolog_breakage1 = {
|
|
715
|
+
e? 03 (0a|09) 4b // neg w10, w10 | neg w9, w9
|
|
716
|
+
[4-16] // obfuscation
|
|
717
|
+
?? 01 0? 4a // eor w?, w?, w?
|
|
718
|
+
[4-16] // obfuscation
|
|
719
|
+
?9 01 0? ?? // and/sub w?, w1?, w?
|
|
720
|
+
[4-16] // obfuscation
|
|
721
|
+
29 7d 40 93 // sxtw x9, w9
|
|
722
|
+
(ea 03 7d b2 | 0a ?? 80 d2) // mov x10, #8 | mov x10, #0x2e0
|
|
723
|
+
[0-8] // obfuscation
|
|
724
|
+
28 21 0a 9b // madd x8, x9, x10, x8
|
|
725
|
+
[0-8] // obfuscation
|
|
726
|
+
08 01 40 f9 // ldr x8, [x8]
|
|
727
|
+
00 01 1f d6 // br x8
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
// sample 5f0819ab5247ff992bdd3d3878561c4effa32878cf6e69c174b5ed054c52588f
|
|
731
|
+
$prolog_breakage2 = {
|
|
732
|
+
(4?|5?) d0 3b d5 // mrs x9, tpidr_el0
|
|
733
|
+
29 15 40 f9 // ldr x9, [x9, 0x28]
|
|
734
|
+
a9 83 1e f8 // stur x9, [x29, -0x18]
|
|
735
|
+
08 ?? 40 f9 // ldr x8, [x8, 0x70]
|
|
736
|
+
00 01 1f d6 // br x8
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// Binaries have usually >= 6 SVC instructions
|
|
740
|
+
$svc = {
|
|
741
|
+
?8 ?? ?? ?2 // mov x8,??
|
|
742
|
+
[4-32]
|
|
743
|
+
01 00 00 d4 // svc 0x0
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
$obf_export = {
|
|
747
|
+
00 4a617661 5f 6f 5f [1-8] 00 // nullbyte + "Java_o_" + classname + nullbyte
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
$export_jnionload = {
|
|
751
|
+
004a 4e49 5f4f 6e4c 6f61 6400 // JNI_OnLoad
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
condition:
|
|
755
|
+
elf.machine == elf.EM_AARCH64
|
|
756
|
+
and any of ($str*, $hook*, $prolog_breakage*, $obf_export)
|
|
757
|
+
and $export_jnionload
|
|
758
|
+
and #svc >= 6
|
|
759
|
+
and not dexguard_native
|
|
760
|
+
and not dexguard_native_a
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
rule snapprotect : obfuscator
|
|
764
|
+
{
|
|
765
|
+
meta:
|
|
766
|
+
description = "SnapProtect"
|
|
767
|
+
url = "https://www.snapchat.com/"
|
|
768
|
+
sample = "6dcd634e41304e41b91b49a3c77872a3c7ce28777bab016bd37f79bc7bb08274"
|
|
769
|
+
author = "Eduardo Novella"
|
|
770
|
+
|
|
771
|
+
strings:
|
|
772
|
+
// "clang version 7.0.0 (snap.protect version 2.4.0 - df15518f469ca4749b08/93d2c161df4b9b202bce)"
|
|
773
|
+
$a = /clang version \d\.\d\.\d \(snap.protect version \d\.\d\.\d/
|
|
774
|
+
$b = " (snap.protect version "
|
|
775
|
+
|
|
776
|
+
condition:
|
|
777
|
+
is_elf and 1 of ($a,$b)
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
rule safeengine : obfuscator
|
|
781
|
+
{
|
|
782
|
+
meta:
|
|
783
|
+
description = "Safeengine LLVM"
|
|
784
|
+
url = "https://bbs.pediy.com/thread-195327.htm"
|
|
785
|
+
sample = "93ec9a03b76fa359a7706aed0682003b76bca971e96462540fddad297817049b"
|
|
786
|
+
author = "horsicq"
|
|
787
|
+
|
|
788
|
+
strings:
|
|
789
|
+
// "Safengine clang version 3.8.0 (trunk 608) (based on LLVM 3.8.0svn)"
|
|
790
|
+
//$clang_version = \0"Safengine clang version "
|
|
791
|
+
$clang_version = { 00 53 61 66 65 6e 67 69 6e 65 20 63 6c 61 6e 67 20 76 65 72 73 69 6f 6e 20 }
|
|
792
|
+
$based_on = "(based on LLVM "
|
|
793
|
+
|
|
794
|
+
condition:
|
|
795
|
+
all of them and is_elf
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
rule hikari : obfuscator
|
|
799
|
+
{
|
|
800
|
+
meta:
|
|
801
|
+
description = "Hikari"
|
|
802
|
+
sample = "f6b936ab06ade3de189a0cf11964f77ea3a6ad081cfd8cc4580cc87bcd7dec70"
|
|
803
|
+
url = "https://github.com/HikariObfuscator/Hikari"
|
|
804
|
+
author = "Eduardo Novella"
|
|
805
|
+
|
|
806
|
+
strings:
|
|
807
|
+
// clang version 8.0.0 (tags/RELEASE_800/final) (https://gitee.com/chenzimo/Hikari.git ecdf30fa1a4635a76c3b528a41eb48d791f4be95)
|
|
808
|
+
$version = /clang version \d+\.\d+\.\d+ \(.*\) \(.*\/Hikari\.git [0-9a-f]{40}\)/
|
|
809
|
+
|
|
810
|
+
condition:
|
|
811
|
+
is_elf and all of them
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
rule dexprotector : obfuscator
|
|
815
|
+
{
|
|
816
|
+
meta:
|
|
817
|
+
description = "DexProtector"
|
|
818
|
+
url = "https://dexprotector.com/"
|
|
819
|
+
sample = "d506e22003798f8b3a3d3c4a1b08af1cbd64667da6f9ed8cf73bc99ded73da44"
|
|
820
|
+
sample2 = "ed2486674e1cf1dcd9ad7fc17a5c0d50c1790071227ae236c976a1c92386ccff"
|
|
821
|
+
author = "Eduardo Novella"
|
|
822
|
+
|
|
823
|
+
strings:
|
|
824
|
+
/**
|
|
825
|
+
Possibly DPLF stands for "DexProtector Linkable Format"
|
|
826
|
+
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
|
|
827
|
+
0x00000000 7f45 4c46 0101 0100 4450 4c46 0000 0000 .ELF....DPLF.... // armeabi_v7a
|
|
828
|
+
0x00000000 7f45 4c46 0201 0100 4450 4c46 00e0 0100 .ELF....DPLF.... // Aarch64
|
|
829
|
+
0x00000000 7f45 4c46 0101 0100 4450 4c46 00c0 0100 .ELF....DPLF.... // x86
|
|
830
|
+
0x00000000 7f45 4c46 0201 0100 4450 4c46 00c0 0100 .ELF....DPLF.... // x86_64
|
|
831
|
+
*/
|
|
832
|
+
$dp_elf_header = { 7f45 4c46 (01|02) 01 0100 4450 4c46 }
|
|
833
|
+
|
|
834
|
+
condition:
|
|
835
|
+
is_elf and $dp_elf_header at 0
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
rule dexprotector_a : obfuscator
|
|
839
|
+
{
|
|
840
|
+
meta:
|
|
841
|
+
description = "DexProtector"
|
|
842
|
+
url = "https://dexprotector.com/"
|
|
843
|
+
sample = "f2a646f10545810f4aa079565b4d1e508acd143644492f5eec6cfe1406d33035"
|
|
844
|
+
author = "Eduardo Novella"
|
|
845
|
+
|
|
846
|
+
strings:
|
|
847
|
+
/**
|
|
848
|
+
Possibly DPLF stands for "DexProtector Linkable Format"
|
|
849
|
+
|
|
850
|
+
Segments:
|
|
851
|
+
4 0x00005000 0x51000 0x0000d000 0x51000 -rw- MAP LOAD3
|
|
852
|
+
|
|
853
|
+
- offset - 0 1 2 3 4 5 6 7 8 9 A B C D E F 0123456789ABCDEF
|
|
854
|
+
0x0000d000 4450 4c46 1125 014c b8c5 9972 4631 3e30 DPLF.%.L...rF1>0
|
|
855
|
+
0x0000d010 79d6 681a f96b 84bc 2073 6db2 1ec5 16f2 y.h..k.. sm.....
|
|
856
|
+
*/
|
|
857
|
+
$dplf_header = { 44 50 4c 46 } // DPLF
|
|
858
|
+
|
|
859
|
+
condition:
|
|
860
|
+
is_elf and
|
|
861
|
+
for any i in (0..elf.number_of_segments):
|
|
862
|
+
(
|
|
863
|
+
elf.segments[i].type == elf.PT_LOAD and
|
|
864
|
+
elf.segments[i].flags == elf.PF_R | elf.PF_W and
|
|
865
|
+
$dplf_header at elf.segments[i].offset
|
|
866
|
+
)
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
rule dexprotector_alice : obfuscator
|
|
870
|
+
{
|
|
871
|
+
meta:
|
|
872
|
+
description = "DexProtector (Alice)"
|
|
873
|
+
url = "https://licelus.com/products/dexprotector/docs/android/alice"
|
|
874
|
+
sample = "4f48625f1d4d0a1118478f61855ba96818f3907e46fbf96c55d5cebb8afe59a9"
|
|
875
|
+
author = "Eduardo Novella"
|
|
876
|
+
|
|
877
|
+
strings:
|
|
878
|
+
/**
|
|
879
|
+
libalice.so: /Users/receiver/git/dexprotector/12.7.11/alice-core/src/main/jni/../cpp/alice.cpp
|
|
880
|
+
libalice.so: /Users/receiver/git/dexprotector/12.7.11/alice-core/src/main/jni/../cpp/queue.cpp
|
|
881
|
+
libalice.so: /Users/receiver/git/dexprotector/12.7.11/alice-core/src/main/jni/../cpp/SendScheduler.cpp
|
|
882
|
+
libalice.so: /Users/receiver/git/dexprotector/12.7.11/alice-core/src/main/jni/../cpp/utils.cpp
|
|
883
|
+
*/
|
|
884
|
+
$alice_sdk = /dexprotector\/.*\/alice-core\/.*.cpp/
|
|
885
|
+
$dp_log = {
|
|
886
|
+
2e64 6578 705f 6372 6173 685f 7469 6d65 7200 6465 7870 5f63 7261 7368 5f00 // dexp_crash_timer.dexp_crash_.
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
condition:
|
|
890
|
+
is_elf and any of them
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
rule androidrepublic : obfuscator
|
|
894
|
+
{
|
|
895
|
+
meta:
|
|
896
|
+
description = "AndroidRepublic"
|
|
897
|
+
url = "https://androidrepublic.org/"
|
|
898
|
+
sample = "b893b45852ccfe4e037a356348042e613c47ae56e554943d8b3998c0cbb3ffb9"
|
|
899
|
+
author = "Eduardo Novella"
|
|
900
|
+
|
|
901
|
+
strings:
|
|
902
|
+
$str1 = { 00 6c 69 62 65 6d 74 72 65 70 75 62 6c 69 63 76 33 2e 73 6f 00 } // .libemtrepublicv3.so.
|
|
903
|
+
$str2 = { 00 61 6e 64 72 6f 69 64 72 65 70 75 62 6c 69 63 2e 6f 72 67 00 } // .androidrepublic.org.
|
|
904
|
+
$str3 = "We are Android Republic, while you snoop around trying to imitate, we are inovating the latest in Android Game modifications www.androidrepublic.org the oldest, the best and the future."
|
|
905
|
+
|
|
906
|
+
condition:
|
|
907
|
+
is_elf and 2 of them
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
rule androidrepublic_vip : obfuscator
|
|
911
|
+
{
|
|
912
|
+
meta:
|
|
913
|
+
description = "AndroidRepublic VIP"
|
|
914
|
+
url = "https://androidrepublic.org/"
|
|
915
|
+
sample = "ea1c69b7ba4f43ddcfb615e3fc5ff87d599232e6df089845a0e663d4bea761e0"
|
|
916
|
+
author = "Eduardo Novella"
|
|
917
|
+
|
|
918
|
+
strings:
|
|
919
|
+
$lib = {
|
|
920
|
+
006c 6962 616e 6472 6f69 6472 6570 7562 6c69 632e 736f 00 // .libandroidrepublic.so.
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
condition:
|
|
924
|
+
is_elf and all of them
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
rule ay : obfuscator
|
|
928
|
+
{
|
|
929
|
+
meta:
|
|
930
|
+
description = "AY"
|
|
931
|
+
url = "https://github.com/adamyaxley/Obfuscate"
|
|
932
|
+
sample = "35b451d7cb3ad93ece0cc1c9119356b7f11876ef116051fa1343bf88f0e2ef75"
|
|
933
|
+
author = "Eduardo Novella"
|
|
934
|
+
|
|
935
|
+
strings:
|
|
936
|
+
$export = /\_ZN2ay\d\dobfuscated_dataILy(.*)decryptEv/
|
|
937
|
+
|
|
938
|
+
condition:
|
|
939
|
+
is_elf and all of them
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
rule octopus_codevo : obfuscator
|
|
943
|
+
{
|
|
944
|
+
meta:
|
|
945
|
+
description = "Octopus SDK (Codevo)"
|
|
946
|
+
url = "https://codevo.com.tr/portfolio/"
|
|
947
|
+
sample = "886777034851adef9068b28c9ea54c52545dc68a7e692abffbc2d90807ead402" // com.garantiemeklilik.cepsube
|
|
948
|
+
author = "Eduardo Novella"
|
|
949
|
+
|
|
950
|
+
strings:
|
|
951
|
+
// octopus_obf::obfuscated_data<10ull,10751603028664370595ull>::~obfuscated_data()
|
|
952
|
+
$export = /\_ZN\d{1,2}octopus_obf\d{1,2}obfuscated_dataILy(.*)Ev/
|
|
953
|
+
|
|
954
|
+
condition:
|
|
955
|
+
is_elf and all of them
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
rule epona : protector
|
|
959
|
+
{
|
|
960
|
+
meta:
|
|
961
|
+
description = "Quarks AppShield (Epona)"
|
|
962
|
+
url = "https://www.quarkslab.com/white-box-cryptography/"
|
|
963
|
+
sample = "db42bc905f5a3e6f67d1726ce358475614627f8356515ba79fc2b0cabbb65522" // euro.pccw.view 5.5.0
|
|
964
|
+
author = "Eduardo Novella"
|
|
965
|
+
|
|
966
|
+
strings:
|
|
967
|
+
$whitebox_crypto = {
|
|
968
|
+
0D 04 40 39 // LDRB W13, [X0,#1]
|
|
969
|
+
0E 08 40 39 // LDRB W14, [X0,#2]
|
|
970
|
+
0F 0C 40 39 // LDRB W15, [X0,#3]
|
|
971
|
+
02 14 40 39 // LDRB W2, [X0,#5]
|
|
972
|
+
04 1C 40 39 // LDRB W4, [X0,#7]
|
|
973
|
+
0C 00 40 39 // LDRB W12, [X0]
|
|
974
|
+
10 10 40 39 // LDRB W16, [X0,#4]
|
|
975
|
+
03 18 40 39 // LDRB W3, [X0,#6]
|
|
976
|
+
05 20 40 39 // LDRB W5, [X0,#8]
|
|
977
|
+
06 24 40 39 // LDRB W6, [X0,#9]
|
|
978
|
+
07 28 40 39 // LDRB W7, [X0,#0xA]
|
|
979
|
+
13 2C 40 39 // LDRB W19, [X0,#0xB]
|
|
980
|
+
14 30 40 39 // LDRB W20, [X0,#0xC]
|
|
981
|
+
15 34 40 39 // LDRB W21, [X0,#0xD]
|
|
982
|
+
16 38 40 39 // LDRB W22, [X0,#0xE]
|
|
983
|
+
00 3C 40 39 // LDRB W0, [X0,#0xF]
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
condition:
|
|
987
|
+
is_elf and any of them
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|