-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
swift_rules.yaml
495 lines (495 loc) · 15.6 KB
/
swift_rules.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
- id: ios_ip_disclosure
message: IP Address disclosure
input_case: exact
pattern: '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\"'
severity: warning
type: Regex
metadata:
cvss: 4.3
cwe: cwe-200
masvs: code-2
owasp-mobile: ''
- id: ios_hardcoded_info
message: Files may contain hardcoded sensitive information like usernames,
passwords, keys etc.
input_case: lower
pattern: (password\s*=\s*[\'|\"].+[\'|\"]\s{0,5})|(pass\s*=\s*[\'|\"].+[\'|\"]\s{0,5})|(username\s*=\s*[\'|\"].+[\'|\"]\s{0,5})|(secret\s*=\s*[\'|\"].+[\'|\"]\s{0,5})|(key\s*=\s*[\'|\"].+[\'|\"]\s{0,5})
severity: high
type: Regex
metadata:
cvss: 7.4
cwe: cwe-312
masvs: storage-14
owasp-mobile: m9
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x05d-Testing-Data-Storage.md#checking-memory-for-sensitive-data-mstg-storage-10
- id: ios_sqlite
message: App uses SQLite Database. Sensitive Information should be encrypted.
input_case: exact
pattern:
- sqlite3_exec
- sqlite3_finalize
severity: info
type: RegexOr
metadata:
cvss: 0
cwe: ''
masvs: storage-14
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x05d-Testing-Data-Storage.md#sqlite-database-unencrypted
- id: ios_load_html_string
message: User input in "loadHTMLString" will result in JavaScript Injection.
input_case: exact
pattern:
- loadHTMLString
- webView
severity: warning
type: RegexAnd
metadata:
cvss: 8.8
cwe: cwe-95
masvs: platform-5
owasp-mobile: m7
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06h-Testing-Platform-Interaction.md#testing-webview-protocol-handlers-mstg-platform-6
- id: ios_jailbreak_detect
message: This App may have Jailbreak detection capabilities.
input_case: exact
pattern:
- /Applications/Cydia\.app
- /Library/MobileSubstrate/MobileSubstrate\.dylib
- /usr/sbin/sshd
- /etc/apt
- cydia://
- /var/lib/cydia
- /Applications/FakeCarrier\.app
- /Applications/Icy\.app
- /Applications/IntelliScreen\.app
- /Applications/SBSettings\.app
- /Library/MobileSubstrate/DynamicLibraries/LiveClock\.plist
- /System/Library/LaunchDaemons/com\.ikey\.bbot\.plist
- /System/Library/LaunchDaemons/com\.saurik\.Cydia\.Startup\.plist
- /etc/ssh/sshd_config
- /private/var/tmp/cydia\.log
- /usr/libexec/ssh-keysign
- /Applications/MxTube\.app
- /Applications/RockApp\.app
- /Applications/WinterBoard\.app
- /Applications/blackra1n\.app
- /Library/MobileSubstrate/DynamicLibraries/Veency\.plist
- /private/var/lib/apt
- /private/var/lib/cydia
- /private/var/mobile/Library/SBSettings/Themes
- /private/var/stash
- /usr/bin/sshd
- /usr/libexec/sftp-server
- /var/cache/apt
- /var/lib/apt
- /usr/sbin/frida-server
- /usr/bin/cycript
- /usr/local/bin/cycript
- /usr/lib/libcycript.dylib
- frida-server
- /etc/apt/sources\.list\.d/electra\.list
- /etc/apt/sources\.list\.d/sileo\.sources
- /.bootstrapped_electra
- /usr/lib/libjailbreak\.dylib
- /jb/lzma
- /\.cydia_no_stash
- /\.installed_unc0ver
- /jb/offsets\.plist
- /usr/share/jailbreak/injectme\.plist
- /Library/MobileSubstrate/MobileSubstrate\.dylib
- /usr/libexec/cydia/firmware\.sh
- /private/var/cache/apt/
- /Library/MobileSubstrate/CydiaSubstrate\.dylib
severity: good
type: RegexOr
metadata:
cvss: 0
cwe: ''
masvs: resilience-1
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06j-Testing-Resiliency-Against-Reverse-Engineering.md#jailbreak-detection-mstg-resilience-1
- id: ios_swift_log
message: The App logs information. Sensitive information should never be logged.
input_case: exact
pattern: (print|NSLog|os_log|OSLog|os_signpost)\(.*\)
severity: info
type: Regex
metadata:
cvss: 7.5
cwe: CWE-532
masvs: storage-3
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06i-Testing-Code-Quality-and-Build-Settings.md#finding-debugging-code-and-verbose-error-logging-mstg-code-4
- id: ios_swift_sha1_collision
message: SHA1 is a weak hash known to have hash collisions.
input_case: exact
pattern:
- (?i)SHA1\(
- CC_SHA1\(
severity: high
type: RegexOr
metadata:
cvss: 5.9
cwe: CWE-327
masvs: crypto-4
owasp-mobile: m5
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04g-Testing-Cryptography.md#identifying-insecure-andor-deprecated-cryptographic-algorithms-mstg-crypto-4
- id: ios_md2_collision
message: MD2 is a weak hash known to have hash collisions.
input_case: exact
pattern:
- CC_MD2\(
severity: high
type: RegexOr
metadata:
cvss: 5.9
cwe: CWE-327
masvs: crypto-4
owasp-mobile: m5
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04g-Testing-Cryptography.md#identifying-insecure-andor-deprecated-cryptographic-algorithms-mstg-crypto-4
- id: ios_md4_collision
message: MD4 is a weak hash known to have hash collisions.
input_case: exact
pattern:
- CC_MD4\(
severity: high
type: RegexOr
metadata:
cvss: 5.9
cwe: CWE-327
masvs: crypto-4
owasp-mobile: m5
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04g-Testing-Cryptography.md#identifying-insecure-andor-deprecated-cryptographic-algorithms-mstg-crypto-4
- id: ios_swift_md5_collision
message: MD5 is a weak hash known to have hash collisions.
input_case: exact
pattern:
- (?i)MD5\(
- CC_MD5\(
severity: high
type: RegexOr
metadata:
cvss: 5.9
cwe: CWE-327
masvs: crypto-4
owasp-mobile: m5
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04g-Testing-Cryptography.md#identifying-insecure-andor-deprecated-cryptographic-algorithms-mstg-crypto-4
- id: ios_md6_collision
message: MD6 is a weak hash known to have hash collisions.
input_case: exact
pattern:
- (?i)MD6\(
- CC_MD6\(
severity: high
type: RegexOr
metadata:
cvss: 5.9
cwe: CWE-327
masvs: crypto-4
owasp-mobile: m5
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04g-Testing-Cryptography.md#identifying-insecure-andor-deprecated-cryptographic-algorithms-mstg-crypto-4
- id: ios_custom_keyboard_disabled
message: This App may have custom keyboards disabled.
input_case: exact
pattern: extensionPointIdentifier == .*\.keyboard
severity: good
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: platform-11
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06h-Testing-Platform-Interaction.md#app-extensions
- id: ios_keyboard_cache
message: Keyboard cache should be disabled for all sensitive data inputs.
input_case: exact
pattern: .autocorrectionType = .no
severity: good
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: storage-5
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#finding-sensitive-data-in-the-keyboard-cache-mstg-storage-5
- id: ios_uiwebview_safari_view
message: >-
It is recommended to use WKWebView instead of SFSafariViewController or
UIWebView.
input_case: exact
pattern: UIWebView|SFSafariViewController
severity: warning
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: platform-5
owasp-mobile: m1
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06h-Testing-Platform-Interaction.md#testing-ios-webviews-mstg-platform-5
- id: ios_detect_reversing
message: This App may have Reverse engineering detection capabilities.
input_case: exact
pattern:
- '"FridaGadget"'
- '"cynject"'
- '"libcycript"'
- '"/usr/sbin/frida-server"'
severity: good
type: RegexAnd
metadata:
cvss: 0
cwe: ''
masvs: resilience-4
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06j-Testing-Resiliency-Against-Reverse-Engineering.md#ios-anti-reversing-defenses
- id: ios_detect_simulator
message: This App may have Simulator detection capabilities.
input_case: exact
pattern: '"SIMULATOR_DEVICE_NAME"'
severity: good
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: resilience-5
owasp-mobile: ''
- id: ios_biometric_bool
message: 'Biometric authentication should be based on iOS Keychain, not based on bool.'
input_case: exact
pattern: \.evaluatePolicy\(.deviceOwnerAuthentication
severity: warning
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: auth-8
owasp-mobile: m1
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06f-Testing-Local-Authentication.md#local-authentication-framework
- id: ios_file_no_special
message: The file has no special protections associated with it.
input_case: exact
pattern: (?i)\.noFileProtection
severity: high
type: Regex
metadata:
cvss: 4.3
cwe: CWE-311
masvs: storage-1
owasp-mobile: m2
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#ios-data-storage
- id: ios_uipaste_sec
message: >-
This application uses UIPasteboard, improper use of this class can lead to
security issues.
input_case: exact
pattern: UIPasteboard
severity: warning
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: platform-4
owasp-mobile: m1
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06h-Testing-Platform-Interaction.md#uipasteboard
- id: ios_general_paste
message: Usage of generalPasteboard should be avoided.
input_case: exact
pattern: UIPasteboard\.generalPasteboard
severity: warning
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: platform-4
owasp-mobile: m1
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06h-Testing-Platform-Interaction.md#uipasteboard
- id: ios_custom_url
message: >-
The app should not export sensitive functionality via custom URL schemes,
unless these mechanisms are properly protected.
input_case: exact
pattern: CFBundleURLSchemes
severity: warning
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: platform-3
owasp-mobile: m1
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06h-Testing-Platform-Interaction.md#testing-custom-url-schemes-registration
- id: ios_secure_text
message: Some UI controls have secure text entry configured.
input_case: exact
pattern: \.secureTextEntry = true
severity: good
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: storage-5
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#finding-sensitive-data-in-the-keyboard-cache-mstg-storage-5
- id: ios_cert_pinning
message: This App may have Certificate Pinning mechanism.
input_case: exact
pattern:
- PinnedCertificatesTrustEvaluator
- TrustKit\.initSharedInstance
severity: good
type: RegexOr
metadata:
cvss: 0
cwe: CWE-295
masvs: network-4
owasp-mobile: m3
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x05g-Testing-Network-Communication.md#testing-custom-certificate-stores-and-certificate-pinning-mstg-network-4
- id: ios_realm_enable_enc
message: App uses Realm Database. Sensitive Information should be encrypted.
input_case: exact
pattern: realm\.write
severity: info
type: Regex
metadata:
cvss: 0
cwe: CWE-311
masvs: storage-14
owasp-mobile: m2
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#realm-databases
- id: ios_core_data
message: App uses CoreData Database. Sensitive Information should be encrypted.
input_case: exact
pattern:
- NSManagedObjectContext
- \.save\(\)
severity: info
type: RegexAnd
metadata:
cvss: 0
cwe: CWE-311
masvs: storage-14
owasp-mobile: m2
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#coredata
- id: ios_realm_db_enc_enabled
message: Used Realm database has configured encryption.
input_case: exact
pattern:
- 'Realm\.Configuration\(encryptionKey:'
- 'Realm\(configuration:'
severity: good
type: RegexAnd
metadata:
cvss: 0
cwe: CWE-311
masvs: storage-14
owasp-mobile: m2
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#realm-databases
- id: ios_ui_controls_disabled
message: Copy feature may be disabled in some UI controls.
input_case: exact
pattern:
- canPerformAction
- UIResponderStandardEditActions\.copy|\.copy
severity: info
type: RegexAnd
metadata:
cvss: 0
cwe: ''
masvs: ''
owasp-mobile: ''
- id: ios_open_urls
message: Opening App with URLs can lead to potential security leaks.
input_case: exact
pattern: 'func application\(.*open url: URL'
severity: warning
type: Regex
metadata:
cvss: 0
cwe: CWE-939
masvs: platform-3
owasp-mobile: m1
- id: ios_sensitive_backup
message: >-
Sensitive data shouldn't be included in backups generated by the mobile
operating system.
input_case: exact
pattern: 'kSecAttrAccessible[a-zA-Z]*ThisDeviceOnly'
severity: good
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: storage-8
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06d-Testing-Data-Storage.md#the-keychain
- id: ios_webview_disable_js
message: JavaScript should be disabled in WebViews unless explicitly required.
input_case: exact
pattern:
- WKWebView
- \.javaScriptEnabled = false
severity: warning
type: RegexAndNot
metadata:
cvss: 0
cwe: ''
masvs: platform-5
owasp-mobile: ''
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x06h-Testing-Platform-Interaction.md#testing-javascript-configuration
- id: ios_tls3_not_used
message: TLS 1.3 should be used. Detected old version
input_case: exact
pattern:
- \.TLSMinimumSupportedProtocolVersion
- - tls_protocol_version_t\.TLSv10
- tls_protocol_version_t\.TLSv11
severity: high
type: RegexAndOr
metadata:
cvss: 7.5
cwe: CWE-757
masvs: network-2
owasp-mobile: m3
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04f-Testing-Network-Communication.md#verifying-data-encryption-on-the-network-mstg-network-1-and-mstg-network-2
- id: ios_tls12_used
message: TLS 1.3 should be used. Detected old version - TLS 1.2.
input_case: exact
pattern:
- \.TLSMinimumSupportedProtocolVersion
- tls_protocol_version_t\.TLSv12
severity: warning
type: RegexAnd
metadata:
cvss: 0
cwe: ''
masvs: network-2
owasp-mobile: m3
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04f-Testing-Network-Communication.md#verifying-data-encryption-on-the-network-mstg-network-1-and-mstg-network-2
- id: ios_dtls1_used
message: DTLS 1.2 should be used. Detected old version - DTLS 1.0.
input_case: exact
pattern:
- \.TLSMinimumSupportedProtocolVersion
- tls_protocol_version_t\.DTLSv10
severity: warning
type: RegexAnd
metadata:
cvss: 0
cwe: ''
masvs: network-2
owasp-mobile: m3
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04f-Testing-Network-Communication.md#verifying-data-encryption-on-the-network-mstg-network-1-and-mstg-network-2
- id: ios_depr_tls_min
message: >-
Use of deprecated property tlsMinimumSupportedProtocol. To avoid potential
security risks, use tlsMinimumSupportedProtocolVersion
input_case: exact
pattern: \.tlsMinimumSupportedProtocol
severity: warning
type: Regex
metadata:
cvss: 0
cwe: ''
masvs: network-2
owasp-mobile: m3
ref: https://github.com/MobSF/owasp-mstg/blob/master/Document/0x04f-Testing-Network-Communication.md#verifying-data-encryption-on-the-network-mstg-network-1-and-mstg-network-2