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.
Files changed (104) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +249 -0
  3. package/anais.sh +669 -0
  4. package/analysis_tools/__pycache__/apk_basic_info.cpython-313.pyc +0 -0
  5. package/analysis_tools/__pycache__/apk_basic_info.cpython-314.pyc +0 -0
  6. package/analysis_tools/__pycache__/check_zip_encryption.cpython-313.pyc +0 -0
  7. package/analysis_tools/__pycache__/check_zip_encryption.cpython-314.pyc +0 -0
  8. package/analysis_tools/__pycache__/detect_obfuscation.cpython-313.pyc +0 -0
  9. package/analysis_tools/__pycache__/detect_obfuscation.cpython-314.pyc +0 -0
  10. package/analysis_tools/__pycache__/dex_payload_hunter.cpython-314.pyc +0 -0
  11. package/analysis_tools/__pycache__/entropy_analyzer.cpython-314.pyc +0 -0
  12. package/analysis_tools/__pycache__/error_logger.cpython-313.pyc +0 -0
  13. package/analysis_tools/__pycache__/error_logger.cpython-314.pyc +0 -0
  14. package/analysis_tools/__pycache__/find_encrypted_payload.cpython-314.pyc +0 -0
  15. package/analysis_tools/__pycache__/fix_apk_headers.cpython-313.pyc +0 -0
  16. package/analysis_tools/__pycache__/fix_apk_headers.cpython-314.pyc +0 -0
  17. package/analysis_tools/__pycache__/manifest_analyzer.cpython-313.pyc +0 -0
  18. package/analysis_tools/__pycache__/manifest_analyzer.cpython-314.pyc +0 -0
  19. package/analysis_tools/__pycache__/network_analyzer.cpython-313.pyc +0 -0
  20. package/analysis_tools/__pycache__/network_analyzer.cpython-314.pyc +0 -0
  21. package/analysis_tools/__pycache__/report_generator.cpython-313.pyc +0 -0
  22. package/analysis_tools/__pycache__/report_generator.cpython-314.pyc +0 -0
  23. package/analysis_tools/__pycache__/report_generator_modular.cpython-314.pyc +0 -0
  24. package/analysis_tools/__pycache__/sast_scanner.cpython-313.pyc +0 -0
  25. package/analysis_tools/__pycache__/sast_scanner.cpython-314.pyc +0 -0
  26. package/analysis_tools/__pycache__/so_string_analyzer.cpython-314.pyc +0 -0
  27. package/analysis_tools/__pycache__/yara_enhanced_analyzer.cpython-314.pyc +0 -0
  28. package/analysis_tools/__pycache__/yara_results_processor.cpython-314.pyc +0 -0
  29. package/analysis_tools/apk_basic_info.py +85 -0
  30. package/analysis_tools/check_zip_encryption.py +142 -0
  31. package/analysis_tools/detect_obfuscation.py +650 -0
  32. package/analysis_tools/dex_payload_hunter.py +734 -0
  33. package/analysis_tools/entropy_analyzer.py +335 -0
  34. package/analysis_tools/error_logger.py +75 -0
  35. package/analysis_tools/find_encrypted_payload.py +485 -0
  36. package/analysis_tools/fix_apk_headers.py +154 -0
  37. package/analysis_tools/manifest_analyzer.py +214 -0
  38. package/analysis_tools/network_analyzer.py +287 -0
  39. package/analysis_tools/report_generator.py +506 -0
  40. package/analysis_tools/report_generator_modular.py +885 -0
  41. package/analysis_tools/sast_scanner.py +412 -0
  42. package/analysis_tools/so_string_analyzer.py +406 -0
  43. package/analysis_tools/yara_enhanced_analyzer.py +330 -0
  44. package/analysis_tools/yara_results_processor.py +368 -0
  45. package/analyzer_config.json +113 -0
  46. package/apkid/__init__.py +32 -0
  47. package/apkid/__pycache__/__init__.cpython-313.pyc +0 -0
  48. package/apkid/__pycache__/__init__.cpython-314.pyc +0 -0
  49. package/apkid/__pycache__/apkid.cpython-313.pyc +0 -0
  50. package/apkid/__pycache__/apkid.cpython-314.pyc +0 -0
  51. package/apkid/__pycache__/main.cpython-313.pyc +0 -0
  52. package/apkid/__pycache__/main.cpython-314.pyc +0 -0
  53. package/apkid/__pycache__/output.cpython-313.pyc +0 -0
  54. package/apkid/__pycache__/rules.cpython-313.pyc +0 -0
  55. package/apkid/apkid.py +266 -0
  56. package/apkid/main.py +98 -0
  57. package/apkid/output.py +177 -0
  58. package/apkid/rules/apk/common.yara +68 -0
  59. package/apkid/rules/apk/obfuscators.yara +118 -0
  60. package/apkid/rules/apk/packers.yara +1197 -0
  61. package/apkid/rules/apk/protectors.yara +301 -0
  62. package/apkid/rules/dex/abnormal.yara +104 -0
  63. package/apkid/rules/dex/anti-vm.yara +568 -0
  64. package/apkid/rules/dex/common.yara +60 -0
  65. package/apkid/rules/dex/compilers.yara +434 -0
  66. package/apkid/rules/dex/obfuscators.yara +602 -0
  67. package/apkid/rules/dex/packers.yara +761 -0
  68. package/apkid/rules/dex/protectors.yara +520 -0
  69. package/apkid/rules/dll/common.yara +38 -0
  70. package/apkid/rules/dll/obfuscators.yara +43 -0
  71. package/apkid/rules/elf/anti-vm.yara +43 -0
  72. package/apkid/rules/elf/common.yara +54 -0
  73. package/apkid/rules/elf/obfuscators.yara +991 -0
  74. package/apkid/rules/elf/packers.yara +1128 -0
  75. package/apkid/rules/elf/protectors.yara +794 -0
  76. package/apkid/rules/res/common.yara +43 -0
  77. package/apkid/rules/res/obfuscators.yara +46 -0
  78. package/apkid/rules/res/protectors.yara +46 -0
  79. package/apkid/rules.py +77 -0
  80. package/bin/anais +3 -0
  81. package/dist/cli.js +82 -0
  82. package/dist/index.js +123 -0
  83. package/dist/types/index.js +2 -0
  84. package/dist/utils/index.js +21 -0
  85. package/dist/utils/output.js +44 -0
  86. package/dist/utils/paths.js +107 -0
  87. package/docs/ARCHITECTURE.txt +353 -0
  88. package/docs/Workflow and Reference.md +445 -0
  89. package/package.json +70 -0
  90. package/rules/yara_general_rules.yar +323 -0
  91. package/scripts/dynamic_analysis_helper.sh +334 -0
  92. package/scripts/frida/dpt_dex_dumper.js +145 -0
  93. package/scripts/frida/frida_dex_dump.js +145 -0
  94. package/scripts/frida/frida_hooks.js +437 -0
  95. package/scripts/frida/frida_websocket_extractor.js +154 -0
  96. package/scripts/setup.sh +206 -0
  97. package/scripts/validate_framework.sh +224 -0
  98. package/src/cli.ts +91 -0
  99. package/src/index.ts +123 -0
  100. package/src/types/index.ts +44 -0
  101. package/src/utils/index.ts +6 -0
  102. package/src/utils/output.ts +50 -0
  103. package/src/utils/paths.ts +72 -0
  104. package/tsconfig.json +14 -0
