@zhuma4/cli 4.0.0-alpha.1
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/README.md +42 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +18 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +11 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/scan.d.ts +3 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +96 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/scan_appid.d.ts +20 -0
- package/dist/commands/scan_appid.d.ts.map +1 -0
- package/dist/commands/scan_appid.js +301 -0
- package/dist/commands/scan_appid.js.map +1 -0
- package/dist/commands/scan_manifest.d.ts +13 -0
- package/dist/commands/scan_manifest.d.ts.map +1 -0
- package/dist/commands/scan_manifest.js +103 -0
- package/dist/commands/scan_manifest.js.map +1 -0
- package/dist/engine/api-submit.d.ts +16 -0
- package/dist/engine/api-submit.d.ts.map +1 -0
- package/dist/engine/api-submit.js +66 -0
- package/dist/engine/api-submit.js.map +1 -0
- package/dist/engine/batch_scan.d.ts +36 -0
- package/dist/engine/batch_scan.d.ts.map +1 -0
- package/dist/engine/batch_scan.js +192 -0
- package/dist/engine/batch_scan.js.map +1 -0
- package/dist/engine/config.d.ts +12 -0
- package/dist/engine/config.d.ts.map +1 -0
- package/dist/engine/config.js +27 -0
- package/dist/engine/config.js.map +1 -0
- package/dist/engine/errors.d.ts +36 -0
- package/dist/engine/errors.d.ts.map +1 -0
- package/dist/engine/errors.js +99 -0
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/filter.d.ts +13 -0
- package/dist/engine/filter.d.ts.map +1 -0
- package/dist/engine/filter.js +64 -0
- package/dist/engine/filter.js.map +1 -0
- package/dist/engine/finding_classifier.d.ts +108 -0
- package/dist/engine/finding_classifier.d.ts.map +1 -0
- package/dist/engine/finding_classifier.js +440 -0
- package/dist/engine/finding_classifier.js.map +1 -0
- package/dist/engine/incremental/engine.d.ts +25 -0
- package/dist/engine/incremental/engine.d.ts.map +1 -0
- package/dist/engine/incremental/engine.js +337 -0
- package/dist/engine/incremental/engine.js.map +1 -0
- package/dist/engine/incremental/git-diff.d.ts +19 -0
- package/dist/engine/incremental/git-diff.d.ts.map +1 -0
- package/dist/engine/incremental/git-diff.js +175 -0
- package/dist/engine/incremental/git-diff.js.map +1 -0
- package/dist/engine/incremental/types.d.ts +33 -0
- package/dist/engine/incremental/types.d.ts.map +1 -0
- package/dist/engine/incremental/types.js +11 -0
- package/dist/engine/incremental/types.js.map +1 -0
- package/dist/engine/manifest_scanner.d.ts +48 -0
- package/dist/engine/manifest_scanner.d.ts.map +1 -0
- package/dist/engine/manifest_scanner.js +599 -0
- package/dist/engine/manifest_scanner.js.map +1 -0
- package/dist/engine/project.d.ts +22 -0
- package/dist/engine/project.d.ts.map +1 -0
- package/dist/engine/project.js +279 -0
- package/dist/engine/project.js.map +1 -0
- package/dist/engine/sarif.d.ts +13 -0
- package/dist/engine/sarif.d.ts.map +1 -0
- package/dist/engine/sarif.js +44 -0
- package/dist/engine/sarif.js.map +1 -0
- package/dist/engine/sca-integration.d.ts +36 -0
- package/dist/engine/sca-integration.d.ts.map +1 -0
- package/dist/engine/sca-integration.js +91 -0
- package/dist/engine/sca-integration.js.map +1 -0
- package/dist/engine/scanner.d.ts +18 -0
- package/dist/engine/scanner.d.ts.map +1 -0
- package/dist/engine/scanner.js +138 -0
- package/dist/engine/scanner.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/report/render.d.ts +23 -0
- package/dist/report/render.d.ts.map +1 -0
- package/dist/report/render.js +335 -0
- package/dist/report/render.js.map +1 -0
- package/package.json +41 -0
- package/rules/android/mobile-cleartext-traffic.yaml +46 -0
- package/rules/android/mobile-component-security.yaml +107 -0
- package/rules/android/mobile-crypto-weakness.yaml +139 -0
- package/rules/android/mobile-cwe-1021-tapjacking.yaml +81 -0
- package/rules/android/mobile-cwe-114-dynamic-dex-loading.yaml +41 -0
- package/rules/android/mobile-cwe-200-clipboard-data-leak.yaml +66 -0
- package/rules/android/mobile-cwe-200-debug-builds.yaml +111 -0
- package/rules/android/mobile-cwe-200-log-sensitive-data.yaml +61 -0
- package/rules/android/mobile-cwe-200-webview-debugging.yaml +56 -0
- package/rules/android/mobile-cwe-200-webview-universal-access.yaml +30 -0
- package/rules/android/mobile-cwe-200-window-flags.yaml +96 -0
- package/rules/android/mobile-cwe-22-content-provider-openfile.yaml +73 -0
- package/rules/android/mobile-cwe-22-path-traversal.yaml +86 -0
- package/rules/android/mobile-cwe-287-biometric-weakness.yaml +102 -0
- package/rules/android/mobile-cwe-295-cert-pinning-missing.yaml +78 -0
- package/rules/android/mobile-cwe-295-webview-ssl-bypass.yaml +104 -0
- package/rules/android/mobile-cwe-312-cleartext-storage.yaml +109 -0
- package/rules/android/mobile-cwe-319-cleartext-communication.yaml +84 -0
- package/rules/android/mobile-cwe-321-hardcoded-crypto-keys.yaml +132 -0
- package/rules/android/mobile-cwe-326-short-rsa.yaml +108 -0
- package/rules/android/mobile-cwe-327-rc4-3des.yaml +107 -0
- package/rules/android/mobile-cwe-329-cbc-padding-oracle.yaml +76 -0
- package/rules/android/mobile-cwe-470-reflection-injection.yaml +39 -0
- package/rules/android/mobile-cwe-489-root-detection-weak.yaml +125 -0
- package/rules/android/mobile-cwe-489-stetho-debug.yaml +107 -0
- package/rules/android/mobile-cwe-502-insecure-deserialization.yaml +76 -0
- package/rules/android/mobile-cwe-552-world-readable-files.yaml +63 -0
- package/rules/android/mobile-cwe-749-webview-java-objects.yaml +78 -0
- package/rules/android/mobile-cwe-749-webview-jsbridge.yaml +57 -0
- package/rules/android/mobile-cwe-749-webview-loadurl-injection.yaml +80 -0
- package/rules/android/mobile-cwe-78-command-injection.yaml +77 -0
- package/rules/android/mobile-cwe-780-rsa-no-oaep.yaml +80 -0
- package/rules/android/mobile-cwe-79-webview-setdata.yaml +78 -0
- package/rules/android/mobile-cwe-79-webview-xss.yaml +65 -0
- package/rules/android/mobile-cwe-798-hardcoded-credentials.yaml +108 -0
- package/rules/android/mobile-cwe-89-sql-injection.yaml +100 -0
- package/rules/android/mobile-cwe-927-implicit-intent.yaml +121 -0
- package/rules/android/mobile-cwe-927-ipc-file-provider.yaml +102 -0
- package/rules/android/mobile-cwe-939-deeplink-validation.yaml +76 -0
- package/rules/android/mobile-sdk-google-firebase-open.yaml +117 -0
- package/rules/android/mobile-sdk-tencent-tpns-config-leak.yaml +131 -0
- package/rules/android/mobile-secrets-storage.yaml +136 -0
- package/rules/android/mobile-webview-security.yaml +88 -0
- package/rules/common/cwe-200-sensitive-data-exposure.yaml +61 -0
- package/rules/common/cwe-22-path-traversal.yaml +47 -0
- package/rules/common/cwe-295-ssl-bypass.yaml +217 -0
- package/rules/common/cwe-295-ssl-verification-disabled.yaml +64 -0
- package/rules/common/cwe-306-missing-authentication.yaml +44 -0
- package/rules/common/cwe-326-weak-key-size.yaml +107 -0
- package/rules/common/cwe-327-weak-crypto.yaml +177 -0
- package/rules/common/cwe-328-weak-hash.yaml +96 -0
- package/rules/common/cwe-329-cbc-mode.yaml +26 -0
- package/rules/common/cwe-352-csrf.yaml +23 -0
- package/rules/common/cwe-434-unrestricted-file-upload.yaml +41 -0
- package/rules/common/cwe-502-insecure-deserialization.yaml +44 -0
- package/rules/common/cwe-601-url-redirect.yaml +110 -0
- package/rules/common/cwe-611-xxe.yaml +70 -0
- package/rules/common/cwe-732-incorrect-permission.yaml +49 -0
- package/rules/common/cwe-770-resource-exhaustion.yaml +44 -0
- package/rules/common/cwe-78-os-command-injection.yaml +43 -0
- package/rules/common/cwe-787-out-of-bounds-write.yaml +37 -0
- package/rules/common/cwe-79-xss.yaml +51 -0
- package/rules/common/cwe-862-missing-authorization.yaml +40 -0
- package/rules/common/cwe-89-sqli.yaml +89 -0
- package/rules/common/cwe-918-ssrf.yaml +45 -0
- package/rules/common/cwe-94-code-injection.yaml +59 -0
- package/rules/common/zm-go-cwe22-path-traversal-fs.yaml +117 -0
- package/rules/common/zm-go-cwe22-path-traversal.yaml +103 -0
- package/rules/common/zm-go-cwe307-brute-force.yaml +129 -0
- package/rules/common/zm-go-cwe326-weak-crypto.yaml +124 -0
- package/rules/common/zm-go-cwe327-weak-cipher.yaml +152 -0
- package/rules/common/zm-go-cwe384-session-fixation.yaml +128 -0
- package/rules/common/zm-go-cwe502-deserialization.yaml +120 -0
- package/rules/common/zm-go-cwe78-command-injection.yaml +95 -0
- package/rules/common/zm-go-cwe79-xss.yaml +104 -0
- package/rules/common/zm-go-cwe798-hardcoded-creds.yaml +153 -0
- package/rules/common/zm-go-cwe89-sqli.yaml +89 -0
- package/rules/common/zm-go-cwe918-ssrf.yaml +117 -0
- package/rules/common/zm-java-cwe117-log-injection.yaml +83 -0
- package/rules/common/zm-java-cwe117-logforging.yaml +153 -0
- package/rules/common/zm-java-cwe200-actuator-exposure.yaml +8 -0
- package/rules/common/zm-java-cwe200-info-disclosure.yaml +91 -0
- package/rules/common/zm-java-cwe22-file-depth.yaml +135 -0
- package/rules/common/zm-java-cwe22-path-traversal-spring.yaml +81 -0
- package/rules/common/zm-java-cwe284-missing-auth-spring.yaml +131 -0
- package/rules/common/zm-java-cwe295-webview-ssl.yaml +123 -0
- package/rules/common/zm-java-cwe327-weakcrypto.yaml +197 -0
- package/rules/common/zm-java-cwe347-jwt.yaml +30 -0
- package/rules/common/zm-java-cwe352-csrf-depth.yaml +107 -0
- package/rules/common/zm-java-cwe352-csrf-disabled.yaml +15 -0
- package/rules/common/zm-java-cwe501-trust-boundary.yaml +124 -0
- package/rules/common/zm-java-cwe502-deserial-depth.yaml +128 -0
- package/rules/common/zm-java-cwe502-fastjson.yaml +137 -0
- package/rules/common/zm-java-cwe502-gadget.yaml +158 -0
- package/rules/common/zm-java-cwe502-jndi-injection.yaml +91 -0
- package/rules/common/zm-java-cwe502-shiro.yaml +108 -0
- package/rules/common/zm-java-cwe601-url-redirect-spring.yaml +85 -0
- package/rules/common/zm-java-cwe611-xxe-enhanced.yaml +80 -0
- package/rules/common/zm-java-cwe611-xxe-transformer.yaml +85 -0
- package/rules/common/zm-java-cwe639-idor.yaml +123 -0
- package/rules/common/zm-java-cwe79-xss-depth.yaml +98 -0
- package/rules/common/zm-java-cwe862-authz-depth.yaml +127 -0
- package/rules/common/zm-java-cwe915-mass-assignment.yaml +16 -0
- package/rules/common/zm-java-cwe917-expression-injection.yaml +120 -0
- package/rules/common/zm-java-cwe918-resttemplate.yaml +67 -0
- package/rules/common/zm-java-cwe918-ssrf-depth.yaml +103 -0
- package/rules/common/zm-java-cwe918-ssrf-resttemplate.yaml +77 -0
- package/rules/common/zm-java-cwe918-webclient.yaml +44 -0
- package/rules/common/zm-java-cwe94-ognl.yaml +66 -0
- package/rules/common/zm-java-cwe94-spel-injection.yaml +85 -0
- package/rules/common/zm-java-cwe94-spel.yaml +112 -0
- package/rules/common/zm-java-cwe94-ssti.yaml +22 -0
- package/rules/common/zm-java-cwe942-cors.yaml +15 -0
- package/rules/common/zm-js-cwe1321-prototype-pollution.yaml +61 -0
- package/rules/common/zm-js-cwe200-info-disclosure.yaml +95 -0
- package/rules/common/zm-js-cwe22-path-traversal-fs.yaml +113 -0
- package/rules/common/zm-js-cwe22-pathtraversal.yaml +111 -0
- package/rules/common/zm-js-cwe307-brute-force.yaml +136 -0
- package/rules/common/zm-js-cwe345-postmessage.yaml +75 -0
- package/rules/common/zm-js-cwe347-jwt-weak.yaml +95 -0
- package/rules/common/zm-js-cwe352-csrf.yaml +52 -0
- package/rules/common/zm-js-cwe384-session-fixation.yaml +132 -0
- package/rules/common/zm-js-cwe502-deserialization.yaml +119 -0
- package/rules/common/zm-js-cwe611-xxe.yaml +108 -0
- package/rules/common/zm-js-cwe639-idor.yaml +122 -0
- package/rules/common/zm-js-cwe693-helmet-missing.yaml +46 -0
- package/rules/common/zm-js-cwe78-exec.yaml +37 -0
- package/rules/common/zm-js-cwe78-spawn.yaml +37 -0
- package/rules/common/zm-js-cwe79-domxss.yaml +84 -0
- package/rules/common/zm-js-cwe79-react-xss.yaml +18 -0
- package/rules/common/zm-js-cwe79-xss-ejs.yaml +70 -0
- package/rules/common/zm-js-cwe89-sqli.yaml +153 -0
- package/rules/common/zm-js-cwe915-mass-assignment.yaml +111 -0
- package/rules/common/zm-js-cwe918-ssrf-fetch.yaml +134 -0
- package/rules/common/zm-js-cwe918-ssrf.yaml +132 -0
- package/rules/common/zm-js-cwe94-template-injection.yaml +130 -0
- package/rules/common/zm-js-cwe942-cors.yaml +49 -0
- package/rules/common/zm-js-cwe943-nosql-injection.yaml +52 -0
- package/rules/common/zm-js-cwe95-eval.yaml +59 -0
- package/rules/common/zm-js-cwe95-function-ctor.yaml +31 -0
- package/rules/common/zm-py-cwe22-path-traversal.yaml +86 -0
- package/rules/common/zm-py-cwe327-weak-crypto.yaml +103 -0
- package/rules/common/zm-py-cwe502-pickle.yaml +92 -0
- package/rules/common/zm-py-cwe611-xxe.yaml +100 -0
- package/rules/common/zm-py-cwe78-command-injection.yaml +121 -0
- package/rules/common/zm-py-cwe79-xss.yaml +123 -0
- package/rules/common/zm-py-cwe798-hardcoded-creds.yaml +86 -0
- package/rules/common/zm-py-cwe89-sqli.yaml +59 -0
- package/rules/common/zm-py-cwe918-ssrf.yaml +123 -0
- package/rules/common/zm-py-cwe94-ssti.yaml +87 -0
- package/rules/common/zm-py-cwe943-nosql-injection.yaml +123 -0
- package/rules/iac/ansible/zm-ansible-cwe269-privilege-escalation.yaml +63 -0
- package/rules/iac/ansible/zm-ansible-cwe78-command-injection.yaml +67 -0
- package/rules/iac/ansible/zm-ansible-cwe798-hardcoded-creds.yaml +93 -0
- package/rules/iac/terraform/zm-tf-cwe200-s3-bucket-public.yaml +100 -0
- package/rules/iac/terraform/zm-tf-cwe284-sg-wide-open.yaml +88 -0
- package/rules/iac/terraform/zm-tf-cwe311-iam-wildcard.yaml +83 -0
- package/rules/iac/terraform/zm-tf-cwe319-rds-public.yaml +72 -0
- package/rules/iac/terraform/zm-tf-cwe798-hardcoded-creds.yaml +102 -0
- package/rules/iac/zm-docker-cwe250-root-user.yaml +50 -0
- package/rules/iac/zm-docker-cwe400-resource-limit.yaml +92 -0
- package/rules/iac/zm-docker-security.yaml +104 -0
- package/rules/iac/zm-k8s-cwe200-service-account.yaml +83 -0
- package/rules/iac/zm-k8s-cwe250-privileged.yaml +56 -0
- package/rules/iac/zm-k8s-security.yaml +79 -0
- package/rules/rules_index.yaml.off +477 -0
- package/rules/semgrep-registry/anonymous-ldap-bind.yaml +34 -0
- package/rules/semgrep-registry/bad-hexa-conversion.yaml +32 -0
- package/rules/semgrep-registry/blowfish-insufficient-key-size.yaml +39 -0
- package/rules/semgrep-registry/cbc-padding-oracle.yaml +38 -0
- package/rules/semgrep-registry/command-injection-formatted-runtime-call.yaml +90 -0
- package/rules/semgrep-registry/command-injection-process-builder.yaml +148 -0
- package/rules/semgrep-registry/cookie-missing-httponly.yaml +38 -0
- package/rules/semgrep-registry/cookie-missing-secure-flag.yaml +38 -0
- package/rules/semgrep-registry/crlf-injection-logs.yaml +86 -0
- package/rules/semgrep-registry/dangerous-groovy-shell.yaml +46 -0
- package/rules/semgrep-registry/el-injection.yaml +137 -0
- package/rules/semgrep-registry/formatted-sql-string.yaml +95 -0
- package/rules/semgrep-registry/http-response-splitting.yaml +44 -0
- package/rules/semgrep-registry/index.txt +1 -0
- package/rules/semgrep-registry/insecure-smtp-connection.yaml +34 -0
- package/rules/semgrep-registry/java-reverse-shell.yaml +43 -0
- package/rules/semgrep-registry/jdbc-sql-formatted-string.yaml +120 -0
- package/rules/semgrep-registry/ldap-entry-poisoning.yaml +41 -0
- package/rules/semgrep-registry/ldap-injection.yaml +82 -0
- package/rules/semgrep-registry/md5-used-as-password.yaml +44 -0
- package/rules/semgrep-registry/object-deserialization.yaml +34 -0
- package/rules/semgrep-registry/ognl-injection.yaml +839 -0
- package/rules/semgrep-registry/overly-permissive-file-permission.yaml +49 -0
- package/rules/semgrep-registry/permissive-cors.yaml +77 -0
- package/rules/semgrep-registry/script-engine-injection.yaml +66 -0
- package/rules/semgrep-registry/tainted-cmd-from-http-request.yaml +74 -0
- package/rules/semgrep-registry/tainted-env-from-http-request.yaml +46 -0
- package/rules/semgrep-registry/tainted-ldapi-from-http-request.yaml +42 -0
- package/rules/semgrep-registry/tainted-session-from-http-request.yaml +70 -0
- package/rules/semgrep-registry/tainted-xpath-from-http-request.yaml +38 -0
- package/rules/semgrep-registry/unsafe-reflection.yaml +39 -0
- package/rules/semgrep-registry/unvalidated-redirect.yaml +127 -0
- package/rules/semgrep-registry/url-rewriting.yaml +82 -0
- package/rules/semgrep-registry/weak-ssl-context.yaml +34 -0
- package/rules/semgrep-registry/xml-decoder.yaml +53 -0
- package/rules/semgrep-registry/xssrequestwrapper-is-insecure.yaml +40 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# CWE-312: Cleartext Storage of Sensitive Information (Android)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: V3 Audit Engine extension - cleartext storage patterns
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-sharedprefs-sensitive-key
|
|
7
|
+
severity: WARNING
|
|
8
|
+
message: |
|
|
9
|
+
Detected SharedPreferences storing data with a sensitive key name (password, token, ssn, credit_card, passport, license).
|
|
10
|
+
Storing sensitive data in SharedPreferences without encryption exposes it to other apps with root access or backup extraction.
|
|
11
|
+
Remediation: Use EncryptedSharedPreferences (AndroidX Security) or Android Keystore for sensitive data storage.
|
|
12
|
+
languages:
|
|
13
|
+
- java
|
|
14
|
+
patterns:
|
|
15
|
+
- pattern-either:
|
|
16
|
+
- pattern: $SP.edit().putString("$KEY", $VAL)
|
|
17
|
+
- pattern: $SP.edit().putString("$KEY", $VAL);
|
|
18
|
+
- pattern: $EDITOR.putString("$KEY", $VAL)
|
|
19
|
+
- metavariable-regex:
|
|
20
|
+
metavariable: $KEY
|
|
21
|
+
regex: '(?i)(password|passwd|pwd|token|secret|ssn|credit_card|creditcard|passport|license|pin|apikey|api_key|access_token|refresh_token|auth_token|bearer)'
|
|
22
|
+
metadata:
|
|
23
|
+
cwe: "CWE-312: Cleartext Storage of Sensitive Information"
|
|
24
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
25
|
+
masvs: "MASVS-STORAGE-1"
|
|
26
|
+
category: android-storage
|
|
27
|
+
precision: medium
|
|
28
|
+
confidence: medium
|
|
29
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
30
|
+
references:
|
|
31
|
+
- https://cwe.mitre.org/data/definitions/312.html
|
|
32
|
+
- https://developer.android.com/reference/androidx/security/crypto/EncryptedSharedPreferences
|
|
33
|
+
|
|
34
|
+
- id: zm-android-sqlite-sensitive-column-insert
|
|
35
|
+
severity: WARNING
|
|
36
|
+
message: |
|
|
37
|
+
Detected SQLiteDatabase.insert() or execSQL() operating on a column named password, secret, or token.
|
|
38
|
+
Storing sensitive values in plaintext SQLite allows extraction via backup or root access.
|
|
39
|
+
Remediation: Encrypt sensitive columns before storage using Android Keystore-backed AES-GCM.
|
|
40
|
+
languages:
|
|
41
|
+
- java
|
|
42
|
+
patterns:
|
|
43
|
+
- pattern-either:
|
|
44
|
+
- pattern: $DB.insert("$TABLE", null, $VALUES)
|
|
45
|
+
- pattern: $DB.execSQL("$SQL", $ARGS)
|
|
46
|
+
- pattern: $DB.rawQuery("$SQL", $ARGS)
|
|
47
|
+
- metavariable-regex:
|
|
48
|
+
metavariable: $TABLE
|
|
49
|
+
regex: '(?i)(user|account|credential|auth|token|session)'
|
|
50
|
+
metadata:
|
|
51
|
+
cwe: "CWE-312: Cleartext Storage of Sensitive Information"
|
|
52
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
53
|
+
masvs: "MASVS-STORAGE-1"
|
|
54
|
+
category: android-storage
|
|
55
|
+
precision: low
|
|
56
|
+
confidence: low
|
|
57
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
58
|
+
references:
|
|
59
|
+
- https://cwe.mitre.org/data/definitions/312.html
|
|
60
|
+
- https://developer.android.com/privacy-and-security/risks/sql-injection
|
|
61
|
+
|
|
62
|
+
- id: zm-android-fileoutputstream-password-field
|
|
63
|
+
severity: WARNING
|
|
64
|
+
message: |
|
|
65
|
+
Detected FileOutputStream writing data from an EditText with inputType textPassword or numberPassword.
|
|
66
|
+
Writing password field content to a file without encryption exposes credentials on disk.
|
|
67
|
+
Remediation: Encrypt data before writing or avoid persisting password field values to storage.
|
|
68
|
+
languages:
|
|
69
|
+
- java
|
|
70
|
+
patterns:
|
|
71
|
+
- pattern-either:
|
|
72
|
+
- pattern: |
|
|
73
|
+
$FOS.write($PW.getText().toString().getBytes())
|
|
74
|
+
- pattern: |
|
|
75
|
+
$FOS.write($PW.getText().toString().getBytes("$ENC"))
|
|
76
|
+
metadata:
|
|
77
|
+
cwe: "CWE-312: Cleartext Storage of Sensitive Information"
|
|
78
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
79
|
+
masvs: "MASVS-STORAGE-1"
|
|
80
|
+
category: android-storage
|
|
81
|
+
precision: low
|
|
82
|
+
confidence: low
|
|
83
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
84
|
+
references:
|
|
85
|
+
- https://cwe.mitre.org/data/definitions/312.html
|
|
86
|
+
|
|
87
|
+
- id: zm-android-internal-storage-sensitive-write
|
|
88
|
+
severity: WARNING
|
|
89
|
+
message: |
|
|
90
|
+
Detected openFileOutput() writing a file whose name contains sensitive keywords (credential, token, secret, password).
|
|
91
|
+
Files stored in internal storage can still be accessed via rooted devices or backup extraction.
|
|
92
|
+
Remediation: Use EncryptedFile (AndroidX Security) for sensitive file storage.
|
|
93
|
+
languages:
|
|
94
|
+
- java
|
|
95
|
+
patterns:
|
|
96
|
+
- pattern: openFileOutput("$FNAME", $MODE)
|
|
97
|
+
- metavariable-regex:
|
|
98
|
+
metavariable: $FNAME
|
|
99
|
+
regex: '(?i)(credential|token|secret|password|auth|key|ssn|private)'
|
|
100
|
+
metadata:
|
|
101
|
+
cwe: "CWE-312: Cleartext Storage of Sensitive Information"
|
|
102
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
103
|
+
masvs: "MASVS-STORAGE-1"
|
|
104
|
+
category: android-storage
|
|
105
|
+
precision: medium
|
|
106
|
+
confidence: medium
|
|
107
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
108
|
+
references:
|
|
109
|
+
- https://cwe.mitre.org/data/definitions/312.html
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# CWE-319: HTTP 明文通信 / Websocket 明文 (Android)
|
|
2
|
+
# 逐码 ZhuMa V4.0 — Android 规则库
|
|
3
|
+
# 来源: V3 审计引擎 baseline scan / all_in_one.js
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-usescleartext-traffic-true
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
检测到允许 HTTP 明文通信的配置。
|
|
10
|
+
Android 9+ (API 28) 默认阻止 HTTP 明文流量。如果以下配置存在,
|
|
11
|
+
则 APP 有意允许 HTTP 流量,存在凭证嗅探和中间人攻击风险。
|
|
12
|
+
修复: 使用 HTTPS;如需临时调试,仅在 debug builds 中启用。
|
|
13
|
+
metadata:
|
|
14
|
+
cwe: "CWE-319: Cleartext Transmission of Sensitive Information"
|
|
15
|
+
owasp-mobile: "M3: Insecure Communication"
|
|
16
|
+
masvs: "MASVS-NETWORK-1"
|
|
17
|
+
category: android-network
|
|
18
|
+
precision: high
|
|
19
|
+
confidence: high
|
|
20
|
+
likelihood: high
|
|
21
|
+
impact: high
|
|
22
|
+
source: "V3 Audit Engine - baseline scan"
|
|
23
|
+
references:
|
|
24
|
+
- https://developer.android.com/privacy-and-security/risks/cleartext-communications
|
|
25
|
+
languages:
|
|
26
|
+
- java
|
|
27
|
+
patterns:
|
|
28
|
+
- pattern: |
|
|
29
|
+
$A.setExported(true);
|
|
30
|
+
|
|
31
|
+
- id: zm-android-okhttp-http-url
|
|
32
|
+
severity: HIGH
|
|
33
|
+
message: |
|
|
34
|
+
检测到 OkHttp 请求使用 HTTP (非 HTTPS) URL。
|
|
35
|
+
HTTP 通信无法防止中间人攻击和数据嗅探。
|
|
36
|
+
修复: 改为 HTTPS;或在服务端强制 301 重定向。
|
|
37
|
+
languages:
|
|
38
|
+
- java
|
|
39
|
+
patterns:
|
|
40
|
+
- pattern-either:
|
|
41
|
+
- pattern: |
|
|
42
|
+
new Request.Builder().url("http://$HOST")
|
|
43
|
+
- pattern: |
|
|
44
|
+
$REQ.url("http://$HOST")
|
|
45
|
+
metavariable-regex:
|
|
46
|
+
metavariable: $HOST
|
|
47
|
+
regex: '^(?!localhost|127\.0\.0\.1|10\.|192\.168\.|172\.(1[6-9]|2\d|3[01]))'
|
|
48
|
+
metadata:
|
|
49
|
+
cwe: "CWE-319: Cleartext Transmission of Sensitive Information"
|
|
50
|
+
owasp-mobile: "M3: Insecure Communication"
|
|
51
|
+
masvs: "MASVS-NETWORK-1"
|
|
52
|
+
category: android-network
|
|
53
|
+
precision: medium
|
|
54
|
+
confidence: medium
|
|
55
|
+
source: "V3 Audit Engine - all_in_one.js HTTP scan"
|
|
56
|
+
references:
|
|
57
|
+
- https://developer.android.com/privacy-and-security/risks/cleartext-communications
|
|
58
|
+
|
|
59
|
+
- id: zm-android-httpurlconnection-http
|
|
60
|
+
severity: HIGH
|
|
61
|
+
message: |
|
|
62
|
+
检测到直接打开 HTTP URL 连接。
|
|
63
|
+
应使用 HttpsURLConnection 替代。
|
|
64
|
+
languages:
|
|
65
|
+
- java
|
|
66
|
+
patterns:
|
|
67
|
+
- pattern-either:
|
|
68
|
+
- pattern: |
|
|
69
|
+
$URL.openConnection()
|
|
70
|
+
- pattern: |
|
|
71
|
+
new URL("http://$HOST")
|
|
72
|
+
- metavariable-regex:
|
|
73
|
+
metavariable: $HOST
|
|
74
|
+
regex: '^(?!localhost|127\.0\.0\.1|10\.|192\.168\.|172\.(1[6-9]|2\d|3[01]))'
|
|
75
|
+
metadata:
|
|
76
|
+
cwe: "CWE-319: Cleartext Transmission of Sensitive Information"
|
|
77
|
+
owasp-mobile: "M3: Insecure Communication"
|
|
78
|
+
masvs: "MASVS-NETWORK-1"
|
|
79
|
+
category: android-network
|
|
80
|
+
precision: low
|
|
81
|
+
confidence: low
|
|
82
|
+
source: "V3 Audit Engine - baseline scan"
|
|
83
|
+
references:
|
|
84
|
+
- https://developer.android.com/privacy-and-security/risks/cleartext-communications
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# CWE-321: 硬编码加密密钥 (Android)
|
|
2
|
+
# 逐码 ZhuMa V4.0 — Android 规则库
|
|
3
|
+
# 来源: V3 审计引擎 VULN-CRYPTO-* (scan_crypto_expanded)
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-hardcoded-aes-key
|
|
7
|
+
severity: CRITICAL
|
|
8
|
+
message: |
|
|
9
|
+
检测到硬编码 AES 密钥。AES 密钥硬编码在源码中可被逆向提取,
|
|
10
|
+
导致所有以此密钥加密的数据失效。
|
|
11
|
+
应使用 Android Keystore System + TEE/StrongBox 生成和管理密钥。
|
|
12
|
+
修复: KeyGenParameterSpec + AndroidKeyStore provider
|
|
13
|
+
languages:
|
|
14
|
+
- java
|
|
15
|
+
patterns:
|
|
16
|
+
- pattern-either:
|
|
17
|
+
- pattern: |
|
|
18
|
+
new SecretKeySpec($BYTES, $ALG)
|
|
19
|
+
metavariable-regex:
|
|
20
|
+
metavariable: $KEY
|
|
21
|
+
regex: '.{8,}'
|
|
22
|
+
metadata:
|
|
23
|
+
cwe: "CWE-321: Use of Hard-coded Cryptographic Key"
|
|
24
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
25
|
+
masvs: "MASVS-CRYPTO-1"
|
|
26
|
+
category: android-crypto
|
|
27
|
+
precision: high
|
|
28
|
+
confidence: high
|
|
29
|
+
likelihood: high
|
|
30
|
+
impact: critical
|
|
31
|
+
source: "V3 Audit Engine - VULN-CRYPTO-*"
|
|
32
|
+
references:
|
|
33
|
+
- https://developer.android.com/privacy-and-security/cryptography
|
|
34
|
+
- https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec
|
|
35
|
+
|
|
36
|
+
- id: zm-android-hardcoded-des-key
|
|
37
|
+
severity: CRITICAL
|
|
38
|
+
message: |
|
|
39
|
+
检测到硬编码 DES 密钥。DES 密钥长度仅 56 位,可在数小时内暴力破解。
|
|
40
|
+
且密钥硬编码在源码中可直接逆向提取。
|
|
41
|
+
立即迁移至 Android Keystore System + AES-256-GCM。
|
|
42
|
+
languages:
|
|
43
|
+
- java
|
|
44
|
+
patterns:
|
|
45
|
+
- pattern-either:
|
|
46
|
+
- pattern: |
|
|
47
|
+
new SecretKeySpec($BYTES, $ALG)
|
|
48
|
+
metavariable-regex:
|
|
49
|
+
metavariable: $KEY
|
|
50
|
+
regex: '.{8,}'
|
|
51
|
+
metadata:
|
|
52
|
+
cwe: "CWE-321: Use of Hard-coded Cryptographic Key"
|
|
53
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
54
|
+
masvs: "MASVS-CRYPTO-1"
|
|
55
|
+
category: android-crypto
|
|
56
|
+
precision: high
|
|
57
|
+
confidence: high
|
|
58
|
+
source: "V3 Audit Engine - VULN-CRYPTO-*"
|
|
59
|
+
|
|
60
|
+
- id: zm-android-hardcoded-pbe-password
|
|
61
|
+
severity: CRITICAL
|
|
62
|
+
message: |
|
|
63
|
+
检测到硬编码 PBE (Password-Based Encryption) 密码。
|
|
64
|
+
PBE 密钥派生密码硬编码使得密钥可通过静态分析直接提取。
|
|
65
|
+
应使用 Android Keystore System 或从用户输入派生密码。
|
|
66
|
+
languages:
|
|
67
|
+
- java
|
|
68
|
+
patterns:
|
|
69
|
+
- pattern-either:
|
|
70
|
+
- pattern: new PBEKeySpec($PWD)
|
|
71
|
+
metavariable-regex:
|
|
72
|
+
metavariable: $PWD
|
|
73
|
+
regex: '.{6,}'
|
|
74
|
+
metadata:
|
|
75
|
+
cwe: "CWE-321: Use of Hard-coded Cryptographic Key"
|
|
76
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
77
|
+
masvs: "MASVS-CRYPTO-1"
|
|
78
|
+
category: android-crypto
|
|
79
|
+
precision: high
|
|
80
|
+
confidence: high
|
|
81
|
+
source: "V3 Audit Engine - VULN-CRYPTO-*"
|
|
82
|
+
|
|
83
|
+
- id: zm-android-hardcoded-iv
|
|
84
|
+
severity: HIGH
|
|
85
|
+
message: |
|
|
86
|
+
检测到硬编码/静态初始化向量(IV)。
|
|
87
|
+
对于 CBC 模式,固定 IV 使加密确定性化,可遭受块重放攻击。
|
|
88
|
+
对于 GCM 模式,IV 重用会完全破坏认证加密的安全性。
|
|
89
|
+
必须使用 SecureRandom 为每次加密生成随机 IV。
|
|
90
|
+
languages:
|
|
91
|
+
- java
|
|
92
|
+
patterns:
|
|
93
|
+
- pattern-either:
|
|
94
|
+
- pattern: |
|
|
95
|
+
new IvParameterSpec($IV_BYTES)
|
|
96
|
+
- pattern: |
|
|
97
|
+
new GCMParameterSpec(128, $IV_BYTES)
|
|
98
|
+
metavariable-regex:
|
|
99
|
+
metavariable: $IV
|
|
100
|
+
regex: '.{8,}'
|
|
101
|
+
metadata:
|
|
102
|
+
cwe: "CWE-321: Use of Hard-coded Cryptographic Key"
|
|
103
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
104
|
+
masvs: "MASVS-CRYPTO-2"
|
|
105
|
+
category: android-crypto
|
|
106
|
+
precision: high
|
|
107
|
+
confidence: high
|
|
108
|
+
source: "V3 Audit Engine - VULN-CRYPTO-*"
|
|
109
|
+
references:
|
|
110
|
+
- https://csrc.nist.gov/glossary/term/initialization_vector
|
|
111
|
+
|
|
112
|
+
- id: zm-android-hardcoded-rsa-private-key
|
|
113
|
+
severity: CRITICAL
|
|
114
|
+
message: |
|
|
115
|
+
检测到硬编码 RSA 私钥(PKCS8EncodedKeySpec)。
|
|
116
|
+
私钥硬编码在客户端 APK 中可被直接逆向提取,相当于将私钥公开发布。
|
|
117
|
+
应立即吊销该密钥对,迁移至 Android Keystore System 生成和存储私钥。
|
|
118
|
+
languages:
|
|
119
|
+
- java
|
|
120
|
+
pattern: |
|
|
121
|
+
new PKCS8EncodedKeySpec("$KEY".getBytes())
|
|
122
|
+
metavariable-regex:
|
|
123
|
+
metavariable: $KEY
|
|
124
|
+
regex: '.{20,}'
|
|
125
|
+
metadata:
|
|
126
|
+
cwe: "CWE-321: Use of Hard-coded Cryptographic Key"
|
|
127
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
128
|
+
masvs: "MASVS-CRYPTO-1"
|
|
129
|
+
category: android-crypto
|
|
130
|
+
precision: very-high
|
|
131
|
+
confidence: very-high
|
|
132
|
+
source: "V3 Audit Engine - VULN-CRYPTO-*"
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# CWE-326: Inadequate Encryption Strength - Short RSA Key (Android)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: ZhuMa V4.1 Rule Expansion - key size validation
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-rsa-key-less-than-2048
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
Detected RSA key generation with key size less than 2048 bits.
|
|
10
|
+
RSA keys shorter than 2048 bits are considered breakable and do not meet NIST minimum requirements.
|
|
11
|
+
Remediation: Use at least 2048-bit RSA keys. For new deployments, prefer 3072-bit or ECC.
|
|
12
|
+
languages:
|
|
13
|
+
- java
|
|
14
|
+
patterns:
|
|
15
|
+
- pattern-either:
|
|
16
|
+
- pattern: KeyPairGenerator.getInstance("RSA").initialize($SIZE)
|
|
17
|
+
- pattern: KeyPairGenerator.getInstance("RSA").initialize($SIZE, $RANDOM)
|
|
18
|
+
- pattern: KeyPairGenerator.getInstance("RSA", "$P").initialize($SIZE)
|
|
19
|
+
- metavariable-comparison:
|
|
20
|
+
metavariable: $SIZE
|
|
21
|
+
comparison: $SIZE < 2048
|
|
22
|
+
metadata:
|
|
23
|
+
cwe: "CWE-326: Inadequate Encryption Strength"
|
|
24
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
25
|
+
masvs: "MASVS-CRYPTO-1"
|
|
26
|
+
category: android-crypto
|
|
27
|
+
precision: high
|
|
28
|
+
confidence: high
|
|
29
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
30
|
+
references:
|
|
31
|
+
- https://cwe.mitre.org/data/definitions/326.html
|
|
32
|
+
- https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-57pt1r5.pdf
|
|
33
|
+
|
|
34
|
+
- id: zm-android-ec-key-less-than-256
|
|
35
|
+
severity: MEDIUM
|
|
36
|
+
message: |
|
|
37
|
+
Detected EC key generation with key size less than 256 bits.
|
|
38
|
+
EC keys below 256 bits (e.g., secp224r1) do not provide adequate security margins.
|
|
39
|
+
Remediation: Use at least 256-bit EC curves (secp256r1/P-256 or secp384r1/P-384).
|
|
40
|
+
languages:
|
|
41
|
+
- java
|
|
42
|
+
patterns:
|
|
43
|
+
- pattern-either:
|
|
44
|
+
- pattern: KeyPairGenerator.getInstance("EC").initialize($SIZE)
|
|
45
|
+
- pattern: KeyPairGenerator.getInstance("EC").initialize($SIZE, $RANDOM)
|
|
46
|
+
- pattern: KeyPairGenerator.getInstance("ECDSA").initialize($SIZE)
|
|
47
|
+
- metavariable-comparison:
|
|
48
|
+
metavariable: $SIZE
|
|
49
|
+
comparison: $SIZE < 256
|
|
50
|
+
metadata:
|
|
51
|
+
cwe: "CWE-326: Inadequate Encryption Strength"
|
|
52
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
53
|
+
masvs: "MASVS-CRYPTO-1"
|
|
54
|
+
category: android-crypto
|
|
55
|
+
precision: high
|
|
56
|
+
confidence: high
|
|
57
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
58
|
+
references:
|
|
59
|
+
- https://cwe.mitre.org/data/definitions/326.html
|
|
60
|
+
|
|
61
|
+
- id: zm-android-aes-key-less-than-128
|
|
62
|
+
severity: CRITICAL
|
|
63
|
+
message: |
|
|
64
|
+
Detected AES/SecretKeySpec with key length less than 128 bits.
|
|
65
|
+
AES minimum security strength is 128 bits. Shorter keys are trivially brute-forceable.
|
|
66
|
+
Remediation: Use at least 128-bit keys. For long-term security, prefer AES-256.
|
|
67
|
+
languages:
|
|
68
|
+
- java
|
|
69
|
+
patterns:
|
|
70
|
+
- pattern-either:
|
|
71
|
+
- pattern: KeyGenerator.getInstance("AES").init($SIZE)
|
|
72
|
+
- pattern: KeyGenerator.getInstance("AES").init($SIZE, $RANDOM)
|
|
73
|
+
- metavariable-comparison:
|
|
74
|
+
metavariable: $SIZE
|
|
75
|
+
comparison: $SIZE < 128
|
|
76
|
+
metadata:
|
|
77
|
+
cwe: "CWE-326: Inadequate Encryption Strength"
|
|
78
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
79
|
+
masvs: "MASVS-CRYPTO-1"
|
|
80
|
+
category: android-crypto
|
|
81
|
+
precision: high
|
|
82
|
+
confidence: high
|
|
83
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
84
|
+
references:
|
|
85
|
+
- https://cwe.mitre.org/data/definitions/326.html
|
|
86
|
+
|
|
87
|
+
- id: zm-android-secure-random-weak-seed
|
|
88
|
+
severity: MEDIUM
|
|
89
|
+
message: |
|
|
90
|
+
Detected SecureRandom seeded with a predictable or static value.
|
|
91
|
+
Using a fixed seed (e.g., system time, hardcoded byte array) makes the RNG output predictable,
|
|
92
|
+
compromising any cryptographic operations that depend on it.
|
|
93
|
+
Remediation: Use new SecureRandom() without a seed; Android's SecureRandom is automatically seeded from /dev/urandom.
|
|
94
|
+
languages:
|
|
95
|
+
- java
|
|
96
|
+
patterns:
|
|
97
|
+
- pattern-either:
|
|
98
|
+
- pattern: $SR.setSeed($SEED)
|
|
99
|
+
metadata:
|
|
100
|
+
cwe: "CWE-326: Inadequate Encryption Strength"
|
|
101
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
102
|
+
masvs: "MASVS-CRYPTO-1"
|
|
103
|
+
category: android-crypto
|
|
104
|
+
precision: medium
|
|
105
|
+
confidence: medium
|
|
106
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
107
|
+
references:
|
|
108
|
+
- https://cwe.mitre.org/data/definitions/326.html
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# CWE-327: Broken/Risky Cryptographic Algorithm (RC4, 3DES, Blowfish)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: ZhuMa V4.1 Rule Expansion - legacy cipher detection
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-rc4-cipher
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
Detected RC4 (ARCFOUR) cipher usage. RC4 has known statistical biases allowing plaintext recovery
|
|
10
|
+
from ciphertext after observing sufficient encrypted traffic.
|
|
11
|
+
RC4 is prohibited by RFC 7465 and should never be used.
|
|
12
|
+
Remediation: Replace RC4 with AES/GCM/NoPadding.
|
|
13
|
+
languages:
|
|
14
|
+
- java
|
|
15
|
+
patterns:
|
|
16
|
+
- pattern-either:
|
|
17
|
+
- pattern: Cipher.getInstance("RC4")
|
|
18
|
+
- pattern: Cipher.getInstance("RC4", "$P")
|
|
19
|
+
- pattern: Cipher.getInstance("ARCFOUR")
|
|
20
|
+
- pattern: Cipher.getInstance("ARCFOUR", "$P")
|
|
21
|
+
metadata:
|
|
22
|
+
cwe: "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
|
|
23
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
24
|
+
masvs: "MASVS-CRYPTO-1"
|
|
25
|
+
category: android-crypto
|
|
26
|
+
precision: very-high
|
|
27
|
+
confidence: very-high
|
|
28
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
29
|
+
references:
|
|
30
|
+
- https://cwe.mitre.org/data/definitions/327.html
|
|
31
|
+
- https://datatracker.ietf.org/doc/rfc7465/
|
|
32
|
+
|
|
33
|
+
- id: zm-android-3des-cipher
|
|
34
|
+
severity: MEDIUM
|
|
35
|
+
message: |
|
|
36
|
+
Detected 3DES (Triple DES / DESede) cipher usage. 3DES has an effective security of only 112 bits
|
|
37
|
+
and is vulnerable to Sweet32 birthday attacks when encrypting large amounts of data.
|
|
38
|
+
3DES is being deprecated by NIST and should be replaced.
|
|
39
|
+
Remediation: Replace 3DES with AES/GCM/NoPadding (minimum AES-128, prefer AES-256).
|
|
40
|
+
languages:
|
|
41
|
+
- java
|
|
42
|
+
patterns:
|
|
43
|
+
- pattern-either:
|
|
44
|
+
- pattern: Cipher.getInstance("DESede")
|
|
45
|
+
- pattern: Cipher.getInstance("DESede/$MODE/$PAD")
|
|
46
|
+
- pattern: Cipher.getInstance("DESede", "$P")
|
|
47
|
+
- pattern: Cipher.getInstance("DESede/$MODE/$PAD", "$P")
|
|
48
|
+
metadata:
|
|
49
|
+
cwe: "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
|
|
50
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
51
|
+
masvs: "MASVS-CRYPTO-1"
|
|
52
|
+
category: android-crypto
|
|
53
|
+
precision: very-high
|
|
54
|
+
confidence: very-high
|
|
55
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
56
|
+
references:
|
|
57
|
+
- https://cwe.mitre.org/data/definitions/327.html
|
|
58
|
+
- https://sweet32.info/
|
|
59
|
+
|
|
60
|
+
- id: zm-android-blowfish-cipher
|
|
61
|
+
severity: MEDIUM
|
|
62
|
+
message: |
|
|
63
|
+
Detected Blowfish cipher usage. Blowfish has a 64-bit block size, making it vulnerable to
|
|
64
|
+
Sweet32-style birthday attacks (same class as 3DES) after ~4GB of encrypted data.
|
|
65
|
+
Remediation: Replace Blowfish with AES/GCM/NoPadding or another 128-bit block cipher.
|
|
66
|
+
languages:
|
|
67
|
+
- java
|
|
68
|
+
patterns:
|
|
69
|
+
- pattern-either:
|
|
70
|
+
- pattern: Cipher.getInstance("Blowfish")
|
|
71
|
+
- pattern: Cipher.getInstance("Blowfish/$MODE/$PAD")
|
|
72
|
+
- pattern: Cipher.getInstance("Blowfish", "$P")
|
|
73
|
+
- pattern: Cipher.getInstance("Blowfish/$MODE/$PAD", "$P")
|
|
74
|
+
metadata:
|
|
75
|
+
cwe: "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
|
|
76
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
77
|
+
masvs: "MASVS-CRYPTO-1"
|
|
78
|
+
category: android-crypto
|
|
79
|
+
precision: very-high
|
|
80
|
+
confidence: very-high
|
|
81
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
82
|
+
references:
|
|
83
|
+
- https://cwe.mitre.org/data/definitions/327.html
|
|
84
|
+
|
|
85
|
+
- id: zm-android-des-single-cipher
|
|
86
|
+
severity: CRITICAL
|
|
87
|
+
message: |
|
|
88
|
+
Detected single DES cipher usage. DES uses a 56-bit key which is trivially brute-forceable
|
|
89
|
+
and has been broken for decades. Single DES must never be used.
|
|
90
|
+
Remediation: Replace DES with AES/GCM/NoPadding (minimum 128-bit key).
|
|
91
|
+
languages:
|
|
92
|
+
- java
|
|
93
|
+
patterns:
|
|
94
|
+
- pattern-either:
|
|
95
|
+
- pattern: Cipher.getInstance("DES")
|
|
96
|
+
- pattern: Cipher.getInstance("DES/$MODE/$PAD")
|
|
97
|
+
- pattern: Cipher.getInstance("DES", "$P")
|
|
98
|
+
metadata:
|
|
99
|
+
cwe: "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
|
|
100
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
101
|
+
masvs: "MASVS-CRYPTO-1"
|
|
102
|
+
category: android-crypto
|
|
103
|
+
precision: very-high
|
|
104
|
+
confidence: very-high
|
|
105
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
106
|
+
references:
|
|
107
|
+
- https://cwe.mitre.org/data/definitions/327.html
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# CWE-329: CBC Mode Without Integrity Check (Android)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: ZhuMa V4.1 Rule Expansion - padding oracle attack surface
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-cbc-without-mac
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
Detected AES/CBC cipher mode without HMAC or authenticated encryption.
|
|
10
|
+
CBC mode alone is vulnerable to padding oracle attacks when used without integrity protection.
|
|
11
|
+
An attacker can modify ciphertexts and observe decryption error behavior to recover plaintext.
|
|
12
|
+
Remediation: Use AES/GCM which provides built-in authentication, or apply Encrypt-then-MAC with HMAC-SHA256.
|
|
13
|
+
languages:
|
|
14
|
+
- java
|
|
15
|
+
patterns:
|
|
16
|
+
- pattern-either:
|
|
17
|
+
- pattern: Cipher.getInstance("AES/CBC/$PADDING")
|
|
18
|
+
- pattern: Cipher.getInstance("AES/CBC/$PADDING", "$PROVIDER")
|
|
19
|
+
metadata:
|
|
20
|
+
cwe: "CWE-329: Generation of Predictable IV with CBC Mode"
|
|
21
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
22
|
+
masvs: "MASVS-CRYPTO-1"
|
|
23
|
+
category: android-crypto
|
|
24
|
+
precision: very-high
|
|
25
|
+
confidence: very-high
|
|
26
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
27
|
+
references:
|
|
28
|
+
- https://cwe.mitre.org/data/definitions/329.html
|
|
29
|
+
- https://developer.android.com/privacy-and-security/risks/crypto-deprecation
|
|
30
|
+
|
|
31
|
+
- id: zm-android-cbc-pkcs5-padding-oracle
|
|
32
|
+
severity: HIGH
|
|
33
|
+
message: |
|
|
34
|
+
Detected AES/CBC/PKCS5Padding (or PKCS7Padding) without MAC verification.
|
|
35
|
+
PKCS5/PKCS7 padding in CBC mode creates a padding oracle if the server returns different
|
|
36
|
+
error messages for valid vs invalid padding.
|
|
37
|
+
Remediation: Use AES/GCM/NoPadding instead of CBC with PKCS padding.
|
|
38
|
+
languages:
|
|
39
|
+
- java
|
|
40
|
+
patterns:
|
|
41
|
+
- pattern-either:
|
|
42
|
+
- pattern: Cipher.getInstance("AES/CBC/PKCS5Padding")
|
|
43
|
+
- pattern: Cipher.getInstance("AES/CBC/PKCS5Padding", "$PROVIDER")
|
|
44
|
+
metadata:
|
|
45
|
+
cwe: "CWE-329: Generation of Predictable IV with CBC Mode"
|
|
46
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
47
|
+
masvs: "MASVS-CRYPTO-1"
|
|
48
|
+
category: android-crypto
|
|
49
|
+
precision: very-high
|
|
50
|
+
confidence: very-high
|
|
51
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
52
|
+
references:
|
|
53
|
+
- https://cwe.mitre.org/data/definitions/329.html
|
|
54
|
+
|
|
55
|
+
- id: zm-android-custom-cipher-decrypt-no-integrity
|
|
56
|
+
severity: MEDIUM
|
|
57
|
+
message: |
|
|
58
|
+
Detected Cipher.doFinal() in decrypt mode without any subsequent MAC/hash verification.
|
|
59
|
+
Data decrypted without integrity verification is vulnerable to bit-flipping and padding oracle attacks.
|
|
60
|
+
Remediation: Use authenticated encryption (AES/GCM) or verify an HMAC before decrypting.
|
|
61
|
+
languages:
|
|
62
|
+
- java
|
|
63
|
+
patterns:
|
|
64
|
+
- pattern-either:
|
|
65
|
+
- pattern: $DECRYPT.init(Cipher.DECRYPT_MODE, $KEY, $IV)
|
|
66
|
+
- pattern: $DECRYPT.doFinal($DATA)
|
|
67
|
+
metadata:
|
|
68
|
+
cwe: "CWE-329: Generation of Predictable IV with CBC Mode"
|
|
69
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
70
|
+
masvs: "MASVS-CRYPTO-1"
|
|
71
|
+
category: android-crypto
|
|
72
|
+
precision: low
|
|
73
|
+
confidence: low
|
|
74
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
75
|
+
references:
|
|
76
|
+
- https://cwe.mitre.org/data/definitions/329.html
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# CWE-470: 反射调用使用不可信类名 (Android)
|
|
2
|
+
# 逐码 ZhuMa V4.0 — Android 规则库
|
|
3
|
+
# 来源: V3 审计引擎 VULN-CE-003
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-reflection-untrusted-classname
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
检测到 Class.forName() 使用可能来自用户输入的类名。
|
|
10
|
+
攻击者可通过 JS Bridge / Deeplink / Intent Extra 传入恶意类名,
|
|
11
|
+
利用反射实例化任意类,可能导致代码执行或安全绕过。
|
|
12
|
+
修复: 使用白名单映射限制允许的类名;绝不从外部输入直接获取类名。
|
|
13
|
+
languages:
|
|
14
|
+
- java
|
|
15
|
+
patterns:
|
|
16
|
+
- pattern-either:
|
|
17
|
+
- pattern: |
|
|
18
|
+
Class.forName($INPUT)
|
|
19
|
+
- pattern: |
|
|
20
|
+
Class.forName($INPUT, $INIT, $LOADER)
|
|
21
|
+
- pattern-either:
|
|
22
|
+
- pattern-regex: 'getString'
|
|
23
|
+
- pattern-regex: 'getIntent'
|
|
24
|
+
- pattern-regex: 'getParam'
|
|
25
|
+
- pattern-regex: 'getQuery'
|
|
26
|
+
- pattern-regex: 'getData'
|
|
27
|
+
- pattern-regex: 'getExtras'
|
|
28
|
+
metadata:
|
|
29
|
+
cwe: "CWE-470: Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')"
|
|
30
|
+
owasp-mobile: "M8: Code Tampering"
|
|
31
|
+
masvs: "MASVS-CODE-4"
|
|
32
|
+
category: android-code-execution
|
|
33
|
+
precision: medium
|
|
34
|
+
confidence: medium
|
|
35
|
+
likelihood: medium
|
|
36
|
+
impact: high
|
|
37
|
+
source: "V3 Audit Engine - VULN-CE-003"
|
|
38
|
+
references:
|
|
39
|
+
- https://cwe.mitre.org/data/definitions/470.html
|