@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,76 @@
|
|
|
1
|
+
# CWE-939: Deeplink Without Input Validation (Android)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: V3 Audit Engine extension - deeplink injection patterns
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-deeplink-no-validation
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
Detected Intent data retrieved via getIntent().getData() used directly without host/path validation.
|
|
10
|
+
Arbitrary deeplinks can trigger unintended actions, access internal screens, or inject malicious parameters.
|
|
11
|
+
Remediation: Validate the URI scheme, host, and path against a whitelist before processing deeplink data.
|
|
12
|
+
languages:
|
|
13
|
+
- java
|
|
14
|
+
patterns:
|
|
15
|
+
- pattern-either:
|
|
16
|
+
- pattern: $DATA.getQueryParameter($PARAM)
|
|
17
|
+
- pattern: $DATA.getPath()
|
|
18
|
+
- pattern: $URI.getHost()
|
|
19
|
+
metadata:
|
|
20
|
+
cwe: "CWE-939: Improper Authorization in Handler for Custom URL Scheme"
|
|
21
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
22
|
+
masvs: "MASVS-PLATFORM-2"
|
|
23
|
+
category: android-deeplink
|
|
24
|
+
precision: medium
|
|
25
|
+
confidence: medium
|
|
26
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
27
|
+
references:
|
|
28
|
+
- https://cwe.mitre.org/data/definitions/939.html
|
|
29
|
+
- https://developer.android.com/privacy-and-security/risks/deeplinks
|
|
30
|
+
|
|
31
|
+
- id: zm-android-webview-loadurl-from-intent
|
|
32
|
+
severity: HIGH
|
|
33
|
+
message: |
|
|
34
|
+
Detected WebView.loadUrl() receiving a URL derived from Intent data (getIntent().getData() or getStringExtra()).
|
|
35
|
+
Without URL whitelist validation, an attacker can send a malicious deeplink to load a phishing page or
|
|
36
|
+
execute javascript: URLs in the WebView context.
|
|
37
|
+
Remediation: Validate the URL against a strict whitelist of allowed domains and schemes before loading.
|
|
38
|
+
languages:
|
|
39
|
+
- java
|
|
40
|
+
patterns:
|
|
41
|
+
- pattern-either:
|
|
42
|
+
- pattern: $WV.loadUrl(getIntent().getData().toString())
|
|
43
|
+
- pattern: $WV.loadUrl(getIntent().getDataString())
|
|
44
|
+
- pattern: $WV.loadUrl(getIntent().getStringExtra($KEY))
|
|
45
|
+
metadata:
|
|
46
|
+
cwe: "CWE-939: Improper Authorization in Handler for Custom URL Scheme"
|
|
47
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
48
|
+
masvs: "MASVS-PLATFORM-2"
|
|
49
|
+
category: android-deeplink
|
|
50
|
+
precision: high
|
|
51
|
+
confidence: high
|
|
52
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
53
|
+
references:
|
|
54
|
+
- https://cwe.mitre.org/data/definitions/939.html
|
|
55
|
+
|
|
56
|
+
- id: zm-android-intent-data-no-scheme-check
|
|
57
|
+
severity: MEDIUM
|
|
58
|
+
message: |
|
|
59
|
+
Detected Intent.getData() used without scheme validation in an Activity or receiver.
|
|
60
|
+
Any app on the device can send an Intent with arbitrary data to this component.
|
|
61
|
+
Remediation: Add scheme validation (Uri.getScheme()) and verify against allowed schemes before processing.
|
|
62
|
+
languages:
|
|
63
|
+
- java
|
|
64
|
+
patterns:
|
|
65
|
+
- pattern-either:
|
|
66
|
+
- pattern: getIntent().getData()
|
|
67
|
+
metadata:
|
|
68
|
+
cwe: "CWE-939: Improper Authorization in Handler for Custom URL Scheme"
|
|
69
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
70
|
+
masvs: "MASVS-PLATFORM-2"
|
|
71
|
+
category: android-deeplink
|
|
72
|
+
precision: low
|
|
73
|
+
confidence: low
|
|
74
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
75
|
+
references:
|
|
76
|
+
- https://cwe.mitre.org/data/definitions/939.html
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Firebase / Firestore Security Misconfiguration (Android)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: ZhuMa V4.1 Rule Expansion - third-party SDK security
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-firebase-firestore-open-rules
|
|
7
|
+
severity: HIGH
|
|
8
|
+
message: |
|
|
9
|
+
Detected Firebase Firestore or Realtime Database usage without explicit authentication check.
|
|
10
|
+
Firebase databases with default security rules allow unauthenticated read/write access,
|
|
11
|
+
which can lead to mass data exfiltration or data tampering from the client side.
|
|
12
|
+
Remediation: Set Firebase security rules to require authentication. Never use
|
|
13
|
+
allow read, write: if true; in production. Always enforce user-level access controls.
|
|
14
|
+
languages:
|
|
15
|
+
- java
|
|
16
|
+
patterns:
|
|
17
|
+
- pattern-either:
|
|
18
|
+
- pattern: FirebaseFirestore.getInstance()
|
|
19
|
+
- pattern: FirebaseDatabase.getInstance()
|
|
20
|
+
- pattern: $INSTANCE = FirebaseFirestore.getInstance()
|
|
21
|
+
- pattern: $INSTANCE = FirebaseDatabase.getInstance()
|
|
22
|
+
- pattern: com.google.firebase.firestore.FirebaseFirestore.getInstance()
|
|
23
|
+
- pattern: com.google.firebase.database.FirebaseDatabase.getInstance()
|
|
24
|
+
metadata:
|
|
25
|
+
cwe: "CWE-284: Improper Access Control"
|
|
26
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
27
|
+
masvs: "MASVS-AUTH-1"
|
|
28
|
+
category: android-sdk-config
|
|
29
|
+
precision: low
|
|
30
|
+
confidence: low
|
|
31
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
32
|
+
references:
|
|
33
|
+
- https://cwe.mitre.org/data/definitions/284.html
|
|
34
|
+
- https://firebase.google.com/docs/rules/basics
|
|
35
|
+
|
|
36
|
+
- id: zm-android-firebase-realtime-db-write
|
|
37
|
+
severity: MEDIUM
|
|
38
|
+
message: |
|
|
39
|
+
Detected Firebase Realtime Database getReference() with a write path.
|
|
40
|
+
Writing to Firebase Realtime Database from the client without server-side validation
|
|
41
|
+
allows an attacker to inject arbitrary data by modifying the client.
|
|
42
|
+
Remediation: Validate all write operations against Firebase Security Rules
|
|
43
|
+
with server-side validation (Firebase Functions or custom backend).
|
|
44
|
+
languages:
|
|
45
|
+
- java
|
|
46
|
+
patterns:
|
|
47
|
+
- pattern-either:
|
|
48
|
+
- pattern: |
|
|
49
|
+
$DB.getReference("$PATH").setValue($VAL)
|
|
50
|
+
- pattern: |
|
|
51
|
+
$DB.getReference("$PATH").updateChildren($MAP)
|
|
52
|
+
- pattern: |
|
|
53
|
+
$DB.getReference("$PATH").push().setValue($VAL)
|
|
54
|
+
metadata:
|
|
55
|
+
cwe: "CWE-284: Improper Access Control"
|
|
56
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
57
|
+
masvs: "MASVS-AUTH-1"
|
|
58
|
+
category: android-sdk-config
|
|
59
|
+
precision: medium
|
|
60
|
+
confidence: medium
|
|
61
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
62
|
+
references:
|
|
63
|
+
- https://cwe.mitre.org/data/definitions/284.html
|
|
64
|
+
|
|
65
|
+
- id: zm-android-firestore-add-without-auth
|
|
66
|
+
severity: MEDIUM
|
|
67
|
+
message: |
|
|
68
|
+
Detected Firestore add/set/update without visible authentication guard.
|
|
69
|
+
Client-side Firestore writes without Firebase Auth or custom auth can be called
|
|
70
|
+
by an unauthenticated attacker who extracts the Firebase config from the APK.
|
|
71
|
+
Remediation: Ensure Firebase Auth is enforced and all Firestore operations are
|
|
72
|
+
authenticated. Use Firestore Security Rules with request.auth != null.
|
|
73
|
+
languages:
|
|
74
|
+
- java
|
|
75
|
+
patterns:
|
|
76
|
+
- pattern-either:
|
|
77
|
+
- pattern: |
|
|
78
|
+
$DB.collection("$COL").add($DATA)
|
|
79
|
+
- pattern: |
|
|
80
|
+
$DB.collection("$COL").document("$DOC").set($DATA)
|
|
81
|
+
- pattern: |
|
|
82
|
+
$DB.collection("$COL").document("$DOC").update($DATA)
|
|
83
|
+
metadata:
|
|
84
|
+
cwe: "CWE-284: Improper Access Control"
|
|
85
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
86
|
+
masvs: "MASVS-AUTH-1"
|
|
87
|
+
category: android-sdk-config
|
|
88
|
+
precision: low
|
|
89
|
+
confidence: low
|
|
90
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
91
|
+
references:
|
|
92
|
+
- https://cwe.mitre.org/data/definitions/284.html
|
|
93
|
+
|
|
94
|
+
- id: zm-android-firebase-analytics-no-restriction
|
|
95
|
+
severity: INFO
|
|
96
|
+
message: |
|
|
97
|
+
Detected Firebase Analytics initialization. While Analytics is generally safe,
|
|
98
|
+
ensure that PII (personally identifiable information) is not sent as event parameters
|
|
99
|
+
or user properties per Google's policy restrictions.
|
|
100
|
+
Remediation: Review Firebase Analytics event params for PII. Use setUserProperty()
|
|
101
|
+
only with non-PII values. Avoid logging emails, phone numbers, or full names.
|
|
102
|
+
languages:
|
|
103
|
+
- java
|
|
104
|
+
patterns:
|
|
105
|
+
- pattern-either:
|
|
106
|
+
- pattern: FirebaseAnalytics.getInstance($CTX)
|
|
107
|
+
- pattern: com.google.firebase.analytics.FirebaseAnalytics.getInstance($CTX)
|
|
108
|
+
metadata:
|
|
109
|
+
cwe: "CWE-359: Exposure of Private Personal Information to an Unauthorized Actor"
|
|
110
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
111
|
+
masvs: "MASVS-STORAGE-4"
|
|
112
|
+
category: android-sdk-config
|
|
113
|
+
precision: low
|
|
114
|
+
confidence: low
|
|
115
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
116
|
+
references:
|
|
117
|
+
- https://cwe.mitre.org/data/definitions/359.html
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Push Notification SDK Credential Exposure (Tencent TPNS, Huawei Push, Xiaomi Push)
|
|
2
|
+
# ZhuMa V4.0 - Android Rule Library
|
|
3
|
+
# Source: ZhuMa V4.1 Rule Expansion - third-party SDK credential management
|
|
4
|
+
|
|
5
|
+
rules:
|
|
6
|
+
- id: zm-android-tpns-xg-push-credentials
|
|
7
|
+
severity: MEDIUM
|
|
8
|
+
message: |
|
|
9
|
+
Detected Tencent TPNS (Xinge Push) SDK initialization with hardcoded Access ID and Access Key.
|
|
10
|
+
These credentials grant push message sending capability. If extracted from the APK,
|
|
11
|
+
an attacker can send arbitrary push notifications to all app users.
|
|
12
|
+
Remediation: Store TPNS credentials on the server side and use server-side push APIs.
|
|
13
|
+
Never embed push service credentials in the client APK.
|
|
14
|
+
languages:
|
|
15
|
+
- java
|
|
16
|
+
patterns:
|
|
17
|
+
- pattern-either:
|
|
18
|
+
- pattern: XGPushConfig.setAccessId($CTX, $ID)
|
|
19
|
+
- pattern: XGPushConfig.setAccessKey($CTX, "$KEY")
|
|
20
|
+
- pattern: com.tencent.android.tpush.XGPushConfig.setAccessId($CTX, $ID)
|
|
21
|
+
- pattern: com.tencent.android.tpush.XGPushConfig.setAccessKey($CTX, "$KEY")
|
|
22
|
+
metadata:
|
|
23
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
24
|
+
owasp-mobile: "M8: Code Tampering"
|
|
25
|
+
masvs: "MASVS-AUTH-1"
|
|
26
|
+
category: android-sdk-config
|
|
27
|
+
precision: very-high
|
|
28
|
+
confidence: very-high
|
|
29
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
30
|
+
references:
|
|
31
|
+
- https://cwe.mitre.org/data/definitions/798.html
|
|
32
|
+
- https://cloud.tencent.com/document/product/548
|
|
33
|
+
|
|
34
|
+
- id: zm-android-huawei-push-credentials
|
|
35
|
+
severity: MEDIUM
|
|
36
|
+
message: |
|
|
37
|
+
Detected Huawei Push SDK initialization with hardcoded App ID / App Secret.
|
|
38
|
+
Huawei Push credentials allow sending push messages to all devices with the app installed.
|
|
39
|
+
Extracting these from the APK enables mass phishing push notifications.
|
|
40
|
+
Remediation: Store Huawei Push App Secret on the server. Only embed the App ID client-side.
|
|
41
|
+
Use server-side token generation for push message sending.
|
|
42
|
+
languages:
|
|
43
|
+
- java
|
|
44
|
+
patterns:
|
|
45
|
+
- pattern-either:
|
|
46
|
+
- pattern: HmsMessageService.$METHOD("$APP_ID", "$SECRET")
|
|
47
|
+
- pattern: com.huawei.hms.push.$METHOD("$APP_ID")
|
|
48
|
+
metadata:
|
|
49
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
50
|
+
owasp-mobile: "M8: Code Tampering"
|
|
51
|
+
masvs: "MASVS-AUTH-1"
|
|
52
|
+
category: android-sdk-config
|
|
53
|
+
precision: low
|
|
54
|
+
confidence: low
|
|
55
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
56
|
+
references:
|
|
57
|
+
- https://cwe.mitre.org/data/definitions/798.html
|
|
58
|
+
|
|
59
|
+
- id: zm-android-xiaomi-mipush-regid
|
|
60
|
+
severity: LOW
|
|
61
|
+
message: |
|
|
62
|
+
Detected Xiaomi MiPush SDK registration pattern. MiPush App Secret should not be embedded
|
|
63
|
+
in the client APK but managed server-side. Client should only use App ID for registration.
|
|
64
|
+
Remediation: Verify the MiPush App Secret is not hardcoded in the APK.
|
|
65
|
+
Use server-side push delivery to avoid client credential exposure.
|
|
66
|
+
languages:
|
|
67
|
+
- java
|
|
68
|
+
patterns:
|
|
69
|
+
- pattern-either:
|
|
70
|
+
- pattern: MiPushClient.registerPush($CTX, "$APP_ID", "$APP_KEY")
|
|
71
|
+
- pattern: com.xiaomi.mipush.sdk.MiPushClient.registerPush($CTX, "$APP_ID", "$APP_KEY")
|
|
72
|
+
metadata:
|
|
73
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
74
|
+
owasp-mobile: "M8: Code Tampering"
|
|
75
|
+
masvs: "MASVS-AUTH-1"
|
|
76
|
+
category: android-sdk-config
|
|
77
|
+
precision: high
|
|
78
|
+
confidence: high
|
|
79
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
80
|
+
references:
|
|
81
|
+
- https://cwe.mitre.org/data/definitions/798.html
|
|
82
|
+
|
|
83
|
+
- id: zm-android-jpush-credentials
|
|
84
|
+
severity: MEDIUM
|
|
85
|
+
message: |
|
|
86
|
+
Detected JPush (Aurora Push) SDK initialization. JPush AppKey is included in the client
|
|
87
|
+
and can be extracted. Combined with Master Secret (which should never be client-side),
|
|
88
|
+
attackers can send arbitrary push messages.
|
|
89
|
+
Remediation: Ensure JPush Master Secret is stored only on the server side.
|
|
90
|
+
Verify push message delivery is authenticated server-to-server, not client-triggered.
|
|
91
|
+
languages:
|
|
92
|
+
- java
|
|
93
|
+
patterns:
|
|
94
|
+
- pattern-either:
|
|
95
|
+
- pattern: JPushInterface.setDebugMode(true)
|
|
96
|
+
- pattern: JPushInterface.init($CTX)
|
|
97
|
+
- pattern: cn.jpush.android.api.JPushInterface.init($CTX)
|
|
98
|
+
metadata:
|
|
99
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
100
|
+
owasp-mobile: "M8: Code Tampering"
|
|
101
|
+
masvs: "MASVS-AUTH-1"
|
|
102
|
+
category: android-sdk-config
|
|
103
|
+
precision: low
|
|
104
|
+
confidence: low
|
|
105
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
106
|
+
references:
|
|
107
|
+
- https://cwe.mitre.org/data/definitions/798.html
|
|
108
|
+
|
|
109
|
+
- id: zm-android-umeng-push-credentials
|
|
110
|
+
severity: LOW
|
|
111
|
+
message: |
|
|
112
|
+
Detected Umeng Push SDK initialization. The Umeng AppKey and Message Secret should be
|
|
113
|
+
carefully managed. If Umeng Message Secret is embedded client-side, it allows
|
|
114
|
+
unauthorized push message sending via the Umeng API.
|
|
115
|
+
Remediation: Verify Umeng push message sending is authorized server-side only.
|
|
116
|
+
languages:
|
|
117
|
+
- java
|
|
118
|
+
patterns:
|
|
119
|
+
- pattern-either:
|
|
120
|
+
- pattern: PushAgent.getInstance($CTX).register($PUSH_HANDLER)
|
|
121
|
+
- pattern: com.umeng.message.PushAgent.getInstance($CTX).register($PUSH_HANDLER)
|
|
122
|
+
metadata:
|
|
123
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
124
|
+
owasp-mobile: "M8: Code Tampering"
|
|
125
|
+
masvs: "MASVS-AUTH-1"
|
|
126
|
+
category: android-sdk-config
|
|
127
|
+
precision: low
|
|
128
|
+
confidence: low
|
|
129
|
+
source: "ZhuMa V4.1 Rule Expansion"
|
|
130
|
+
references:
|
|
131
|
+
- https://cwe.mitre.org/data/definitions/798.html
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
rules:
|
|
2
|
+
- id: zm-android-hardcoded-apikey
|
|
3
|
+
severity: CRITICAL
|
|
4
|
+
message: Hardcoded API key or token. API keys embedded in source code are exposed to anyone who can decompile the APK (jadx/apktool make this trivial). Place all secrets in a server-side proxy or use Android Keystore.
|
|
5
|
+
metadata:
|
|
6
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
7
|
+
owasp-mobile: "M8: Security Misconfiguration"
|
|
8
|
+
category: android-secrets
|
|
9
|
+
precision: medium
|
|
10
|
+
languages: [java]
|
|
11
|
+
patterns:
|
|
12
|
+
- pattern-either:
|
|
13
|
+
- pattern: |
|
|
14
|
+
$TYPE $VAR = "$SECRET";
|
|
15
|
+
...
|
|
16
|
+
- pattern: |
|
|
17
|
+
public static final String $KEY = "$VALUE";
|
|
18
|
+
- metavariable-regex:
|
|
19
|
+
metavariable: $VALUE
|
|
20
|
+
regex: '^(AKID|AKIA|LTAI|sk-[a-zA-Z0-9]{20,}|AIzaSy|ya29\.[a-zA-Z0-9_-]{50,}|pk\.[a-zA-Z0-9]{30,}|sk\.[a-zA-Z0-9]{30,}|ghp_[a-zA-Z0-9]{36}|gho_[a-zA-Z0-9]{36}|xox[bprs]-[a-zA-Z0-9-]{10,}|[a-zA-Z0-9+/]{40,})'
|
|
21
|
+
paths:
|
|
22
|
+
include:
|
|
23
|
+
- "*.java"
|
|
24
|
+
|
|
25
|
+
- id: zm-android-hardcoded-secret-keyword
|
|
26
|
+
severity: WARNING
|
|
27
|
+
message: Variable name suggests a secret is hardcoded. Keywords like 'password', 'secret', 'api_key', 'token' in string literals indicate credentials that should be in Android Keystore or server-side.
|
|
28
|
+
metadata:
|
|
29
|
+
cwe: "CWE-798: Use of Hard-coded Credentials"
|
|
30
|
+
owasp-mobile: "M8: Security Misconfiguration"
|
|
31
|
+
category: android-secrets
|
|
32
|
+
precision: low
|
|
33
|
+
languages: [java]
|
|
34
|
+
patterns:
|
|
35
|
+
- pattern-either:
|
|
36
|
+
- pattern: |
|
|
37
|
+
private static final String $PASS = "$VALUE";
|
|
38
|
+
- pattern: |
|
|
39
|
+
public static final String $PASS = "$VALUE";
|
|
40
|
+
- pattern: |
|
|
41
|
+
static final String $PASS = "$VALUE";
|
|
42
|
+
- metavariable-regex:
|
|
43
|
+
metavariable: $PASS
|
|
44
|
+
regex: '(?i)(password|passwd|secret|api_key|api_secret|apikey|app_secret|token|auth_key|access_key|private_key)'
|
|
45
|
+
|
|
46
|
+
- id: zm-android-insecure-shared-prefs
|
|
47
|
+
severity: HIGH
|
|
48
|
+
message: SharedPreferences with MODE_WORLD_READABLE or MODE_WORLD_WRITEABLE. On API 17+ these are deprecated, but if used on older APIs or via reflection, they make stored data accessible to any app on the device.
|
|
49
|
+
metadata:
|
|
50
|
+
cwe: "CWE-276: Incorrect Default Permissions"
|
|
51
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
52
|
+
masvs: "MASVS-STORAGE-1"
|
|
53
|
+
category: android-storage
|
|
54
|
+
precision: high
|
|
55
|
+
confidence: high
|
|
56
|
+
languages: [java]
|
|
57
|
+
patterns:
|
|
58
|
+
- pattern-either:
|
|
59
|
+
- pattern: $CTX.getSharedPreferences($NAME, Context.MODE_WORLD_READABLE)
|
|
60
|
+
- pattern: $CTX.getSharedPreferences($NAME, Context.MODE_WORLD_WRITEABLE)
|
|
61
|
+
- pattern: $CTX.getSharedPreferences($NAME, 1)
|
|
62
|
+
- pattern: $CTX.getSharedPreferences($NAME, 2)
|
|
63
|
+
|
|
64
|
+
- id: zm-android-insecure-file-permission
|
|
65
|
+
severity: HIGH
|
|
66
|
+
message: Files created with world-readable/writable permissions. Sensitive data written to globally accessible files can be read or modified by any app.
|
|
67
|
+
metadata:
|
|
68
|
+
cwe: "CWE-276: Incorrect Default Permissions"
|
|
69
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
70
|
+
category: android-storage
|
|
71
|
+
precision: high
|
|
72
|
+
confidence: high
|
|
73
|
+
languages: [java]
|
|
74
|
+
patterns:
|
|
75
|
+
- pattern-either:
|
|
76
|
+
- pattern: openFileOutput($NAME, Context.MODE_WORLD_READABLE)
|
|
77
|
+
- pattern: openFileOutput($NAME, Context.MODE_WORLD_WRITEABLE)
|
|
78
|
+
- pattern: openFileOutput($NAME, 1)
|
|
79
|
+
- pattern: openFileOutput($NAME, 2)
|
|
80
|
+
|
|
81
|
+
- id: zm-android-external-storage-sensitive
|
|
82
|
+
severity: MEDIUM
|
|
83
|
+
message: Sensitive data written to external storage. Files on external storage (/sdcard, getExternalFilesDir) are readable by any app with READ_EXTERNAL_STORAGE permission and physically accessible via USB.
|
|
84
|
+
metadata:
|
|
85
|
+
cwe: "CWE-200: Exposure of Sensitive Information"
|
|
86
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
87
|
+
masvs: "MASVS-STORAGE-1"
|
|
88
|
+
category: android-storage
|
|
89
|
+
precision: low
|
|
90
|
+
languages: [java]
|
|
91
|
+
patterns:
|
|
92
|
+
- pattern-either:
|
|
93
|
+
- pattern: Environment.getExternalStorageDirectory()
|
|
94
|
+
- pattern: $CTX.getExternalFilesDir($TYPE)
|
|
95
|
+
|
|
96
|
+
- id: zm-android-sqlite-raw-injection
|
|
97
|
+
severity: CRITICAL
|
|
98
|
+
message: Raw SQL query with string concatenation. Unsanitized user input in rawQuery or execSQL enables SQL injection, allowing attackers to read/write any row in the local SQLite database.
|
|
99
|
+
metadata:
|
|
100
|
+
cwe: "CWE-89: SQL Injection"
|
|
101
|
+
owasp-mobile: "M7: Client Code Quality"
|
|
102
|
+
category: android-data
|
|
103
|
+
precision: medium
|
|
104
|
+
confidence: medium
|
|
105
|
+
languages: [java]
|
|
106
|
+
patterns:
|
|
107
|
+
- pattern-either:
|
|
108
|
+
- pattern: $DB.rawQuery("..." + $INPUT, ...)
|
|
109
|
+
- pattern: $DB.rawQuery($QUERY + $INPUT, ...)
|
|
110
|
+
- pattern: $DB.execSQL("..." + $INPUT)
|
|
111
|
+
- pattern: $DB.execSQL($QUERY + $INPUT)
|
|
112
|
+
|
|
113
|
+
- id: zm-android-log-sensitive
|
|
114
|
+
severity: MEDIUM
|
|
115
|
+
message: Sensitive data logged to Logcat. On Android, any app with READ_LOGS permission can read Logcat output. Use a logging library with automatic release-build stripping instead.
|
|
116
|
+
metadata:
|
|
117
|
+
cwe: "CWE-532: Insertion of Sensitive Information into Log File"
|
|
118
|
+
owasp-mobile: "M2: Insecure Data Storage"
|
|
119
|
+
masvs: "MASVS-STORAGE-3"
|
|
120
|
+
category: android-data
|
|
121
|
+
precision: low
|
|
122
|
+
languages: [java]
|
|
123
|
+
patterns:
|
|
124
|
+
- pattern-either:
|
|
125
|
+
- pattern: |
|
|
126
|
+
Log.d($TAG, $MSG + $VAR)
|
|
127
|
+
- pattern: |
|
|
128
|
+
Log.e($TAG, $MSG + $VAR)
|
|
129
|
+
- pattern: |
|
|
130
|
+
Log.i($TAG, $MSG + $VAR)
|
|
131
|
+
- pattern: |
|
|
132
|
+
Log.v($TAG, $MSG + $VAR)
|
|
133
|
+
- pattern: |
|
|
134
|
+
Log.w($TAG, $MSG + $VAR)
|
|
135
|
+
- pattern: |
|
|
136
|
+
android.util.Log.d($TAG, $MSG + $VAR)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
rules:
|
|
2
|
+
- id: zm-android-webview-js-enabled
|
|
3
|
+
severity: WARNING
|
|
4
|
+
message: WebView JavaScript enabled without protection. Enabling JavaScript without disabling file access and implementing SSL error handling exposes the app to XSS, token theft, and MitM attacks.
|
|
5
|
+
metadata:
|
|
6
|
+
cwe: "CWE-749: Exposed Dangerous Method or Function"
|
|
7
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
8
|
+
masvs: "MASVS-PLATFORM-2"
|
|
9
|
+
category: android-webview
|
|
10
|
+
precision: medium
|
|
11
|
+
confidence: medium
|
|
12
|
+
likelihood: high
|
|
13
|
+
impact: high
|
|
14
|
+
languages: [java]
|
|
15
|
+
patterns:
|
|
16
|
+
- pattern-either:
|
|
17
|
+
- pattern: $WV.getSettings().setJavaScriptEnabled(true)
|
|
18
|
+
- pattern: $WV.getSettings().setJavaScriptEnabled($X)
|
|
19
|
+
- pattern-not-inside: |
|
|
20
|
+
...
|
|
21
|
+
$WV.getSettings().setAllowFileAccess(false);
|
|
22
|
+
...
|
|
23
|
+
$WV.getSettings().setJavaScriptEnabled(...);
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
- id: zm-android-webview-file-access
|
|
27
|
+
severity: WARNING
|
|
28
|
+
message: WebView file access enabled. Combined with JavaScript, this allows an attacker to read local files via file:// URLs.
|
|
29
|
+
metadata:
|
|
30
|
+
cwe: "CWE-200: Exposure of Sensitive Information"
|
|
31
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
32
|
+
category: android-webview
|
|
33
|
+
precision: low
|
|
34
|
+
languages: [java]
|
|
35
|
+
pattern: $WV.getSettings().setAllowFileAccess(true)
|
|
36
|
+
|
|
37
|
+
- id: zm-android-webview-ssl-bypass
|
|
38
|
+
severity: CRITICAL
|
|
39
|
+
message: WebView SSL error handler accepts all certificates. This silently enables man-in-the-middle attacks on all HTTPS traffic loaded in this WebView.
|
|
40
|
+
metadata:
|
|
41
|
+
cwe: "CWE-295: Improper Certificate Validation"
|
|
42
|
+
owasp-mobile: "M3: Insecure Communication"
|
|
43
|
+
masvs: "MASVS-NETWORK-1"
|
|
44
|
+
category: android-webview
|
|
45
|
+
precision: high
|
|
46
|
+
confidence: high
|
|
47
|
+
languages: [java]
|
|
48
|
+
patterns:
|
|
49
|
+
- pattern-either:
|
|
50
|
+
- pattern: |
|
|
51
|
+
new WebViewClient() {
|
|
52
|
+
...
|
|
53
|
+
public void onReceivedSslError(WebView $W, SslErrorHandler $H, SslError $E) {
|
|
54
|
+
$H.proceed();
|
|
55
|
+
}
|
|
56
|
+
...
|
|
57
|
+
}
|
|
58
|
+
- pattern: |
|
|
59
|
+
$WV.setWebViewClient(new WebViewClient() {
|
|
60
|
+
...
|
|
61
|
+
public void onReceivedSslError(..., SslErrorHandler $H, ...) {
|
|
62
|
+
$H.proceed();
|
|
63
|
+
}
|
|
64
|
+
...
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
- id: zm-android-webview-allow-content-access
|
|
68
|
+
severity: HIGH
|
|
69
|
+
message: WebView content URL access enabled. Allows the WebView to access content:// URIs from other apps, enabling cross-app data leakage.
|
|
70
|
+
metadata:
|
|
71
|
+
cwe: "CWE-200: Exposure of Sensitive Information"
|
|
72
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
73
|
+
category: android-webview
|
|
74
|
+
precision: medium
|
|
75
|
+
languages: [java]
|
|
76
|
+
pattern: $WV.getSettings().setAllowContentAccess(true)
|
|
77
|
+
|
|
78
|
+
- id: zm-android-webview-allow-universal-access-from-file
|
|
79
|
+
severity: CRITICAL
|
|
80
|
+
message: Universal access from file URLs enabled. Allows JavaScript loaded from file:// URLs to access any origin via XMLHttpRequest, bypassing all same-origin protections.
|
|
81
|
+
metadata:
|
|
82
|
+
cwe: "CWE-200: Exposure of Sensitive Information"
|
|
83
|
+
owasp-mobile: "M1: Improper Platform Usage"
|
|
84
|
+
category: android-webview
|
|
85
|
+
precision: high
|
|
86
|
+
confidence: high
|
|
87
|
+
languages: [java]
|
|
88
|
+
pattern: $WV.getSettings().setAllowUniversalAccessFromFileURLs(true)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# CWE-200: 敏感数据暴露检测规则
|
|
2
|
+
# 逐码 ZhuMa V4.0 Alpha — 通用规则库
|
|
3
|
+
|
|
4
|
+
rules:
|
|
5
|
+
|
|
6
|
+
# ZM-JAVA-SDE-001: 日志输出密码/Token 变量
|
|
7
|
+
- id: zm-java-sde-001
|
|
8
|
+
severity: HIGH
|
|
9
|
+
message: |
|
|
10
|
+
检测到日志中可能输出敏感变量 (password / token / secret / apiKey)。
|
|
11
|
+
敏感数据不应出现在日志中,可能导致信息泄露。
|
|
12
|
+
应在日志中脱敏或移除敏感字段。
|
|
13
|
+
languages:
|
|
14
|
+
- java
|
|
15
|
+
pattern-either:
|
|
16
|
+
- pattern: |
|
|
17
|
+
$LOGGER.info($PWD);
|
|
18
|
+
- pattern: |
|
|
19
|
+
$LOGGER.debug($PWD);
|
|
20
|
+
- pattern: |
|
|
21
|
+
$LOGGER.error($PWD);
|
|
22
|
+
- pattern: |
|
|
23
|
+
$LOGGER.warn($PWD);
|
|
24
|
+
- pattern: |
|
|
25
|
+
System.out.println($PWD);
|
|
26
|
+
metadata:
|
|
27
|
+
cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
|
|
28
|
+
owasp: "A04:2021 - Insecure Design"
|
|
29
|
+
precision: very-low
|
|
30
|
+
|
|
31
|
+
# ZM-JAVA-SDE-002: toString 暴露敏感字段
|
|
32
|
+
- id: zm-java-sde-002
|
|
33
|
+
severity: MEDIUM
|
|
34
|
+
message: |
|
|
35
|
+
toString() 方法中包含 password/token 等敏感字段输出。
|
|
36
|
+
应在 toString 中排除或脱敏敏感字段。
|
|
37
|
+
languages:
|
|
38
|
+
- java
|
|
39
|
+
pattern-either:
|
|
40
|
+
- pattern: |
|
|
41
|
+
return "..." + $PWD + "...";
|
|
42
|
+
metadata:
|
|
43
|
+
cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
|
|
44
|
+
owasp: "A04:2021 - Insecure Design"
|
|
45
|
+
precision: very-low
|
|
46
|
+
|
|
47
|
+
# ZM-JAVA-SDE-003: printStackTrace 泄漏堆栈
|
|
48
|
+
- id: zm-java-sde-003
|
|
49
|
+
severity: LOW
|
|
50
|
+
message: |
|
|
51
|
+
检测到异常堆栈直接输出到标准输出/错误流。
|
|
52
|
+
生产环境应将异常记录到日志框架,避免向用户暴露内部实现细节。
|
|
53
|
+
languages:
|
|
54
|
+
- java
|
|
55
|
+
pattern-either:
|
|
56
|
+
- pattern: |
|
|
57
|
+
$E.printStackTrace();
|
|
58
|
+
metadata:
|
|
59
|
+
cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
|
|
60
|
+
owasp: "A04:2021 - Insecure Design"
|
|
61
|
+
precision: very-high
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# CWE-22: 路径遍历检测规则
|
|
2
|
+
# 逐码 ZhuMa V4.0 Alpha — 通用规则库
|
|
3
|
+
|
|
4
|
+
rules:
|
|
5
|
+
|
|
6
|
+
# ZM-JAVA-PT-001: File 构造含用户输入 + 无 validateFilename
|
|
7
|
+
- id: zm-java-pt-001
|
|
8
|
+
severity: HIGH
|
|
9
|
+
message: |
|
|
10
|
+
检测到使用用户输入构造文件路径,但未校验路径 (未调用 getCanonicalPath 或 contains("..") 检查)。
|
|
11
|
+
攻击者可注入 ../ 进行路径遍历访问任意文件。
|
|
12
|
+
应使用 Path.normalize() + 检查路径前缀是否在允许目录内。
|
|
13
|
+
languages:
|
|
14
|
+
- java
|
|
15
|
+
pattern-either:
|
|
16
|
+
- pattern: |
|
|
17
|
+
new FileInputStream($BASE + $PARAM);
|
|
18
|
+
- pattern: |
|
|
19
|
+
new FileReader($BASE + $PARAM);
|
|
20
|
+
- pattern: |
|
|
21
|
+
new File($BASE + $PARAM);
|
|
22
|
+
- pattern: |
|
|
23
|
+
Files.readAllBytes(Paths.get($BASE + $PARAM));
|
|
24
|
+
- pattern: |
|
|
25
|
+
Files.newInputStream(Paths.get($BASE + $PARAM));
|
|
26
|
+
metadata:
|
|
27
|
+
cwe: "CWE-22: Path Traversal"
|
|
28
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
29
|
+
precision: medium
|
|
30
|
+
|
|
31
|
+
# ZM-JAVA-PT-002: 直接使用用户输入作为文件路径
|
|
32
|
+
- id: zm-java-pt-002
|
|
33
|
+
severity: MEDIUM
|
|
34
|
+
message: |
|
|
35
|
+
直接使用用户输入作为文件路径参数,存在路径遍历风险。
|
|
36
|
+
应对输入进行白名单校验或规范化路径后验证前缀。
|
|
37
|
+
languages:
|
|
38
|
+
- java
|
|
39
|
+
pattern-either:
|
|
40
|
+
- pattern: |
|
|
41
|
+
new FileInputStream($REQ.getParameter(...));
|
|
42
|
+
- pattern: |
|
|
43
|
+
new FileReader($REQ.getParameter(...));
|
|
44
|
+
metadata:
|
|
45
|
+
cwe: "CWE-22: Path Traversal"
|
|
46
|
+
owasp: "A01:2021 - Broken Access Control"
|
|
47
|
+
precision: high
|