@@ -0,0 +1,520 @@
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 CNProtect_dex : protector
31
+ {
32
+ // https://github.com/rednaga/APKiD/issues/52
33
+ meta:
34
+ description = "CNProtect (anti-disassemble)"
35
+ sample = "5bf6887871ce5f00348b1ec6886f9dd10b5f3f5b85d3d628cf21116548a3b37d"
36
+
37
+ strings:
38
+ // code segment of the injected methods plus junk opcodes
39
+ $code_segment = {
40
+ 02 00 01 00 00 00 00 00 ?? ?? ?? ?? 11 00 00 00 00 (1? | 2? | 3? | 4? | 5? | 6? | 7? | 8? | 9? | a? | b? | c0 | c1 | c2 | c3 | c4 | c5 | c6 | c7)
41
+ }
42
+
43
+ condition:
44
+ is_dex and
45
+ $code_segment
46
+ }
47
+
48
+ rule whitecryption_dex : protector
49
+ {
50
+ // https://github.com/rednaga/APKiD/issues/177
51
+ meta:
52
+ description = "WhiteCryption"
53
+ sample = "6821bce73b3d1146ef7ec9a2d91742a7f6fc2f8206ca9354d3d553e1b5d551a7"
54
+ url = "https://www.intertrust.com/products/application-shielding/"
55
+ author = "Tim 'diff' Strazzere"
56
+
57
+ strings:
58
+ // Loader class which doesnt appear to get obfuscated in these versions, plus
59
+ // the surrounding null bytes and sizing used for the dex string table
60
+ // Lcom/whitecryption/jcp/generated/scp;
61
+ $loader = {
62
+ 00 25 4C 63 6F 6D 2F 77 68 69 74 65 63 72 79 70
63
+ 74 69 6F 6E 2F 6A 63 70 2F 67 65 6E 65 72 61 74
64
+ 65 64 2F 73 63 70 3B 00
65
+ }
66
+ // __scpClassInit with surrounding size and null bytes
67
+ $init_stub = { 00 0E 5F 5F 73 63 70 43 6C 61 73 73 49 6E 69 74 00 }
68
+
69
+ condition:
70
+ is_dex and ($loader or $init_stub)
71
+ }
72
+
73
+ rule whitecryption_dex_a : protector
74
+ {
75
+ meta:
76
+ description = "WhiteCryption"
77
+ url = "https://www.intertrust.com/products/application-shielding/"
78
+ sample = "6ca8315fdb3fc2af989dd49806102bc3720b214f2053297b9f1041ab4f2f81b2"
79
+ author = "Eduardo Novella"
80
+
81
+ strings:
82
+ $s1 = "http://www.whitecryption.com"
83
+ $s2 = /\(c\) 20\d{2} whiteCryption/
84
+ $s3 = "http://www.cryptanium.com"
85
+ $s4 = "CryptaniumHighSpeedAes"
86
+ $s5 = "Lcom/cryptanium/skb/"
87
+ $s6 = "SecureKeyBoxJava"
88
+
89
+ condition:
90
+ is_dex and 3 of ($s*)
91
+ }
92
+
93
+ rule appdome_dex : protector
94
+ {
95
+ // https://github.com/rednaga/APKiD/issues/151
96
+ meta:
97
+ description = "Appdome"
98
+ sample = "1c6496f1cc8c5799539ee24170c371e8a57547e2eb73c9502c98ff78f44c74cf"
99
+ url = "https://www.appdome.com/"
100
+ author = "Tim 'diff' Strazzere"
101
+
102
+ strings:
103
+ // Loader class injected into everything, surrounding null bytes and size
104
+ // Lruntime/loading/InjectedActivity;
105
+ $loader = {
106
+ 00 22 4C 72 75 6E 74 69 6D 65 2F 6C 6F 61 64 69
107
+ 6E 67 2F 49 6E 6A 65 63 74 65 64 41 63 74 69 76
108
+ 69 74 79 3B 00
109
+ }
110
+
111
+ condition:
112
+ is_dex and $loader
113
+ }
114
+
115
+ rule insidesecure : protector
116
+ {
117
+ meta:
118
+ description = "InsideSecure Verimatrix"
119
+ url = "https://www.verimatrix.com/products/app-shield/"
120
+ sample = "edb939d77adba5ef5c536c352a4bc25a3a5ff2fe15408c5af9f08b5af583224c" // dk.mitid.app.android v2.3.7
121
+ author = "Eduardo Novella"
122
+
123
+ strings:
124
+ // Loader class injected into everything, surrounding null bytes and size
125
+ // 00 + size + Lcom/insidesecure/core/
126
+ $class = {
127
+ 00 ?? 4c 636f 6d2f 696e 7369 6465 7365 6375 7265 2f 63 6f72 652f
128
+ }
129
+
130
+ condition:
131
+ is_dex and all of them
132
+ }
133
+
134
+ rule free_rasp_dex : protector
135
+ {
136
+ meta:
137
+ description = "FreeRASP"
138
+ sample = "e10b8772fd9b6aaf8ba030c5bcb324fb9b91f34e893a62bdf238629df856e047"
139
+ url = "https://www.talsec.app/freerasp-in-app-protection-security-talsec"
140
+ author = "Fare9"
141
+
142
+ strings:
143
+ // Decryption method found in DEX files, since strings will change
144
+ // and other offsets change, we add ?? to some instructions
145
+ $decryption = {
146
+ 6e 10 ?? ?? 08 00 // invoke-virtual {v8}, Ljava/lang/String.length()I
147
+ 0a 00 // move-result v0
148
+ db 00 00 02 // div-int/lit8 v0, v0, 0x2
149
+ 23 01 ?? ?? // new-array v1, v0, [B
150
+ 12 02 // const/4 v2, 0
151
+ 12 03 // const/4 v3, 0
152
+ 12 04 // const/4 v4, 0
153
+ 6e 10 ?? ?? 08 00 // invoke-virtual {v8}, Ljava/lang/String.length()I
154
+ 0a 05 // move-result v5
155
+ 35 53 28 00 // if-ge v3, v5, 0x0016c83a
156
+ d8 05 03 01 // add-int/lit8 v5, v3, 0x1
157
+ 6e 20 ?? ?? 38 00 // invoke-virtual {v8, v3}, Ljava/lang/String.charAt(I)C
158
+ 0a 03 // move-result v3
159
+ 13 06 10 00 // const/16 v6, 0x10
160
+ 71 20 ?? ?? 63 00 // invoke-static {v3, v6}, Ljava/lang/Character.digit(CI)I
161
+ 0a 03 // move-result v3
162
+ e0 03 03 04 // shl-int/lit8 v3, v3, 0x4
163
+ 8d 33 // int-to-byte v3, v3
164
+ 4f 03 01 04 // aput-byte v3, v1, v4
165
+ 48 03 01 04 // aget-byte v3, v1, v4
166
+ d8 07 05 01 // add-int/lit8 v7, v5, 0x1
167
+ 6e 20 ?? ?? 58 00 // invoke-virtual {v8, v5}, Ljava/lang/String.charAt(I)C
168
+ 0a 05 // move-result v5
169
+ 71 20 ?? ?? 65 00 // invoke-static {v5, v6}, Ljava/lang/Character.digit(CI)I
170
+ 0a 05 // move-result v5
171
+ 8d 55 // int-to-byte v5, v5
172
+ b0 53 // add-int/2addr v3, v5
173
+ 8d 33 // int-to-byte v3, v3
174
+ 4f 03 01 04 // aput-byte v3, v1, v4
175
+ d8 04 04 01 // add-int/lit8 v4, v4, 0x1
176
+ 01 73 // move v3, v7
177
+ 28 d5 // goto 0x0016c7e2
178
+ 23 08 ?? ?? // new-array v8, v0, [B
179
+ 35 02 12 00 // if-ge v2, v0, 0x0016c862
180
+ 48 03 01 02 // aget-byte v3, v1, v2
181
+ 62 04 ?? ?? // sget-object v4, Lx0/o;->a [B
182
+ 21 45 // array-length v5, v4
183
+ 94 05 02 05 // rem-int v5, v2, v5
184
+ 48 04 04 05 // aget-byte v4, v4, v5
185
+ b7 43 // xor-int/2addr v3, v4
186
+ 8d 33 // int-to-byte v3, v3
187
+ 4f 03 08 02 // aput-byte v3, v8, v2
188
+ d8 02 02 01 // add-int/lit8 v2, v2, 0x1
189
+ 28 ef // goto 0x0016c83e
190
+ 22 00 ?? ?? // new-instance v0, Ljava/lang/String;
191
+ 70 20 ?? ?? 80 00 // invoke-direct {v0, v8}, Ljava/lang/String.<init>([B)V
192
+ 11 00 // return-object v0
193
+ }
194
+
195
+ condition:
196
+ is_dex and $decryption
197
+ }
198
+
199
+ rule appiron : protector
200
+ {
201
+ meta:
202
+ description = "Secucen AppIron"
203
+ url = "http://www.secucen.com/app/view/fintech/appIron"
204
+ sample = "d4f4a24ce6350bc4e23e2170da5b217dd65161aba5eca775d75514e9cdac4d59"
205
+ author = "dustty0 & Eduardo Novella"
206
+
207
+ strings:
208
+ $pkg1 = {
209
+ 0023 4c63 6f6d 2f62 6172 756e 2f61 // .#Lcom/barun/a
210
+ 7070 6972 6f6e 2f61 6e64 726f 6964 2f41 // ppiron/android/A
211
+ 7070 4972 6f6e 3b00 // ppIron;.
212
+ }
213
+
214
+ $pkg2 = {
215
+ 00 2d4c 636f // .-Lco
216
+ 6d2f 7365 6375 6365 6e2f 6170 7069 726f // m/secucen/appiro
217
+ 6e65 7870 7265 7373 2f41 7070 4972 6f6e // nexpress/AppIron
218
+ 4578 6365 7074 696f 6e3b 00 // Exception;.
219
+ }
220
+
221
+ $pkg3 = {
222
+ 002b 4c63 6f6d // +Lcom
223
+ 2f73 6563 7563 656e 2f61 7070 6972 6f6e // /secucen/appiron
224
+ 6578 7072 6573 732f 4170 7049 726f 6e45 // express/AppIronE
225
+ 7870 7265 7373 3b00 // xpress;.
226
+ }
227
+
228
+ condition:
229
+ is_dex and any of them
230
+ }
231
+
232
+ rule ahope_appshield : protector
233
+ {
234
+ meta:
235
+ description = "Ahope AppShield"
236
+ url = "http://www.ahope.net/sub/app-shields"
237
+ sample = "42a4d907caf625ff73d5b6fbbf32b59ba14d6d5a72f28b81bdc76c47db516122"
238
+ author = "dustty0 & Eduardo Novella"
239
+
240
+ strings:
241
+ $pkg1 = {
242
+ 00 234c 636f 6d2f // .#Lcom/
243
+ 6168 6f70 652f 6170 705f 7368 6965 6c64 // ahope/app_shield
244
+ 732f 4275 696c 6443 6f6e 6669 673b 00 // s/BuildConfig;.H
245
+ }
246
+
247
+ $pkg2 = {
248
+ 00 254c 636f 6d2f // .%Lcom/
249
+ 6168 6f70 652f 6170 705f 7368 6965 6c64 // ahope/app_shield
250
+ 732f 5075 7265 4170 7043 6c69 656e 743b // s/PureAppClient;
251
+ 00
252
+ }
253
+
254
+ condition:
255
+ is_dex and any of them
256
+ }
257
+
258
+ rule vguard : protector
259
+ {
260
+ meta:
261
+ description = "VGuard"
262
+ url = "https://www.vguard.co.kr"
263
+ sample = "7024bdadb53cbec86a39de845108b182ed2f7b3f0e7c0b876a948e1532ec5b9f"
264
+ author = "dustty0"
265
+
266
+ strings:
267
+ $pkg = {
268
+ 001b 4c6b 722f 636f 2f73 646b 2f76 6775 6172 6432 // ..Lkr/co/sdk/vguard2
269
+ 2f45 6465 784a 4e49 3b00 // /EdexJNI;.
270
+ }
271
+
272
+ condition:
273
+ is_dex and any of them
274
+ }
275
+
276
+ rule appdefence : protector
277
+ {
278
+ meta:
279
+ description = "ExTrus AppDefence"
280
+ url = "https://www.extrus.co.kr/eng/m/product_01_05.html"
281
+ sample = "e080380673479d2e182ad7eff5130bb72fe9a228c0a5de9852df23c4e98113b2"
282
+ author = "dustty0"
283
+
284
+ strings:
285
+ $pkg = {
286
+ 003e 4c6e 6574 2f65 7874 7275 732f 6578 6166 // .>Lnet/extrus/exaf
287
+ 652f 6170 7064 6566 656e 6365 2f6d 6f64 756c 652f // e/appdefence/module/
288
+ 6170 7064 6566 656e 6365 2f44 6566 656e 6365 4170 // appdefence/DefenceAp
289
+ 6949 6d70 6c3b 00 // iImpl;.
290
+ }
291
+
292
+ condition:
293
+ is_dex and all of them
294
+ }
295
+
296
+ rule xiaomi_xsof_sdk : protector
297
+ {
298
+ meta:
299
+ description = "Xiaomi Security Open Service Client SDK"
300
+ url = "https://dev.mi.com/distribute/doc/details?pId=1746"
301
+ sample = "3a01186dbb3cb550d4b6139c8d82e39e74f7b3cc74966a27232e91c164817fe1"
302
+ author = "aviraxp"
303
+
304
+ strings:
305
+ // .?com.xiaomi.security.xsof.?
306
+ $s = {
307
+ 00 ?? 636f 6d2e 7869 616f 6d69 2e73 6563 7572 6974 792e 7873 6f66 2e [1-128] 00
308
+ }
309
+
310
+ condition:
311
+ is_dex and #s > 1
312
+ }
313
+
314
+ rule dpt_shell : protector
315
+ {
316
+ meta:
317
+ description = "DPT Shell"
318
+ url = "https://github.com/luoyesiqiu/dpt-shell"
319
+ sample = "0c4341700f4e685cafc9c86c9112098b75057580ba1f7163bc971347af3712ad"
320
+ author = "Abhi"
321
+
322
+ strings:
323
+ $s1 = { 00 ?? 4C 63 6F 6D 2F 6C 75 6F 79 65 2F 64 70 74 } // .??Lcom/luoye/dpt
324
+ $s2 = { 00 ?? 4C 63 6F 6D 2F 6C 75 6F 79 65 73 69 71 69 75 2F 73 68 65 6C 6C } // .??Lcom/luoyesiqiu/shell
325
+ $s3 = { 00 08 64 70 74 2D 6C 69 62 73 00 } // dpt-libs
326
+ $s4 = { 00 0D 64 70 74 5F 4A 6E 69 42 72 69 64 67 65 00 } // dpt_JniBridge
327
+ $s5 = { 00 09 6C 69 62 64 70 74 2E 73 6F 00 } // libdpt.so
328
+
329
+ condition:
330
+ is_dex and any of them
331
+ }
332
+
333
+ rule ahnlab_v3_engine : anti_root
334
+ {
335
+ meta:
336
+ description = "Ahnlab V3 Engine"
337
+ url = "https://www.ahnlab.com/en"
338
+ sample = "638bad9c6336049f43ac88d7db65c743d9703d732f86f2dc094999b195d63aa2"
339
+ author = "whoa-mi"
340
+
341
+ strings:
342
+ $class = "Lcom/ahnlab/enginesdk/"
343
+ condition:
344
+ is_dex and #class > 10
345
+ }
346
+
347
+ rule nhn_appguard_dex : protector
348
+ {
349
+ meta:
350
+ description = "NHN AppGuard"
351
+ url = "https://www.nhncloud.com/kr/service/security/nhn-appguard"
352
+ sample = "bafa2a9acf4af696b92e0a1ddcf7f470d49a7f3bc27b5c1b1e3ecbdf17049285" // jp.pjfb
353
+ author = "Abhi"
354
+
355
+ strings:
356
+ $package = { 00 ?? 4C 63 6F 6D 2F 6E 68 6E (63 6C 6F 75 64 | 65 6E 74) 2F 61 70 70 67 75 61 72 64 2F } // .??Lcom/nhn(cloud|ent)/appguard/
357
+
358
+ condition:
359
+ is_dex and all of them
360
+ }
361
+
362
+ rule protectt_dex : protector
363
+ {
364
+ meta:
365
+ description = "Protectt"
366
+ sample = "c246d85560599f91e9c3ed7e59df2dd4e21aaf667f3f2965c28c43d9842f5e75" // com.rblbank.mobank
367
+ url = "https://www.protectt.ai"
368
+ author = "Abhi"
369
+
370
+ strings:
371
+ $class = { 00 1C 4C 61 69 2F 70 72 6F 74 65 63 74 74 2F 61 70 70 2F 73 65 63 75 72 69 74 79 2F 52 3B 00 } // ..Lai/protectt/app/security/R;.
372
+
373
+ condition:
374
+ is_dex and all of them
375
+ }
376
+
377
+ rule flutter_security_checker : protector
378
+ {
379
+ meta:
380
+ description = "Flutter Security Checker"
381
+ url = "https://pub.dev/packages/flutter_security_checker"
382
+ sample = "045d548cfd282d1aa8993efd22846ff49b0c48d99590cc36e3cf6c633dd85bcc" // com.swisssign.swissid.mobile
383
+ author = "Abhi"
384
+
385
+ strings:
386
+ $class = { 00 43 4C 63 6F 6D 2F 70 72 61 76 65 72 61 2F 66 6C 75 74 74 65 72 5F
387
+ 73 65 63 75 72 69 74 79 5F 63 68 65 63 6B 65 72 2F 46 6C 75 74 74 65
388
+ 72 53 65 63 75 72 69 74 79 43 68 65 63 6B 65 72 50 6C 75 67 69 6E 3B 00 } // Lcom/pravera/flutter_security_checker/FlutterSecurityCheckerPlugin;
389
+
390
+ condition:
391
+ is_dex and all of them
392
+ }
393
+
394
+ rule flutterjailbreakdetection : anti_root
395
+ {
396
+ meta:
397
+ description = "Flutter Jailbreak Detection (RootBeer)"
398
+ url = "https://pub.dev/packages/flutter_jailbreak_detection"
399
+ sample = "045d548cfd282d1aa8993efd22846ff49b0c48d99590cc36e3cf6c633dd85bcc" // com.swisssign.swissid.mobile
400
+ author = "Abhi"
401
+
402
+ strings:
403
+ $class = { 00 46 4C 61 70 70 6D 69 72 65 2F 62 65 2F 66 6C 75 74 74 65 72 6A 61 69
404
+ 6C 62 72 65 61 6B 64 65 74 65 63 74 69 6F 6E 2F 46 6C 75 74 74 65 72 4A
405
+ 61 69 6C 62 72 65 61 6B 44 65 74 65 63 74 69 6F 6E 50 6C 75 67 69 6E 3B 00 } // Lappmire/be/flutterjailbreakdetection/FlutterJailbreakDetectionPlugin;
406
+
407
+ condition:
408
+ is_dex and all of them
409
+ }
410
+
411
+ rule rootbeer : anti_root
412
+ {
413
+ meta:
414
+ description = "RootBeer"
415
+ url = "https://github.com/scottyab/rootbeer.git"
416
+ sample = "607ec962ba93cc9817129cb693ff0f335f500a297b5a297e71fbb998d0f6849c" // com.scottyab.rootbeer.sample
417
+ author = "Abhi"
418
+
419
+ strings:
420
+ $class = { 00 20 4C 63 6F 6D 2F 73 63 6F 74 74 79 61 62 2F 72
421
+ 6F 6F 74 62 65 65 72 2F 52 6F 6F 74 42 65 65 72 3B 00 } // Lcom/scottyab/rootbeer/RootBeer;
422
+
423
+ condition:
424
+ is_dex and all of them
425
+ }
426
+
427
+ rule build38 : protector
428
+ {
429
+ meta:
430
+ description = "Build38"
431
+ url = "https://build38.com"
432
+ sample = "cfbbfca598a9877a381583a7ae2f9e8cde92e7314b21152658bcba5a4e3a0fff" // com.esignus.hashwalletmanager
433
+ author = "Abhi, ApkUnpacker"
434
+
435
+ strings:
436
+ $class = { 00 15 4C 63 6F 6D 2F 62 75 69 6C 64 33 38 2F 74 61 6B 2F 54 41 4B 3B 00 } // Lcom/build38/tak/TAK;
437
+ $package_name = { 00 0F 63 6F 6D 2E 62 75 69 6C 64 33 38 2E 74 61 6B 00 } // com.build38.tak
438
+ $module_class = { 00 0D 42 75 69 6C 64 33 38 4D 6F 64 75 6C 65 00 } // Build38Module
439
+ $license_name = { 00 0B 6C 69 63 65 6E 73 65 2E 74 61 6B 00 } // license.tak
440
+
441
+ condition:
442
+ is_dex and any of them
443
+ }
444
+
445
+ rule shield_sdk : protector
446
+ {
447
+ meta:
448
+ description = "Shield SDK"
449
+ url = "https://shield.com/"
450
+ sample = "fb4b7f033658b3898e0448955491b448a2c78e1a2325c65fece6ad64f6f6b6d0" // com.mpl.androidapp
451
+ author = "Abhi"
452
+
453
+ strings:
454
+ $class = { 00 1B 4C 63 6F 6D 2F 73 68 69 65 6C 64 2F 61 6E 64
455
+ 72 6F 69 64 2F 53 68 69 65 6C 64 3B 00 } // Lcom/shield/android/Shield;
456
+ $class2 = { 00 29 4C 63 6F 6D 2F 73 68 69 65 6C 64 2F 61 6E 64
457
+ 72 6F 69 64 2F 69 6E 74 65 72 6E 61 6C 2F 4E 61 74
458
+ 69 76 65 55 74 69 6C 73 3B 00 } // Lcom/shield/android/internal/NativeUtils;
459
+ $class3 = { 00 27 4C 63 6F 6D 2F 73 68 69 65 6C 64 2F 61 6E 64
460
+ 72 6F 69 64 2F 63 6F 6D 6D 6F 6E 2F 42 75 69 6C 64
461
+ 43 6F 6E 66 69 67 3B 00 } // Lcom/shield/android/common/BuildConfig;
462
+ $class4 = { 00 28 4C 63 6F 6D 2F 73 68 69 65 6C 64 2F 61 6E 64
463
+ 72 6F 69 64 2F 63 6F 6D 6D 6F 6E 2F 53 68 69 65 6C
464
+ 64 4D 6F 64 75 6C 65 3B 00 } // Lcom/shield/android/common/ShieldModule;
465
+
466
+ condition:
467
+ is_dex and any of them
468
+ }
469
+
470
+ rule bugsmirror : protector
471
+ {
472
+ meta:
473
+ description = "BugsMirror"
474
+ url = "https://www.bugsmirror.com/"
475
+ sample = "c9bbf66ac86bf02663b7bc28a735881d4aeaa8d90e9b8b752e9cf337a26f0bdd"
476
+ author = "Abhi"
477
+
478
+ strings:
479
+ $tag = { 00 12 42 75 67 73 6D 69 72 72 6F 72 44 65 66 65 6E
480
+ 64 65 72 00 } // BugsMirrorDefender
481
+ $pkg_name = { 00 16 63 6F 6D 2E 62 75 67 73 6D 69 72 72 6F 72 64
482
+ 65 66 65 6E 64 65 72 00 } // com.bugsmirrordefender
483
+ $service = { 00 35 42 75 67 73 6D 69 72 72 6F 72 44 65 66 65 6E
484
+ 64 65 72 53 65 72 76 69 63 65 73 2E 42 75 67 73 6D
485
+ 69 72 72 6F 72 44 65 66 65 6E 64 65 72 53 65 72 76
486
+ 69 63 65 73 00 } // BugsmirrorDefenderServices.BugsmirrorDefenderServices
487
+ $filter = { 00 19 63 6F 6D 2E 62 75 67 73 6D 69 72 72 6F 72 2E
488
+ 6D 69 74 69 67 61 74 69 6F 6E 00 } // com.bugsmirror.mitigation
489
+ $class = { 00 22 4C 63 6F 6D 2F 62 75 67 73 6D 69 72 72 6F 72
490
+ 2F 64 65 66 65 6E 64 65 72 2F 44 65 66 65 6E 64 65
491
+ 72 3B 00 } // Lcom/bugsmirror/defender/Defender;
492
+ $class2 = { 3B 00 1B 4C 63 6F 6D 2F 62 75 67 73 6D 69 72 72 6F
493
+ 72 2F 64 65 66 65 6E 64 65 72 2F 52 3B 00 } // com/bugsmirror/defender/R;
494
+ $class3 = { 00 24 4C 63 6F 6D 2F 62 75 67 73 6D 69 72 72 6F 72
495
+ 64 65 66 65 6E 64 65 72 2F 42 75 69 6C 64 43 6F 6E
496
+ 66 69 67 3B 00 } // Lcom/bugsmirrordefender/BuildConfig;
497
+ $class4 = { 00 45 4C 63 6F 6D 2F 62 75 67 73 6D 69 72 72 6F 72
498
+ 2F 64 65 66 65 6E 64 65 72 61 70 69 2F 67 65 6E 65
499
+ 72 61 74 65 64 2F 42 75 67 73 6D 69 72 72 6F 72 44
500
+ 65 66 65 6E 64 65 72 53 65 72 76 69 63 65 73 47 72
501
+ 70 63 3B 00 } // Lcom/bugsmirror/defenderapi/generated/BugsmirrorDefenderServicesGrpc;
502
+
503
+ condition:
504
+ is_dex and any of them
505
+ }
506
+
507
+ rule bshield : protector
508
+ {
509
+ meta:
510
+ description = "BShield"
511
+ url = "https://bshield.io/"
512
+ sample = "f54fa5cfcd9a5d14a947bbd93bc7bb59e8c2b1b23cc5bcc84c66ad0143e55201"
513
+ author = "Abhi"
514
+
515
+ strings:
516
+ $dat = { 00 0B 42 53 48 49 45 4C 44 5F 44 41 54 00 } // BSHIELD_DAT
517
+
518
+ condition:
519
+ is_dex and all of them
520
+ }
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright (C) 2024 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
+ import "pe"
29
+
30
+ rule is_dll : file_type
31
+ {
32
+ meta:
33
+ description = "DLL"
34
+
35
+ condition:
36
+ pe.characteristics and pe.DLL
37
+ }
38
+
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright (C) 2024 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 beebyte : obfuscator
31
+ {
32
+ meta:
33
+ description = "Beebyte"
34
+ url = "https://www.beebyte.co.uk/"
35
+ sample = "53fa7054f7112197cfe3ab8adc1afe825c6e6b4a696404f75f75eb894ae77456"
36
+ author = "Abhi"
37
+
38
+ strings:
39
+ $name = "\x00Beebyte.Obfuscator\x00"
40
+
41
+ condition:
42
+ is_dll and all of them
43
+ }
@@ -0,0 +1,43 @@
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
+ import "elf"
29
+ include "common.yara"
30
+
31
+ rule check_qemu_entropy : anti_vm
32
+ {
33
+ meta:
34
+ description = "Checks for QEMU entropy"
35
+ url = "https://github.com/Fuzion24/AndroidHostileEnvironmentDetection/blob/master/app/jni/emudetect.c"
36
+
37
+ strings:
38
+ $a = "atomicallyIncreasingGlobalVarThread"
39
+ $b = "_qemuFingerPrint"
40
+
41
+ condition:
42
+ is_elf and any of them
43
+ }
@@ -0,0 +1,54 @@
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
+ import "elf"
29
+
30
+ rule is_elf : file_type
31
+ {
32
+ meta:
33
+ description = "ELF"
34
+
35
+ condition:
36
+ elf.number_of_sections >= 0
37
+ }
38
+
39
+ rule is_dart : file_type
40
+ {
41
+ meta:
42
+ description = "Dart"
43
+
44
+ strings:
45
+ $s1 = "dart:core" ascii
46
+ $s2 = "dart:async" ascii
47
+ $s3 = "_kDartVmSnapshotData" ascii
48
+ $s4 = "_kDartVmSnapshotInstructions" ascii
49
+ $s5 = "flutter_assets" ascii
50
+ $ksnl = { 4B 53 4E 4C } // "KSNL" in hex
51
+
52
+ condition:
53
+ is_elf and 2 of ($s*) or $ksnl
54
+ }