@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,80 @@
|
|
|
1
|
+
# CWE-780: RSA Without OAEP Padding (Android)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: ZhuMa V4.1 Rule Expansion - asymmetric crypto gaps
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-rsa-no-oaep
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
Detected RSA cipher without OAEP padding. RSA with PKCS1Padding is vulnerable to
|
|
10
|
+
padding oracle attacks (Bleichenbacher / ROBOT attack), allowing an attacker to decrypt
|
|
11
|
+
ciphertexts by observing server error responses.
|
|
12
|
+
Remediation: Use "RSA/ECB/OAEPWithSHA-256AndMGF1Padding" or "RSA/ECB/OAEPWithSHA-512AndMGF1Padding".
|
|
13
|
+
languages:
|
|
14
|
+
- java
|
|
15
|
+
patterns:
|
|
16
|
+
- pattern-either:
|
|
17
|
+
- pattern: Cipher.getInstance("RSA/ECB/PKCS1Padding")
|
|
18
|
+
- pattern: Cipher.getInstance("RSA/ECB/PKCS1Padding", "$P")
|
|
19
|
+
- pattern: Cipher.getInstance("RSA")
|
|
20
|
+
- pattern: Cipher.getInstance("RSA", "$P")
|
|
21
|
+
metadata:
|
|
22
|
+
cwe: "CWE-780: Use of RSA Algorithm without OAEP"
|
|
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/780.html
|
|
31
|
+
- https://developer.android.com/privacy-and-security/risks/crypto-deprecation
|
|
32
|
+
|
|
33
|
+
- id: zm-android-rsa-encrypt-pkcs1
|
|
34
|
+
severity: HIGH
|
|
35
|
+
message: |
|
|
36
|
+
Detected Cipher with RSA and "PKCS1Padding" used in ENCRYPT_MODE.
|
|
37
|
+
RSA PKCS1 v1.5 encryption is vulnerable to Bleichenbacher's chosen-ciphertext attack.
|
|
38
|
+
Remediation: Use OAEP padding (OAEPWithSHA-256AndMGF1Padding) for RSA encryption.
|
|
39
|
+
languages:
|
|
40
|
+
- java
|
|
41
|
+
patterns:
|
|
42
|
+
- pattern-either:
|
|
43
|
+
- pattern: Cipher.getInstance("RSA/ECB/PKCS1Padding")
|
|
44
|
+
- pattern: $CIPHER.init(Cipher.ENCRYPT_MODE, $KEY)
|
|
45
|
+
metadata:
|
|
46
|
+
cwe: "CWE-780: Use of RSA Algorithm without OAEP"
|
|
47
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
48
|
+
masvs: "MASVS-CRYPTO-1"
|
|
49
|
+
category: android-crypto
|
|
50
|
+
precision: high
|
|
51
|
+
confidence: high
|
|
52
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
53
|
+
references:
|
|
54
|
+
- https://cwe.mitre.org/data/definitions/780.html
|
|
55
|
+
|
|
56
|
+
- id: zm-android-rsa-nowrap-mode
|
|
57
|
+
severity: LOW
|
|
58
|
+
message: |
|
|
59
|
+
Detected RSA cipher used in NoPadding mode. While sometimes intentional (e.g., for custom protocols),
|
|
60
|
+
raw RSA without padding should be carefully reviewed to ensure it is not used for direct encryption.
|
|
61
|
+
Raw RSA operations without padding are mathematically deterministic and vulnerable to attack.
|
|
62
|
+
Remediation: Verify this usage is intentional and reviewed by a crypto expert.
|
|
63
|
+
languages:
|
|
64
|
+
- java
|
|
65
|
+
patterns:
|
|
66
|
+
- pattern-either:
|
|
67
|
+
- pattern: Cipher.getInstance("RSA/ECB/NoPadding")
|
|
68
|
+
- pattern: Cipher.getInstance("RSA/ECB/NoPadding", "$P")
|
|
69
|
+
- pattern: Cipher.getInstance("RSA/None/NoPadding")
|
|
70
|
+
- pattern: Cipher.getInstance("RSA/None/NoPadding", "$P")
|
|
71
|
+
metadata:
|
|
72
|
+
cwe: "CWE-780: Use of RSA Algorithm without OAEP"
|
|
73
|
+
owasp-mobile: "M5: Insufficient Cryptography"
|
|
74
|
+
masvs: "MASVS-CRYPTO-1"
|
|
75
|
+
category: android-crypto
|
|
76
|
+
precision: very-high
|
|
77
|
+
confidence: very-high
|
|
78
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
79
|
+
references:
|
|
80
|
+
- https://cwe.mitre.org/data/definitions/780.html
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# CWE-79 and CWE-749: WebView loadData / loadDataWithBaseURL Security (Android)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: ZhuMa V4.1 Rule Expansion - WebView data loading attacks
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-loaddata-null-baseurl
|
|
7
|
+
severity: MEDIUM
|
|
8
|
+
message: |
|
|
9
|
+
Detected loadDataWithBaseURL() with null baseURL and untrusted content.
|
|
10
|
+
When baseURL is null, the WebView cannot resolve relative URLs and Same-Origin Policy is weakened.
|
|
11
|
+
This can be exploited to access file:// resources or bypass CORS restrictions.
|
|
12
|
+
Remediation: Always provide a valid, trusted baseURL (e.g., "https://trusted.example.com").
|
|
13
|
+
Use loadData() for simple HTML without external resources.
|
|
14
|
+
languages:
|
|
15
|
+
- java
|
|
16
|
+
patterns:
|
|
17
|
+
- pattern-either:
|
|
18
|
+
- pattern: $WV.loadDataWithBaseURL(null, $DATA, $MIME, $ENC, null)
|
|
19
|
+
- pattern: $WV.loadDataWithBaseURL(null, $DATA, $MIME, $ENC, $HIST)
|
|
20
|
+
metadata:
|
|
21
|
+
cwe: "CWE-79: Improper Neutralization of Input During Web Page Generation"
|
|
22
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
23
|
+
masvs: "MASVS-PLATFORM-2"
|
|
24
|
+
category: android-webview
|
|
25
|
+
precision: high
|
|
26
|
+
confidence: high
|
|
27
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
28
|
+
references:
|
|
29
|
+
- https://cwe.mitre.org/data/definitions/79.html
|
|
30
|
+
- https://developer.android.com/reference/android/webkit/WebView
|
|
31
|
+
|
|
32
|
+
- id: zm-android-loaddata-file-baseurl
|
|
33
|
+
severity: HIGH
|
|
34
|
+
message: |
|
|
35
|
+
Detected loadDataWithBaseURL() using "file://" as the base URL.
|
|
36
|
+
A file:// base URL allows loaded content to access local files on the device
|
|
37
|
+
via XMLHttpRequest or iframe, leading to local file disclosure.
|
|
38
|
+
Remediation: Use an https:// base URL from a trusted domain. Never use file:// as base URL.
|
|
39
|
+
languages:
|
|
40
|
+
- java
|
|
41
|
+
patterns:
|
|
42
|
+
- pattern-either:
|
|
43
|
+
- pattern: $WV.loadDataWithBaseURL("file://", $DATA, $MIME, $ENC, $HIST)
|
|
44
|
+
- pattern: $WV.loadDataWithBaseURL("file:///", $DATA, $MIME, $ENC, $HIST)
|
|
45
|
+
- pattern: $WV.loadDataWithBaseURL("file:///android_asset/", $DATA, $MIME, $ENC, $HIST)
|
|
46
|
+
metadata:
|
|
47
|
+
cwe: "CWE-749: Exposed Dangerous Method or Function"
|
|
48
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
49
|
+
masvs: "MASVS-PLATFORM-2"
|
|
50
|
+
category: android-webview
|
|
51
|
+
precision: very-high
|
|
52
|
+
confidence: very-high
|
|
53
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
54
|
+
references:
|
|
55
|
+
- https://cwe.mitre.org/data/definitions/749.html
|
|
56
|
+
|
|
57
|
+
- id: zm-android-loadurl-file-scheme
|
|
58
|
+
severity: HIGH
|
|
59
|
+
message: |
|
|
60
|
+
Detected WebView.loadUrl() with "file://" scheme, which can load local files into WebView.
|
|
61
|
+
If combined with untrusted content or JavaScript enabled, this can expose local app data.
|
|
62
|
+
Remediation: Disable file access with setAllowFileAccess(false) and use https:// URLs only.
|
|
63
|
+
languages:
|
|
64
|
+
- java
|
|
65
|
+
patterns:
|
|
66
|
+
- pattern-either:
|
|
67
|
+
- pattern: $WV.loadUrl("file://" + $PATH)
|
|
68
|
+
- pattern: $WV.loadUrl("file:///" + $PATH)
|
|
69
|
+
metadata:
|
|
70
|
+
cwe: "CWE-749: Exposed Dangerous Method or Function"
|
|
71
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
72
|
+
masvs: "MASVS-PLATFORM-2"
|
|
73
|
+
category: android-webview
|
|
74
|
+
precision: high
|
|
75
|
+
confidence: high
|
|
76
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
77
|
+
references:
|
|
78
|
+
- https://cwe.mitre.org/data/definitions/749.html
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# CWE-79: WebView 动态 URL + JS 启用 — XSS/URL 注入 (Android)
|
|
2
|
+
# 逐码 ZhuMa V4.0 — Android 规则库
|
|
3
|
+
# 来源: V3 审计引擎 VULN-WV-004
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-webview-dynamic-url-js-enabled
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
检测到 WebView 使用来自 Intent/网络的数据构造 URL 且 JavaScript 已启用。
|
|
10
|
+
攻击者可通过 Deeplink 传入恶意 URL(如 javascript: 协议或恶意站点),
|
|
11
|
+
结合已启用的 JS 执行实现 XSS、Token 窃取甚至升级为 RCE。
|
|
12
|
+
修复:
|
|
13
|
+
1. 实施 URL 白名单(仅允许可信域名)
|
|
14
|
+
2. 仅允许 HTTPS 协议
|
|
15
|
+
3. 实施 Content Security Policy
|
|
16
|
+
languages:
|
|
17
|
+
- java
|
|
18
|
+
patterns:
|
|
19
|
+
- pattern-either:
|
|
20
|
+
- pattern: |
|
|
21
|
+
$WV.loadUrl($INTENT.getStringExtra($KEY))
|
|
22
|
+
- pattern: |
|
|
23
|
+
$WV.loadUrl($URI.toString())
|
|
24
|
+
- pattern: |
|
|
25
|
+
$WV.loadUrl($BUNDLE.getString($KEY))
|
|
26
|
+
metadata:
|
|
27
|
+
cwe: "CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')"
|
|
28
|
+
owasp-mobile: "M7: Client Code Quality"
|
|
29
|
+
masvs: "MASVS-PLATFORM-2"
|
|
30
|
+
category: android-webview
|
|
31
|
+
precision: medium
|
|
32
|
+
confidence: medium
|
|
33
|
+
likelihood: medium
|
|
34
|
+
impact: high
|
|
35
|
+
source: "V3 Audit Engine - VULN-WV-004"
|
|
36
|
+
references:
|
|
37
|
+
- https://developer.android.com/privacy-and-security/risks/webview-cross-site-scripting
|
|
38
|
+
|
|
39
|
+
- id: zm-android-webview-shouldoverrideurlloading-bypass
|
|
40
|
+
severity: HIGH
|
|
41
|
+
message: |
|
|
42
|
+
检测到 shouldOverrideUrlLoading() 返回 false,未阻断可疑 URL 加载。
|
|
43
|
+
攻击者可通过 URL 重定向链绕过 HTTP-only 白名单:
|
|
44
|
+
https://safe.com → 302 → intent:// → Intent Scheme攻击 → 启动任意组件
|
|
45
|
+
https://safe.com → 302 → javascript: → XSS → Token 窃取
|
|
46
|
+
修复: 对所有非 HTTPS/non-whitelist URL 返回 true 阻断加载。
|
|
47
|
+
languages:
|
|
48
|
+
- java
|
|
49
|
+
patterns:
|
|
50
|
+
- pattern: |
|
|
51
|
+
public boolean shouldOverrideUrlLoading(WebView $WV, String $URL) {
|
|
52
|
+
...
|
|
53
|
+
return false;
|
|
54
|
+
...
|
|
55
|
+
}
|
|
56
|
+
metadata:
|
|
57
|
+
cwe: "CWE-601: URL Redirection to Untrusted Site ('Open Redirect')"
|
|
58
|
+
owasp-mobile: "M7: Client Code Quality"
|
|
59
|
+
masvs: "MASVS-PLATFORM-2"
|
|
60
|
+
category: android-webview
|
|
61
|
+
precision: high
|
|
62
|
+
confidence: high
|
|
63
|
+
source: "V3 Audit Engine - VULN-WV-009"
|
|
64
|
+
references:
|
|
65
|
+
- https://developer.android.com/reference/android/webkit/WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView,%20java.lang.String)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# CWE-798: 硬编码凭据 (Android)
|
|
2
|
+
# 逐码 ZhuMa V4.0 — Android 规则库
|
|
3
|
+
# 来源: V3 审计引擎 all_in_one.js JS scan + audit_rules_v2.py scan_crypto_expanded
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-hardcoded-api-key
|
|
7
|
+
severity: CRITICAL
|
|
8
|
+
message: |
|
|
9
|
+
检测到疑似硬编码 API Key / Token / Secret。
|
|
10
|
+
硬编码在客户端 APK 中的凭证可通过逆向直接提取,导致 API 认证体系完全失效。
|
|
11
|
+
修复:
|
|
12
|
+
1. 密钥从服务端动态下发 (不可写死在客户端)
|
|
13
|
+
2. 使用 Android Keystore System 存储
|
|
14
|
+
3. 对请求做签名 + HMAC 而非靠客户端持有密钥
|
|
15
|
+
languages:
|
|
16
|
+
- java
|
|
17
|
+
patterns:
|
|
18
|
+
- pattern-either:
|
|
19
|
+
- pattern: |
|
|
20
|
+
$TYPE $VAR = "$API_KEY";
|
|
21
|
+
- pattern: |
|
|
22
|
+
private static final String $VAR = "$API_KEY";
|
|
23
|
+
- pattern: |
|
|
24
|
+
public static final String $VAR = "$API_KEY";
|
|
25
|
+
- metavariable-regex:
|
|
26
|
+
metavariable: $VAR
|
|
27
|
+
regex: '(?i)(api[_]?key|app[_]?key|client[_]?secret|app[_]?secret|access[_]?key|secret[_]?key|auth[_]?token)'
|
|
28
|
+
- metavariable-regex:
|
|
29
|
+
metavariable: $API_KEY
|
|
30
|
+
regex: '.{8,100}'
|
|
31
|
+
metadata:
|
|
32
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
33
|
+
owasp-mobile: "M8: Code Tampering"
|
|
34
|
+
masvs: "MASVS-AUTH-1"
|
|
35
|
+
category: android-credentials
|
|
36
|
+
precision: medium
|
|
37
|
+
confidence: medium
|
|
38
|
+
likelihood: high
|
|
39
|
+
impact: critical
|
|
40
|
+
source: "V3 Audit Engine - all_in_one.js credPatterns"
|
|
41
|
+
references:
|
|
42
|
+
- https://cwe.mitre.org/data/definitions/798.html
|
|
43
|
+
- https://developer.android.com/privacy-and-security/risks/hardcoded-credentials
|
|
44
|
+
|
|
45
|
+
- id: zm-android-hardcoded-jwt-secret
|
|
46
|
+
severity: CRITICAL
|
|
47
|
+
message: |
|
|
48
|
+
检测到疑似硬编码 JWT Secret / Signing Key。
|
|
49
|
+
JWT 签名密钥硬编码在客户端意味着任何逆向 APP 的用户都可伪造任意 JWT Token,
|
|
50
|
+
绕过认证、冒充任意用户。
|
|
51
|
+
修复: JWT 签名密钥必须由服务端持有,客户端应通过 OAuth 2.0 流程获取 Access Token。
|
|
52
|
+
languages:
|
|
53
|
+
- java
|
|
54
|
+
patterns:
|
|
55
|
+
- pattern-either:
|
|
56
|
+
- pattern: |
|
|
57
|
+
Jwts.parser().setSigningKey("$KEY".getBytes())
|
|
58
|
+
- pattern: |
|
|
59
|
+
Jwts.builder().signWith(SignatureAlgorithm.HS256, "$KEY")
|
|
60
|
+
- pattern: |
|
|
61
|
+
Jwts.builder().signWith(SignatureAlgorithm.HS256, "$KEY".getBytes())
|
|
62
|
+
- metavariable-regex:
|
|
63
|
+
metavariable: $KEY
|
|
64
|
+
regex: '.{8,}'
|
|
65
|
+
metadata:
|
|
66
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
67
|
+
owasp-mobile: "M8: Code Tampering"
|
|
68
|
+
masvs: "MASVS-AUTH-1"
|
|
69
|
+
category: android-credentials
|
|
70
|
+
precision: very-high
|
|
71
|
+
confidence: very-high
|
|
72
|
+
source: "V3 Audit Engine - crypto scan"
|
|
73
|
+
references:
|
|
74
|
+
- https://cwe.mitre.org/data/definitions/798.html
|
|
75
|
+
- https://jwt.io/introduction
|
|
76
|
+
|
|
77
|
+
- id: zm-android-hardcoded-password
|
|
78
|
+
severity: CRITICAL
|
|
79
|
+
message: |
|
|
80
|
+
检测到疑似硬编码密码字段。
|
|
81
|
+
密码硬编码在 APP 源码中可直接通过静态分析提取。
|
|
82
|
+
修复: 密码应通过用户输入获取或使用安全凭证存储机制。
|
|
83
|
+
languages:
|
|
84
|
+
- java
|
|
85
|
+
patterns:
|
|
86
|
+
- pattern-either:
|
|
87
|
+
- pattern: |
|
|
88
|
+
String $VAR = "$PWD";
|
|
89
|
+
- pattern: |
|
|
90
|
+
private static final String $VAR = "$PWD";
|
|
91
|
+
- pattern: |
|
|
92
|
+
public static final String $VAR = "$PWD";
|
|
93
|
+
- metavariable-regex:
|
|
94
|
+
metavariable: $VAR
|
|
95
|
+
regex: '(?i)(password|passwd|pwd|passcode|pin_code)'
|
|
96
|
+
- metavariable-regex:
|
|
97
|
+
metavariable: $PWD
|
|
98
|
+
regex: '.{6,}'
|
|
99
|
+
metadata:
|
|
100
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
101
|
+
owasp-mobile: "M8: Code Tampering"
|
|
102
|
+
masvs: "MASVS-AUTH-1"
|
|
103
|
+
category: android-credentials
|
|
104
|
+
precision: low
|
|
105
|
+
confidence: low
|
|
106
|
+
source: "V3 Audit Engine - baseline scan"
|
|
107
|
+
references:
|
|
108
|
+
- https://cwe.mitre.org/data/definitions/798.html
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# CWE-89: SQL 注入 (Android SQLite)
|
|
2
|
+
# 逐码 ZhuMa V4.0 — Android 规则库
|
|
3
|
+
# 来源: V3 审计引擎 VULN-CP-002
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-sqlite-rawquery
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
检测到 SQLiteDatabase.rawQuery() 使用字符串拼接或 String.format 构造 SQL 查询。
|
|
10
|
+
如果 where/selection 参数来自用户输入(Intent Extra、ContentProvider query 参数、网络数据),
|
|
11
|
+
存在 SQL 注入风险,可导致数据泄露或绕过认证。
|
|
12
|
+
Android 中 SQL 注入常发生在 ContentProvider.query() 实现中的 rawQuery 调用。
|
|
13
|
+
修复: 使用 query() + selectionArgs 参数化查询;绝对禁止字符串拼接 SQL。
|
|
14
|
+
languages:
|
|
15
|
+
- java
|
|
16
|
+
patterns:
|
|
17
|
+
- pattern-either:
|
|
18
|
+
- pattern: |
|
|
19
|
+
$DB.rawQuery($SQL + $PARAM, ...)
|
|
20
|
+
- pattern: |
|
|
21
|
+
$DB.rawQuery(String.format($SQL, $PARAM), ...)
|
|
22
|
+
- pattern: |
|
|
23
|
+
$DB.execSQL($SQL + $PARAM)
|
|
24
|
+
metadata:
|
|
25
|
+
cwe: "CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')"
|
|
26
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
27
|
+
masvs: "MASVS-STORAGE-2"
|
|
28
|
+
category: android-storage
|
|
29
|
+
precision: medium
|
|
30
|
+
confidence: medium
|
|
31
|
+
likelihood: medium
|
|
32
|
+
impact: high
|
|
33
|
+
source: "V3 Audit Engine - VULN-CP-002"
|
|
34
|
+
references:
|
|
35
|
+
- https://developer.android.com/privacy-and-security/risks/sql-injection
|
|
36
|
+
- https://developer.android.com/training/data-storage/sqlite
|
|
37
|
+
|
|
38
|
+
- id: zm-android-content-provider-rawquery
|
|
39
|
+
severity: HIGH
|
|
40
|
+
message: |
|
|
41
|
+
检测到 ContentProvider 实现中使用 rawQuery() 且无 selectionArgs 参数。
|
|
42
|
+
ContentProvider 的 query() 方法接收来自任意 APP 的参数,
|
|
43
|
+
如果直接拼接到 rawQuery() 中则存在严重的 SQL 注入风险。
|
|
44
|
+
修复: 在 ContentProvider.query() 实现中使用 SQLiteDatabase.query() + selectionArgs。
|
|
45
|
+
languages:
|
|
46
|
+
- java
|
|
47
|
+
patterns:
|
|
48
|
+
- pattern: |
|
|
49
|
+
public Cursor query(Uri $URI, ...) {
|
|
50
|
+
...
|
|
51
|
+
$DB.rawQuery($SQL, null);
|
|
52
|
+
...
|
|
53
|
+
}
|
|
54
|
+
metadata:
|
|
55
|
+
cwe: "CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')"
|
|
56
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
57
|
+
masvs: "MASVS-STORAGE-2"
|
|
58
|
+
category: android-storage
|
|
59
|
+
precision: high
|
|
60
|
+
confidence: high
|
|
61
|
+
source: "V3 Audit Engine - VULN-CP-002"
|
|
62
|
+
references:
|
|
63
|
+
- https://developer.android.com/privacy-and-security/risks/sql-injection
|
|
64
|
+
|
|
65
|
+
- id: zm-android-content-provider-openfile-path-traversal
|
|
66
|
+
severity: CRITICAL
|
|
67
|
+
message: |
|
|
68
|
+
检测到 ContentProvider.openFile() 实现中使用 getPath() 获取路径但未调用 getCanonicalPath()。
|
|
69
|
+
攻击者可通过构造 content:// URI 注入路径遍历序列(如 ../../../../ ),
|
|
70
|
+
读取 APP 私有目录下的任意文件(databases、shared_prefs 等)。
|
|
71
|
+
著名案例: CVE-2021-0307 (Android SystemUI 路径遍历)
|
|
72
|
+
修复: 在 openFile() 中先调用 getCanonicalPath(),再校验路径是否在允许的目录前缀内。
|
|
73
|
+
languages:
|
|
74
|
+
- java
|
|
75
|
+
patterns:
|
|
76
|
+
- pattern: |
|
|
77
|
+
public ParcelFileDescriptor openFile(Uri $URI, String $MODE) {
|
|
78
|
+
...
|
|
79
|
+
$PATH.getPath();
|
|
80
|
+
...
|
|
81
|
+
}
|
|
82
|
+
- pattern-not: |
|
|
83
|
+
public ParcelFileDescriptor openFile(Uri $URI, String $MODE) {
|
|
84
|
+
...
|
|
85
|
+
$PATH.getCanonicalPath();
|
|
86
|
+
...
|
|
87
|
+
}
|
|
88
|
+
metadata:
|
|
89
|
+
cwe: "CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')"
|
|
90
|
+
owasp-mobile: "M8: Code Tampering"
|
|
91
|
+
masvs: "MASVS-STORAGE-1"
|
|
92
|
+
category: android-storage
|
|
93
|
+
precision: medium
|
|
94
|
+
confidence: medium
|
|
95
|
+
likelihood: high
|
|
96
|
+
impact: critical
|
|
97
|
+
source: "V3 Audit Engine - VULN-CP-001"
|
|
98
|
+
references:
|
|
99
|
+
- https://cwe.mitre.org/data/definitions/22.html
|
|
100
|
+
- https://nvd.nist.gov/vuln/detail/CVE-2021-0307
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# CWE-927: 隐式 Intent / 导出组件无权限保护 (Android)
|
|
2
|
+
# 逐码 ZhuMa V4.0 — Android 规则库
|
|
3
|
+
# 来源: V3 审计引擎 VULN-INT-001 / VULN-INT-002 / VULN-PI-001 / VULN-PI-002
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-pendingintent-no-immutable
|
|
7
|
+
severity: CRITICAL
|
|
8
|
+
message: |
|
|
9
|
+
检测到 PendingIntent 未设置 FLAG_IMMUTABLE。
|
|
10
|
+
Android 12+ (API 31) 强制要求 PendingIntent 显式声明 FLAG_IMMUTABLE 或 FLAG_MUTABLE。
|
|
11
|
+
缺失此标记的 PendingIntent 可被恶意 APP 篡改 Intent Extras,
|
|
12
|
+
实现越权操作(如劫持通知栏操作、篡改桌面小部件点击行为)。
|
|
13
|
+
修复: PendingIntent.getActivity(ctx, 0, intent, PendingIntent.FLAG_IMMUTABLE);
|
|
14
|
+
languages:
|
|
15
|
+
- java
|
|
16
|
+
patterns:
|
|
17
|
+
- pattern-either:
|
|
18
|
+
- pattern: |
|
|
19
|
+
PendingIntent.getActivity($CTX, $RQ, $INTENT, 0)
|
|
20
|
+
- pattern: |
|
|
21
|
+
PendingIntent.getBroadcast($CTX, $RQ, $INTENT, 0)
|
|
22
|
+
- pattern: |
|
|
23
|
+
PendingIntent.getService($CTX, $RQ, $INTENT, 0)
|
|
24
|
+
- pattern: |
|
|
25
|
+
PendingIntent.getForegroundService($CTX, $RQ, $INTENT, 0)
|
|
26
|
+
- pattern: |
|
|
27
|
+
PendingIntent.getActivity($CTX, $RQ, $INTENT, PendingIntent.FLAG_UPDATE_CURRENT)
|
|
28
|
+
metadata:
|
|
29
|
+
cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
|
|
30
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
31
|
+
masvs: "MASVS-PLATFORM-3"
|
|
32
|
+
category: android-intent
|
|
33
|
+
precision: high
|
|
34
|
+
confidence: high
|
|
35
|
+
likelihood: high
|
|
36
|
+
impact: high
|
|
37
|
+
source: "V3 Audit Engine - VULN-PI-001"
|
|
38
|
+
references:
|
|
39
|
+
- https://developer.android.com/guide/components/intents-filters#PendingIntentMutability
|
|
40
|
+
- https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability
|
|
41
|
+
|
|
42
|
+
- id: zm-android-implicit-pendingintent
|
|
43
|
+
severity: HIGH
|
|
44
|
+
message: |
|
|
45
|
+
检测到使用隐式 Intent 创建 PendingIntent(未指定 setComponent/setClass)。
|
|
46
|
+
隐式 PendingIntent 可被任意注册了匹配 IntentFilter 的 APP 劫持,
|
|
47
|
+
导致用户点击后被重定向到恶意 Activity/Service。
|
|
48
|
+
修复: 在 Intent 上调用 setComponent() 或 setClass() 指定目标组件。
|
|
49
|
+
languages:
|
|
50
|
+
- java
|
|
51
|
+
patterns:
|
|
52
|
+
- pattern: |
|
|
53
|
+
$PENDINGINTENT.get$TYPE($CTX, $RQ, new Intent($ACTION), ...)
|
|
54
|
+
metadata:
|
|
55
|
+
cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
|
|
56
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
57
|
+
masvs: "MASVS-PLATFORM-3"
|
|
58
|
+
category: android-intent
|
|
59
|
+
precision: medium
|
|
60
|
+
confidence: medium
|
|
61
|
+
source: "V3 Audit Engine - VULN-PI-002"
|
|
62
|
+
references:
|
|
63
|
+
- https://developer.android.com/privacy-and-security/risks/unsafe-intent-resolution
|
|
64
|
+
|
|
65
|
+
- id: zm-android-exported-component-no-permission
|
|
66
|
+
severity: WARNING
|
|
67
|
+
message: |
|
|
68
|
+
检测到 Android 组件 (Activity/Service/Receiver/Provider) 导出为 true 但无权限保护。
|
|
69
|
+
这需要结合 AndroidManifest.xml 分析。Semgrep 在 Java 层检测到组件类可以提醒审计人员检查 Manifest 配置。
|
|
70
|
+
如果Manifest中 export=true 且无 permission,任何APP都可启动/访问该组件。
|
|
71
|
+
languages:
|
|
72
|
+
- java
|
|
73
|
+
pattern: |
|
|
74
|
+
class $CLASS extends $COMPONENT {
|
|
75
|
+
...
|
|
76
|
+
}
|
|
77
|
+
paths:
|
|
78
|
+
include:
|
|
79
|
+
- "**/AndroidManifest.xml"
|
|
80
|
+
metadata:
|
|
81
|
+
cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
|
|
82
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
83
|
+
masvs: "MASVS-PLATFORM-3"
|
|
84
|
+
category: android-intent
|
|
85
|
+
precision: low
|
|
86
|
+
confidence: low
|
|
87
|
+
note: |
|
|
88
|
+
此规则为资讯类提醒。实际判断组件导出需要解析 AndroidManifest.xml 中的
|
|
89
|
+
android:exported 和 android:permission 属性。
|
|
90
|
+
V3 引擎 (VULN-INT-001) 通过正则匹配 Manifest 实现精确检测。
|
|
91
|
+
建议配合 Android Lint 或专用 Manifest 扫描工具使用。
|
|
92
|
+
source: "V3 Audit Engine - VULN-INT-001"
|
|
93
|
+
|
|
94
|
+
- id: zm-android-non-https-deeplink
|
|
95
|
+
severity: WARNING
|
|
96
|
+
message: |
|
|
97
|
+
检测到 Java 代码中使用了自定义 URL scheme。
|
|
98
|
+
如果此 scheme 在 Manifest 中被配置为 Deep Link 且非 HTTPS,
|
|
99
|
+
可被第三方 APP 伪造 Deeplink 触发,实现 Intent 劫持。
|
|
100
|
+
这需要结合 AndroidManifest.xml 分析 —— 检查 <data android:scheme="xxx"/> 。
|
|
101
|
+
修复: 使用 HTTPS scheme + Android App Links (.well-known/assetlinks.json 验证)。
|
|
102
|
+
languages:
|
|
103
|
+
- java
|
|
104
|
+
patterns:
|
|
105
|
+
- pattern-either:
|
|
106
|
+
- pattern: |
|
|
107
|
+
Uri.parse("$SCHEME://...")
|
|
108
|
+
- pattern: |
|
|
109
|
+
new Intent(Intent.ACTION_VIEW, Uri.parse("$SCHEME://..."))
|
|
110
|
+
- metavariable-regex:
|
|
111
|
+
metavariable: $SCHEME
|
|
112
|
+
regex: '(?!https?|content|file|data|blob|mailto|tel|sms|geo|market)(^[a-z][a-z0-9+.-]*$)'
|
|
113
|
+
metadata:
|
|
114
|
+
cwe: "CWE-939: Improper Authorization in Handler for Custom URL Scheme"
|
|
115
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
116
|
+
masvs: "MASVS-PLATFORM-3"
|
|
117
|
+
category: android-intent
|
|
118
|
+
precision: low
|
|
119
|
+
confidence: low
|
|
120
|
+
note: "此规则检测 Java 源代码中使用的 scheme,Manifest 中的深层链接配置需通过 XML 解析确认。"
|
|
121
|
+
source: "V3 Audit Engine - VULN-INT-003"
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# CWE-927 and CWE-22: IPC FileProvider and Content Provider Path Traversal (Android)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: ZhuMa V4.1 Rule Expansion - IPC security hardening
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-fileprovider-path-too-broad
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
Detected FileProvider path configuration with an overly broad root-path or empty path.
|
|
10
|
+
A FileProvider with path="" or path="/" exposes the entire filesystem subtree to the requesting app,
|
|
11
|
+
allowing arbitrary file access beyond what is intended.
|
|
12
|
+
Remediation: Restrict FileProvider paths to specific subdirectories using path="specific/subdir/" with exact paths.
|
|
13
|
+
languages:
|
|
14
|
+
- java
|
|
15
|
+
patterns:
|
|
16
|
+
- pattern-either:
|
|
17
|
+
- pattern: $STR.equals("")
|
|
18
|
+
- pattern: $STR.equals("/")
|
|
19
|
+
metadata:
|
|
20
|
+
cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
|
|
21
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
22
|
+
masvs: "MASVS-PLATFORM-2"
|
|
23
|
+
category: android-ipc
|
|
24
|
+
precision: low
|
|
25
|
+
confidence: low
|
|
26
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
27
|
+
references:
|
|
28
|
+
- https://cwe.mitre.org/data/definitions/927.html
|
|
29
|
+
- https://developer.android.com/reference/androidx/core/content/FileProvider
|
|
30
|
+
|
|
31
|
+
- id: zm-android-contentprovider-openfile-no-canonical
|
|
32
|
+
severity: HIGH
|
|
33
|
+
message: |
|
|
34
|
+
Detected ContentProvider.openFile() without canonical path validation.
|
|
35
|
+
Without resolving the path to its canonical form and verifying it stays within the allowed directory,
|
|
36
|
+
a path traversal attack (../../etc/hosts) can access arbitrary files on the device.
|
|
37
|
+
Remediation: Use File.getCanonicalPath() and verify the result starts with the allowed base directory.
|
|
38
|
+
languages:
|
|
39
|
+
- java
|
|
40
|
+
patterns:
|
|
41
|
+
- pattern-either:
|
|
42
|
+
- pattern: ParcelFileDescriptor.open($FILE, $FLAGS)
|
|
43
|
+
metadata:
|
|
44
|
+
cwe: "CWE-22: Improper Limitation of a Pathname to a Restricted Directory"
|
|
45
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
46
|
+
masvs: "MASVS-PLATFORM-2"
|
|
47
|
+
category: android-ipc
|
|
48
|
+
precision: low
|
|
49
|
+
confidence: low
|
|
50
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
51
|
+
references:
|
|
52
|
+
- https://cwe.mitre.org/data/definitions/22.html
|
|
53
|
+
- https://developer.android.com/privacy-and-security/risks/path-traversal
|
|
54
|
+
|
|
55
|
+
- id: zm-android-contentprovider-call-no-permission
|
|
56
|
+
severity: MEDIUM
|
|
57
|
+
message: |
|
|
58
|
+
Detected ContentProvider.call() method exposed without permission check.
|
|
59
|
+
The call() method is a generic IPC channel that can execute arbitrary provider-defined methods.
|
|
60
|
+
Without permission enforcement, any app can invoke internal methods.
|
|
61
|
+
Remediation: Add permission check via checkCallingPermission() at the start of call().
|
|
62
|
+
languages:
|
|
63
|
+
- java
|
|
64
|
+
patterns:
|
|
65
|
+
- pattern-either:
|
|
66
|
+
- pattern: |
|
|
67
|
+
public Bundle call(String $METHOD, String $ARG, Bundle $EXTRAS) {
|
|
68
|
+
...
|
|
69
|
+
}
|
|
70
|
+
metadata:
|
|
71
|
+
cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
|
|
72
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
73
|
+
masvs: "MASVS-PLATFORM-2"
|
|
74
|
+
category: android-ipc
|
|
75
|
+
precision: low
|
|
76
|
+
confidence: low
|
|
77
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
78
|
+
references:
|
|
79
|
+
- https://cwe.mitre.org/data/definitions/927.html
|
|
80
|
+
|
|
81
|
+
- id: zm-android-fileprovider-exported-true
|
|
82
|
+
severity: MEDIUM
|
|
83
|
+
message: |
|
|
84
|
+
Detected FileProvider with android:exported="true" (or no explicit exported declaration).
|
|
85
|
+
An exported FileProvider can serve files to any app on the device, potentially exposing private data.
|
|
86
|
+
Remediation: Set android:exported="false" unless external apps legitimately need file access.
|
|
87
|
+
If exported is required, restrict with android:grantUriPermissions and signature-level permission.
|
|
88
|
+
languages:
|
|
89
|
+
- java
|
|
90
|
+
patterns:
|
|
91
|
+
- pattern-either:
|
|
92
|
+
- pattern: $PROVIDER.setExported(true)
|
|
93
|
+
metadata:
|
|
94
|
+
cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
|
|
95
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
96
|
+
masvs: "MASVS-PLATFORM-2"
|
|
97
|
+
category: android-ipc
|
|
98
|
+
precision: low
|
|
99
|
+
confidence: low
|
|
100
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
101
|
+
references:
|
|
102
|
+
- https://cwe.mitre.org/data/definitions/927.html
|