@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.
Files changed (288) hide show
  1. package/README.md +42 -0
  2. package/dist/commands/config.d.ts +3 -0
  3. package/dist/commands/config.d.ts.map +1 -0
  4. package/dist/commands/config.js +18 -0
  5. package/dist/commands/config.js.map +1 -0
  6. package/dist/commands/init.d.ts +3 -0
  7. package/dist/commands/init.d.ts.map +1 -0
  8. package/dist/commands/init.js +11 -0
  9. package/dist/commands/init.js.map +1 -0
  10. package/dist/commands/scan.d.ts +3 -0
  11. package/dist/commands/scan.d.ts.map +1 -0
  12. package/dist/commands/scan.js +96 -0
  13. package/dist/commands/scan.js.map +1 -0
  14. package/dist/commands/scan_appid.d.ts +20 -0
  15. package/dist/commands/scan_appid.d.ts.map +1 -0
  16. package/dist/commands/scan_appid.js +301 -0
  17. package/dist/commands/scan_appid.js.map +1 -0
  18. package/dist/commands/scan_manifest.d.ts +13 -0
  19. package/dist/commands/scan_manifest.d.ts.map +1 -0
  20. package/dist/commands/scan_manifest.js +103 -0
  21. package/dist/commands/scan_manifest.js.map +1 -0
  22. package/dist/engine/api-submit.d.ts +16 -0
  23. package/dist/engine/api-submit.d.ts.map +1 -0
  24. package/dist/engine/api-submit.js +66 -0
  25. package/dist/engine/api-submit.js.map +1 -0
  26. package/dist/engine/batch_scan.d.ts +36 -0
  27. package/dist/engine/batch_scan.d.ts.map +1 -0
  28. package/dist/engine/batch_scan.js +192 -0
  29. package/dist/engine/batch_scan.js.map +1 -0
  30. package/dist/engine/config.d.ts +12 -0
  31. package/dist/engine/config.d.ts.map +1 -0
  32. package/dist/engine/config.js +27 -0
  33. package/dist/engine/config.js.map +1 -0
  34. package/dist/engine/errors.d.ts +36 -0
  35. package/dist/engine/errors.d.ts.map +1 -0
  36. package/dist/engine/errors.js +99 -0
  37. package/dist/engine/errors.js.map +1 -0
  38. package/dist/engine/filter.d.ts +13 -0
  39. package/dist/engine/filter.d.ts.map +1 -0
  40. package/dist/engine/filter.js +64 -0
  41. package/dist/engine/filter.js.map +1 -0
  42. package/dist/engine/finding_classifier.d.ts +108 -0
  43. package/dist/engine/finding_classifier.d.ts.map +1 -0
  44. package/dist/engine/finding_classifier.js +440 -0
  45. package/dist/engine/finding_classifier.js.map +1 -0
  46. package/dist/engine/incremental/engine.d.ts +25 -0
  47. package/dist/engine/incremental/engine.d.ts.map +1 -0
  48. package/dist/engine/incremental/engine.js +337 -0
  49. package/dist/engine/incremental/engine.js.map +1 -0
  50. package/dist/engine/incremental/git-diff.d.ts +19 -0
  51. package/dist/engine/incremental/git-diff.d.ts.map +1 -0
  52. package/dist/engine/incremental/git-diff.js +175 -0
  53. package/dist/engine/incremental/git-diff.js.map +1 -0
  54. package/dist/engine/incremental/types.d.ts +33 -0
  55. package/dist/engine/incremental/types.d.ts.map +1 -0
  56. package/dist/engine/incremental/types.js +11 -0
  57. package/dist/engine/incremental/types.js.map +1 -0
  58. package/dist/engine/manifest_scanner.d.ts +48 -0
  59. package/dist/engine/manifest_scanner.d.ts.map +1 -0
  60. package/dist/engine/manifest_scanner.js +599 -0
  61. package/dist/engine/manifest_scanner.js.map +1 -0
  62. package/dist/engine/project.d.ts +22 -0
  63. package/dist/engine/project.d.ts.map +1 -0
  64. package/dist/engine/project.js +279 -0
  65. package/dist/engine/project.js.map +1 -0
  66. package/dist/engine/sarif.d.ts +13 -0
  67. package/dist/engine/sarif.d.ts.map +1 -0
  68. package/dist/engine/sarif.js +44 -0
  69. package/dist/engine/sarif.js.map +1 -0
  70. package/dist/engine/sca-integration.d.ts +36 -0
  71. package/dist/engine/sca-integration.d.ts.map +1 -0
  72. package/dist/engine/sca-integration.js +91 -0
  73. package/dist/engine/sca-integration.js.map +1 -0
  74. package/dist/engine/scanner.d.ts +18 -0
  75. package/dist/engine/scanner.d.ts.map +1 -0
  76. package/dist/engine/scanner.js +138 -0
  77. package/dist/engine/scanner.js.map +1 -0
  78. package/dist/index.d.ts +13 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +41 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/report/render.d.ts +23 -0
  83. package/dist/report/render.d.ts.map +1 -0
  84. package/dist/report/render.js +335 -0
  85. package/dist/report/render.js.map +1 -0
  86. package/package.json +41 -0
  87. package/rules/android/mobile-cleartext-traffic.yaml +46 -0
  88. package/rules/android/mobile-component-security.yaml +107 -0
  89. package/rules/android/mobile-crypto-weakness.yaml +139 -0
  90. package/rules/android/mobile-cwe-1021-tapjacking.yaml +81 -0
  91. package/rules/android/mobile-cwe-114-dynamic-dex-loading.yaml +41 -0
  92. package/rules/android/mobile-cwe-200-clipboard-data-leak.yaml +66 -0
  93. package/rules/android/mobile-cwe-200-debug-builds.yaml +111 -0
  94. package/rules/android/mobile-cwe-200-log-sensitive-data.yaml +61 -0
  95. package/rules/android/mobile-cwe-200-webview-debugging.yaml +56 -0
  96. package/rules/android/mobile-cwe-200-webview-universal-access.yaml +30 -0
  97. package/rules/android/mobile-cwe-200-window-flags.yaml +96 -0
  98. package/rules/android/mobile-cwe-22-content-provider-openfile.yaml +73 -0
  99. package/rules/android/mobile-cwe-22-path-traversal.yaml +86 -0
  100. package/rules/android/mobile-cwe-287-biometric-weakness.yaml +102 -0
  101. package/rules/android/mobile-cwe-295-cert-pinning-missing.yaml +78 -0
  102. package/rules/android/mobile-cwe-295-webview-ssl-bypass.yaml +104 -0
  103. package/rules/android/mobile-cwe-312-cleartext-storage.yaml +109 -0
  104. package/rules/android/mobile-cwe-319-cleartext-communication.yaml +84 -0
  105. package/rules/android/mobile-cwe-321-hardcoded-crypto-keys.yaml +132 -0
  106. package/rules/android/mobile-cwe-326-short-rsa.yaml +108 -0
  107. package/rules/android/mobile-cwe-327-rc4-3des.yaml +107 -0
  108. package/rules/android/mobile-cwe-329-cbc-padding-oracle.yaml +76 -0
  109. package/rules/android/mobile-cwe-470-reflection-injection.yaml +39 -0
  110. package/rules/android/mobile-cwe-489-root-detection-weak.yaml +125 -0
  111. package/rules/android/mobile-cwe-489-stetho-debug.yaml +107 -0
  112. package/rules/android/mobile-cwe-502-insecure-deserialization.yaml +76 -0
  113. package/rules/android/mobile-cwe-552-world-readable-files.yaml +63 -0
  114. package/rules/android/mobile-cwe-749-webview-java-objects.yaml +78 -0
  115. package/rules/android/mobile-cwe-749-webview-jsbridge.yaml +57 -0
  116. package/rules/android/mobile-cwe-749-webview-loadurl-injection.yaml +80 -0
  117. package/rules/android/mobile-cwe-78-command-injection.yaml +77 -0
  118. package/rules/android/mobile-cwe-780-rsa-no-oaep.yaml +80 -0
  119. package/rules/android/mobile-cwe-79-webview-setdata.yaml +78 -0
  120. package/rules/android/mobile-cwe-79-webview-xss.yaml +65 -0
  121. package/rules/android/mobile-cwe-798-hardcoded-credentials.yaml +108 -0
  122. package/rules/android/mobile-cwe-89-sql-injection.yaml +100 -0
  123. package/rules/android/mobile-cwe-927-implicit-intent.yaml +121 -0
  124. package/rules/android/mobile-cwe-927-ipc-file-provider.yaml +102 -0
  125. package/rules/android/mobile-cwe-939-deeplink-validation.yaml +76 -0
  126. package/rules/android/mobile-sdk-google-firebase-open.yaml +117 -0
  127. package/rules/android/mobile-sdk-tencent-tpns-config-leak.yaml +131 -0
  128. package/rules/android/mobile-secrets-storage.yaml +136 -0
  129. package/rules/android/mobile-webview-security.yaml +88 -0
  130. package/rules/common/cwe-200-sensitive-data-exposure.yaml +61 -0
  131. package/rules/common/cwe-22-path-traversal.yaml +47 -0
  132. package/rules/common/cwe-295-ssl-bypass.yaml +217 -0
  133. package/rules/common/cwe-295-ssl-verification-disabled.yaml +64 -0
  134. package/rules/common/cwe-306-missing-authentication.yaml +44 -0
  135. package/rules/common/cwe-326-weak-key-size.yaml +107 -0
  136. package/rules/common/cwe-327-weak-crypto.yaml +177 -0
  137. package/rules/common/cwe-328-weak-hash.yaml +96 -0
  138. package/rules/common/cwe-329-cbc-mode.yaml +26 -0
  139. package/rules/common/cwe-352-csrf.yaml +23 -0
  140. package/rules/common/cwe-434-unrestricted-file-upload.yaml +41 -0
  141. package/rules/common/cwe-502-insecure-deserialization.yaml +44 -0
  142. package/rules/common/cwe-601-url-redirect.yaml +110 -0
  143. package/rules/common/cwe-611-xxe.yaml +70 -0
  144. package/rules/common/cwe-732-incorrect-permission.yaml +49 -0
  145. package/rules/common/cwe-770-resource-exhaustion.yaml +44 -0
  146. package/rules/common/cwe-78-os-command-injection.yaml +43 -0
  147. package/rules/common/cwe-787-out-of-bounds-write.yaml +37 -0
  148. package/rules/common/cwe-79-xss.yaml +51 -0
  149. package/rules/common/cwe-862-missing-authorization.yaml +40 -0
  150. package/rules/common/cwe-89-sqli.yaml +89 -0
  151. package/rules/common/cwe-918-ssrf.yaml +45 -0
  152. package/rules/common/cwe-94-code-injection.yaml +59 -0
  153. package/rules/common/zm-go-cwe22-path-traversal-fs.yaml +117 -0
  154. package/rules/common/zm-go-cwe22-path-traversal.yaml +103 -0
  155. package/rules/common/zm-go-cwe307-brute-force.yaml +129 -0
  156. package/rules/common/zm-go-cwe326-weak-crypto.yaml +124 -0
  157. package/rules/common/zm-go-cwe327-weak-cipher.yaml +152 -0
  158. package/rules/common/zm-go-cwe384-session-fixation.yaml +128 -0
  159. package/rules/common/zm-go-cwe502-deserialization.yaml +120 -0
  160. package/rules/common/zm-go-cwe78-command-injection.yaml +95 -0
  161. package/rules/common/zm-go-cwe79-xss.yaml +104 -0
  162. package/rules/common/zm-go-cwe798-hardcoded-creds.yaml +153 -0
  163. package/rules/common/zm-go-cwe89-sqli.yaml +89 -0
  164. package/rules/common/zm-go-cwe918-ssrf.yaml +117 -0
  165. package/rules/common/zm-java-cwe117-log-injection.yaml +83 -0
  166. package/rules/common/zm-java-cwe117-logforging.yaml +153 -0
  167. package/rules/common/zm-java-cwe200-actuator-exposure.yaml +8 -0
  168. package/rules/common/zm-java-cwe200-info-disclosure.yaml +91 -0
  169. package/rules/common/zm-java-cwe22-file-depth.yaml +135 -0
  170. package/rules/common/zm-java-cwe22-path-traversal-spring.yaml +81 -0
  171. package/rules/common/zm-java-cwe284-missing-auth-spring.yaml +131 -0
  172. package/rules/common/zm-java-cwe295-webview-ssl.yaml +123 -0
  173. package/rules/common/zm-java-cwe327-weakcrypto.yaml +197 -0
  174. package/rules/common/zm-java-cwe347-jwt.yaml +30 -0
  175. package/rules/common/zm-java-cwe352-csrf-depth.yaml +107 -0
  176. package/rules/common/zm-java-cwe352-csrf-disabled.yaml +15 -0
  177. package/rules/common/zm-java-cwe501-trust-boundary.yaml +124 -0
  178. package/rules/common/zm-java-cwe502-deserial-depth.yaml +128 -0
  179. package/rules/common/zm-java-cwe502-fastjson.yaml +137 -0
  180. package/rules/common/zm-java-cwe502-gadget.yaml +158 -0
  181. package/rules/common/zm-java-cwe502-jndi-injection.yaml +91 -0
  182. package/rules/common/zm-java-cwe502-shiro.yaml +108 -0
  183. package/rules/common/zm-java-cwe601-url-redirect-spring.yaml +85 -0
  184. package/rules/common/zm-java-cwe611-xxe-enhanced.yaml +80 -0
  185. package/rules/common/zm-java-cwe611-xxe-transformer.yaml +85 -0
  186. package/rules/common/zm-java-cwe639-idor.yaml +123 -0
  187. package/rules/common/zm-java-cwe79-xss-depth.yaml +98 -0
  188. package/rules/common/zm-java-cwe862-authz-depth.yaml +127 -0
  189. package/rules/common/zm-java-cwe915-mass-assignment.yaml +16 -0
  190. package/rules/common/zm-java-cwe917-expression-injection.yaml +120 -0
  191. package/rules/common/zm-java-cwe918-resttemplate.yaml +67 -0
  192. package/rules/common/zm-java-cwe918-ssrf-depth.yaml +103 -0
  193. package/rules/common/zm-java-cwe918-ssrf-resttemplate.yaml +77 -0
  194. package/rules/common/zm-java-cwe918-webclient.yaml +44 -0
  195. package/rules/common/zm-java-cwe94-ognl.yaml +66 -0
  196. package/rules/common/zm-java-cwe94-spel-injection.yaml +85 -0
  197. package/rules/common/zm-java-cwe94-spel.yaml +112 -0
  198. package/rules/common/zm-java-cwe94-ssti.yaml +22 -0
  199. package/rules/common/zm-java-cwe942-cors.yaml +15 -0
  200. package/rules/common/zm-js-cwe1321-prototype-pollution.yaml +61 -0
  201. package/rules/common/zm-js-cwe200-info-disclosure.yaml +95 -0
  202. package/rules/common/zm-js-cwe22-path-traversal-fs.yaml +113 -0
  203. package/rules/common/zm-js-cwe22-pathtraversal.yaml +111 -0
  204. package/rules/common/zm-js-cwe307-brute-force.yaml +136 -0
  205. package/rules/common/zm-js-cwe345-postmessage.yaml +75 -0
  206. package/rules/common/zm-js-cwe347-jwt-weak.yaml +95 -0
  207. package/rules/common/zm-js-cwe352-csrf.yaml +52 -0
  208. package/rules/common/zm-js-cwe384-session-fixation.yaml +132 -0
  209. package/rules/common/zm-js-cwe502-deserialization.yaml +119 -0
  210. package/rules/common/zm-js-cwe611-xxe.yaml +108 -0
  211. package/rules/common/zm-js-cwe639-idor.yaml +122 -0
  212. package/rules/common/zm-js-cwe693-helmet-missing.yaml +46 -0
  213. package/rules/common/zm-js-cwe78-exec.yaml +37 -0
  214. package/rules/common/zm-js-cwe78-spawn.yaml +37 -0
  215. package/rules/common/zm-js-cwe79-domxss.yaml +84 -0
  216. package/rules/common/zm-js-cwe79-react-xss.yaml +18 -0
  217. package/rules/common/zm-js-cwe79-xss-ejs.yaml +70 -0
  218. package/rules/common/zm-js-cwe89-sqli.yaml +153 -0
  219. package/rules/common/zm-js-cwe915-mass-assignment.yaml +111 -0
  220. package/rules/common/zm-js-cwe918-ssrf-fetch.yaml +134 -0
  221. package/rules/common/zm-js-cwe918-ssrf.yaml +132 -0
  222. package/rules/common/zm-js-cwe94-template-injection.yaml +130 -0
  223. package/rules/common/zm-js-cwe942-cors.yaml +49 -0
  224. package/rules/common/zm-js-cwe943-nosql-injection.yaml +52 -0
  225. package/rules/common/zm-js-cwe95-eval.yaml +59 -0
  226. package/rules/common/zm-js-cwe95-function-ctor.yaml +31 -0
  227. package/rules/common/zm-py-cwe22-path-traversal.yaml +86 -0
  228. package/rules/common/zm-py-cwe327-weak-crypto.yaml +103 -0
  229. package/rules/common/zm-py-cwe502-pickle.yaml +92 -0
  230. package/rules/common/zm-py-cwe611-xxe.yaml +100 -0
  231. package/rules/common/zm-py-cwe78-command-injection.yaml +121 -0
  232. package/rules/common/zm-py-cwe79-xss.yaml +123 -0
  233. package/rules/common/zm-py-cwe798-hardcoded-creds.yaml +86 -0
  234. package/rules/common/zm-py-cwe89-sqli.yaml +59 -0
  235. package/rules/common/zm-py-cwe918-ssrf.yaml +123 -0
  236. package/rules/common/zm-py-cwe94-ssti.yaml +87 -0
  237. package/rules/common/zm-py-cwe943-nosql-injection.yaml +123 -0
  238. package/rules/iac/ansible/zm-ansible-cwe269-privilege-escalation.yaml +63 -0
  239. package/rules/iac/ansible/zm-ansible-cwe78-command-injection.yaml +67 -0
  240. package/rules/iac/ansible/zm-ansible-cwe798-hardcoded-creds.yaml +93 -0
  241. package/rules/iac/terraform/zm-tf-cwe200-s3-bucket-public.yaml +100 -0
  242. package/rules/iac/terraform/zm-tf-cwe284-sg-wide-open.yaml +88 -0
  243. package/rules/iac/terraform/zm-tf-cwe311-iam-wildcard.yaml +83 -0
  244. package/rules/iac/terraform/zm-tf-cwe319-rds-public.yaml +72 -0
  245. package/rules/iac/terraform/zm-tf-cwe798-hardcoded-creds.yaml +102 -0
  246. package/rules/iac/zm-docker-cwe250-root-user.yaml +50 -0
  247. package/rules/iac/zm-docker-cwe400-resource-limit.yaml +92 -0
  248. package/rules/iac/zm-docker-security.yaml +104 -0
  249. package/rules/iac/zm-k8s-cwe200-service-account.yaml +83 -0
  250. package/rules/iac/zm-k8s-cwe250-privileged.yaml +56 -0
  251. package/rules/iac/zm-k8s-security.yaml +79 -0
  252. package/rules/rules_index.yaml.off +477 -0
  253. package/rules/semgrep-registry/anonymous-ldap-bind.yaml +34 -0
  254. package/rules/semgrep-registry/bad-hexa-conversion.yaml +32 -0
  255. package/rules/semgrep-registry/blowfish-insufficient-key-size.yaml +39 -0
  256. package/rules/semgrep-registry/cbc-padding-oracle.yaml +38 -0
  257. package/rules/semgrep-registry/command-injection-formatted-runtime-call.yaml +90 -0
  258. package/rules/semgrep-registry/command-injection-process-builder.yaml +148 -0
  259. package/rules/semgrep-registry/cookie-missing-httponly.yaml +38 -0
  260. package/rules/semgrep-registry/cookie-missing-secure-flag.yaml +38 -0
  261. package/rules/semgrep-registry/crlf-injection-logs.yaml +86 -0
  262. package/rules/semgrep-registry/dangerous-groovy-shell.yaml +46 -0
  263. package/rules/semgrep-registry/el-injection.yaml +137 -0
  264. package/rules/semgrep-registry/formatted-sql-string.yaml +95 -0
  265. package/rules/semgrep-registry/http-response-splitting.yaml +44 -0
  266. package/rules/semgrep-registry/index.txt +1 -0
  267. package/rules/semgrep-registry/insecure-smtp-connection.yaml +34 -0
  268. package/rules/semgrep-registry/java-reverse-shell.yaml +43 -0
  269. package/rules/semgrep-registry/jdbc-sql-formatted-string.yaml +120 -0
  270. package/rules/semgrep-registry/ldap-entry-poisoning.yaml +41 -0
  271. package/rules/semgrep-registry/ldap-injection.yaml +82 -0
  272. package/rules/semgrep-registry/md5-used-as-password.yaml +44 -0
  273. package/rules/semgrep-registry/object-deserialization.yaml +34 -0
  274. package/rules/semgrep-registry/ognl-injection.yaml +839 -0
  275. package/rules/semgrep-registry/overly-permissive-file-permission.yaml +49 -0
  276. package/rules/semgrep-registry/permissive-cors.yaml +77 -0
  277. package/rules/semgrep-registry/script-engine-injection.yaml +66 -0
  278. package/rules/semgrep-registry/tainted-cmd-from-http-request.yaml +74 -0
  279. package/rules/semgrep-registry/tainted-env-from-http-request.yaml +46 -0
  280. package/rules/semgrep-registry/tainted-ldapi-from-http-request.yaml +42 -0
  281. package/rules/semgrep-registry/tainted-session-from-http-request.yaml +70 -0
  282. package/rules/semgrep-registry/tainted-xpath-from-http-request.yaml +38 -0
  283. package/rules/semgrep-registry/unsafe-reflection.yaml +39 -0
  284. package/rules/semgrep-registry/unvalidated-redirect.yaml +127 -0
  285. package/rules/semgrep-registry/url-rewriting.yaml +82 -0
  286. package/rules/semgrep-registry/weak-ssl-context.yaml +34 -0
  287. package/rules/semgrep-registry/xml-decoder.yaml +53 -0
  288. package/rules/semgrep-registry/xssrequestwrapper-is-insecure.yaml +40 -0
@@ -0,0 +1,46 @@
1
+ rules:
2
+ - id: zm-android-cleartext-http
3
+ severity: HIGH
4
+ message: HTTP cleartext connection detected. Network traffic sent over HTTP is visible to anyone on the same network segment. Android 9+ blocks cleartext by default; explicit enabling here overrides that protection.
5
+ metadata:
6
+ cwe: "CWE-319: Cleartext Transmission of Sensitive Information"
7
+ owasp-mobile: "M3: Insecure Communication"
8
+ masvs: "MASVS-NETWORK-1"
9
+ category: android-network
10
+ precision: medium
11
+ confidence: high
12
+ languages: [java]
13
+ patterns:
14
+ - pattern-either:
15
+ - pattern: new URL("http://...")
16
+ - pattern: |
17
+ $HTTP.url($URL).build()
18
+ - pattern: |
19
+ Request $R = new Request.Builder().url($URL).$METHOD();
20
+
21
+ - id: zm-android-cleartext-okhttp-url
22
+ severity: HIGH
23
+ message: OkHttp request to HTTP URL. Ensure all production API endpoints use HTTPS, not HTTP. Cleartext traffic exposes user sessions, tokens, and personal data in transit.
24
+ metadata:
25
+ cwe: "CWE-319: Cleartext Transmission of Sensitive Information"
26
+ owasp-mobile: "M3: Insecure Communication"
27
+ category: android-network
28
+ precision: low
29
+ languages: [java]
30
+ patterns:
31
+ - pattern-either:
32
+ - pattern: |
33
+ $BUILDER.url("http://..." + $X)
34
+ - pattern: $BUILDER.url($B)
35
+ - id: zm-android-hsts-missing
36
+ severity: MEDIUM
37
+ message: No HSTS preloading or certificate pinning detected. Without certificate validation, the app is vulnerable to MitM attacks via rogue CAs or compromised certificates.
38
+ metadata:
39
+ cwe: "CWE-295: Improper Certificate Validation"
40
+ owasp-mobile: "M3: Insecure Communication"
41
+ masvs: "MASVS-NETWORK-3"
42
+ category: android-network
43
+ precision: medium
44
+ languages: [java]
45
+ patterns:
46
+ - pattern: $H.hostnameVerifier(HostnameVerifier.ALLOW_ALL_HOSTNAME_VERIFIER)
@@ -0,0 +1,107 @@
1
+ rules:
2
+ - id: zm-android-exported-component-no-permission
3
+ severity: HIGH
4
+ message: Exported Android component without permission protection. Any app on the device can launch this Activity/Service/Receiver, potentially bypassing authentication or reading sensitive Intent extras.
5
+ metadata:
6
+ cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
7
+ owasp-mobile: "M1: Improper Platform Usage"
8
+ masvs: "MASVS-PLATFORM-1"
9
+ category: android-components
10
+ precision: medium
11
+ confidence: high
12
+ languages: [java]
13
+ patterns:
14
+ - pattern-either:
15
+ - pattern: |
16
+ $A.setExported(true);
17
+ - pattern-not: |
18
+ $A.setPermission($PERM);
19
+
20
+ - id: zm-android-implicit-intent-sniffing
21
+ severity: MEDIUM
22
+ message: Implicit Intent without setting a specific package. Any app can intercept this Intent, enabling intent sniffing attacks where malicious apps steal sensitive data from the Intent extras.
23
+ metadata:
24
+ cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
25
+ owasp-mobile: "M1: Improper Platform Usage"
26
+ masvs: "MASVS-PLATFORM-2"
27
+ category: android-components
28
+ precision: low
29
+ languages: [java]
30
+ patterns:
31
+ - pattern-either:
32
+ - pattern: |
33
+ new Intent($ACTION)
34
+ - pattern: |
35
+ Intent $I = new Intent($ACTION);
36
+ - pattern-not: |
37
+ $I.setPackage($PKG);
38
+ - pattern-not: |
39
+ $I.setComponent($COMP);
40
+
41
+ - id: zm-android-pending-intent-mutable
42
+ severity: HIGH
43
+ message: Mutable PendingIntent. A malicious app can intercept and modify the Intent embedded in this PendingIntent to redirect it to their own component or alter extras. Use FLAG_IMMUTABLE on Android 12+ (API 31+).
44
+ metadata:
45
+ cwe: "CWE-927: Use of Implicit Intent for Sensitive Communication"
46
+ owasp-mobile: "M1: Improper Platform Usage"
47
+ category: android-components
48
+ precision: high
49
+ confidence: high
50
+ languages: [java]
51
+ patterns:
52
+ - pattern-either:
53
+ - pattern: PendingIntent.getActivity($CTX, $CODE, $INTENT, PendingIntent.FLAG_MUTABLE)
54
+ - pattern: PendingIntent.getBroadcast($CTX, $CODE, $INTENT, PendingIntent.FLAG_MUTABLE)
55
+ - pattern: PendingIntent.getService($CTX, $CODE, $INTENT, PendingIntent.FLAG_MUTABLE)
56
+ - pattern: PendingIntent.getActivity($CTX, $CODE, $INTENT, $FLAGS)
57
+ - pattern-not: |
58
+ PendingIntent.getActivity($CTX, $CODE, $INTENT, PendingIntent.FLAG_IMMUTABLE)
59
+ - pattern-not: |
60
+ PendingIntent.getBroadcast($CTX, $CODE, $INTENT, PendingIntent.FLAG_IMMUTABLE)
61
+
62
+ - id: zm-android-task-hijacking
63
+ severity: MEDIUM
64
+ message: Activity with taskAffinity set but no singleInstance launch mode. Enables StrandHogg-style task hijacking where a malicious app overlays a fake login UI on top of the legitimate Activity.
65
+ metadata:
66
+ cwe: "CWE-940: Improper Verification of Source of a Communication Channel"
67
+ owasp-mobile: "M1: Improper Platform Usage"
68
+ category: android-components
69
+ precision: low
70
+ languages: [java]
71
+ patterns:
72
+ - pattern: |
73
+ $A.setTaskAffinity($AFF)
74
+ - pattern-not: |
75
+ $A.setLaunchMode("singleInstance")
76
+ - pattern-not: |
77
+ $A.setLaunchMode("singleTask")
78
+
79
+ - id: zm-android-debuggable-true
80
+ severity: HIGH
81
+ message: Application is debuggable. In a release build, android:debuggable="true" allows any attacker with USB access to run arbitrary code, dump memory, and extract encryption keys via adb.
82
+ metadata:
83
+ cwe: "CWE-489: Active Debug Code"
84
+ owasp-mobile: "M8: Security Misconfiguration"
85
+ masvs: "MASVS-CODE-5"
86
+ category: android-components
87
+ precision: high
88
+ confidence: very-high
89
+ languages: [java]
90
+ patterns:
91
+ - pattern-either:
92
+ - pattern: |
93
+ $B.setDebuggable(true)
94
+
95
+ - id: zm-android-backup-enabled
96
+ severity: MEDIUM
97
+ message: Android backup enabled. With android:allowBackup="true", app data (including SharedPreferences and internal storage) can be extracted via adb backup without requiring root, exposing potentially sensitive data to anyone with physical or USB access.
98
+ metadata:
99
+ cwe: "CWE-200: Exposure of Sensitive Information"
100
+ owasp-mobile: "M2: Insecure Data Storage"
101
+ masvs: "MASVS-STORAGE-4"
102
+ category: android-components
103
+ precision: medium
104
+ languages: [java]
105
+ patterns:
106
+ - pattern: |
107
+ $A.setAllowBackup(true)
@@ -0,0 +1,139 @@
1
+ rules:
2
+ - id: zm-android-weak-crypto-aes-ecb
3
+ severity: CRITICAL
4
+ message: AES in ECB mode. ECB mode encrypts identical plaintext blocks to identical ciphertext blocks, revealing data patterns. Use AES/GCM/NoPadding (preferred) or AES/CBC/PKCS5Padding with a random IV.
5
+ metadata:
6
+ cwe: "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
7
+ owasp-mobile: "M3: Insecure Communication"
8
+ masvs: "MASVS-CRYPTO-1"
9
+ category: android-crypto
10
+ precision: high
11
+ confidence: high
12
+ languages: [java]
13
+ patterns:
14
+ - pattern-either:
15
+ - pattern: |
16
+ Cipher.getInstance("AES/ECB/$PADDING")
17
+ - pattern: |
18
+ Cipher.getInstance("AES")
19
+ - pattern: |
20
+ Cipher.getInstance("DES")
21
+ - pattern: |
22
+ Cipher.getInstance("DES/ECB/$PADDING")
23
+
24
+ - id: zm-android-weak-crypto-no-padding
25
+ severity: HIGH
26
+ message: Cipher without authentication. AES/CBC without GCM or an HMAC allows bit-flipping and padding oracle attacks. Use AES/GCM/NoPadding which provides built-in authentication.
27
+ metadata:
28
+ cwe: "CWE-327: Use of a Broken or Risky Cryptographic Algorithm"
29
+ owasp-mobile: "M3: Insecure Communication"
30
+ category: android-crypto
31
+ precision: medium
32
+ languages: [java]
33
+ pattern: |
34
+ Cipher.getInstance("AES/CBC/PKCS5Padding")
35
+
36
+ - id: zm-android-weak-hash-sha1
37
+ severity: HIGH
38
+ message: SHA-1 used for cryptographic purposes. SHA-1 is collision-broken since 2017 (SHAttered). Use SHA-256 or SHA-3 family for any security-sensitive hashing.
39
+ metadata:
40
+ cwe: "CWE-328: Use of Weak Hash"
41
+ owasp-mobile: "M3: Insecure Communication"
42
+ masvs: "MASVS-CRYPTO-2"
43
+ category: android-crypto
44
+ precision: medium
45
+ languages: [java]
46
+ patterns:
47
+ - pattern-either:
48
+ - pattern: |
49
+ MessageDigest.getInstance("SHA-1")
50
+ - pattern: |
51
+ MessageDigest.getInstance("SHA1")
52
+ - pattern: |
53
+ MessageDigest.getInstance("MD5")
54
+ - pattern: |
55
+ MessageDigest.getInstance("MD2")
56
+ - pattern: |
57
+ MessageDigest.getInstance("MD4")
58
+
59
+ - id: zm-android-insecure-random
60
+ severity: MEDIUM
61
+ message: Insecure PRNG used for cryptographic purposes. java.util.Random and Math.random() use a 48-bit linear congruential generator which is predictable. Use SecureRandom with a strong provider for any security-sensitive randomness (IV, key generation, nonces).
62
+ metadata:
63
+ cwe: "CWE-330: Use of Insufficiently Random Values"
64
+ owasp-mobile: "M3: Insecure Communication"
65
+ masvs: "MASVS-CRYPTO-1"
66
+ category: android-crypto
67
+ precision: low
68
+ languages: [java]
69
+ patterns:
70
+ - pattern-either:
71
+ - pattern: |
72
+ new Random()
73
+ - pattern: |
74
+ Math.random()
75
+ - pattern-not: |
76
+ new SecureRandom()
77
+
78
+ - id: zm-android-static-iv
79
+ severity: CRITICAL
80
+ message: Static or hardcoded IV in cipher initialization. Using a fixed IV with CBC mode makes the cipher deterministic and exposes patterns in the ciphertext. Every encryption operation must use a unique, randomly generated IV.
81
+ metadata:
82
+ cwe: "CWE-329: Generation of Predictable IV with CBC Mode"
83
+ owasp-mobile: "M3: Insecure Communication"
84
+ masvs: "MASVS-CRYPTO-2"
85
+ category: android-crypto
86
+ precision: medium
87
+ confidence: high
88
+ languages: [java]
89
+ patterns:
90
+ - pattern-either:
91
+ - pattern: |
92
+ $CIPHER.init($MODE, $KEY, new IvParameterSpec($X))
93
+
94
+ - id: zm-android-crypto-key-hardcoded
95
+ severity: CRITICAL
96
+ message: Hardcoded cryptographic key. Encryption keys embedded in source code are extracted by anyone who decompiles the APK. Use Android Keystore (AndroidKeyStore provider) which stores keys in hardware-backed secure storage (TEE/Secure Element) and prevents extraction.
97
+ metadata:
98
+ cwe: "CWE-321: Use of Hard-coded Cryptographic Key"
99
+ owasp-mobile: "M3: Insecure Communication"
100
+ masvs: "MASVS-CRYPTO-1"
101
+ category: android-crypto
102
+ precision: medium
103
+ confidence: medium
104
+ languages: [java]
105
+ patterns:
106
+ - pattern-either:
107
+ - pattern: new SecretKeySpec($BYTES, $ALG)
108
+ - pattern: |
109
+ $CIPHER.init($MODE, new SecretKeySpec("$K".getBytes(), $A))
110
+
111
+ - id: zm-android-unaligned-crypto-spec
112
+ severity: MEDIUM
113
+ message: AES key generation without explicit key size specification. KeyGenerator.init() without a key size may default to provider-dependent sizes. For AES, always specify 256 bits explicitly.
114
+ metadata:
115
+ cwe: "CWE-326: Inadequate Encryption Strength"
116
+ owasp-mobile: "M3: Insecure Communication"
117
+ category: android-crypto
118
+ precision: low
119
+ languages: [java]
120
+ patterns:
121
+ - pattern: $KG.init($N)
122
+ - metavariable-pattern:
123
+ metavariable: $N
124
+ patterns:
125
+ - pattern-not: |
126
+ 256
127
+
128
+ - id: zm-android-android-keystore-not-used
129
+ severity: WARNING
130
+ message: Cryptographic key generated without Android Keystore. Keys generated with standard Java providers can be extracted from the process memory or from backups. Use KeyGenParameterSpec with AndroidKeyStore provider for TEE-backed key storage.
131
+ metadata:
132
+ cwe: "CWE-922: Insecure Storage of Sensitive Information"
133
+ owasp-mobile: "M2: Insecure Data Storage"
134
+ masvs: "MASVS-CRYPTO-1"
135
+ category: android-crypto
136
+ precision: low
137
+ languages: [java]
138
+ patterns:
139
+ - pattern: new KeyGenParameterSpec.Builder($A, $PURPOSE)
@@ -0,0 +1,81 @@
1
+ # CWE-1021: Tapjacking / Touch Hijacking (Android)
2
+ # ZhuMa V4.0 - Android Rule Library
3
+ # Source: ZhuMa V4.1 Rule Expansion - UI redressing attacks
4
+
5
+ rules:
6
+ - id: zm-android-view-no-filter-touches
7
+ severity: MEDIUM
8
+ message: |
9
+ Detected a View or ViewGroup that does not call setFilterTouchesWhenObscured(true).
10
+ Without this protection, a malicious app can overlay a transparent window on top of this View
11
+ and hijack touch events (tapjacking / touch redirection attack).
12
+ Remediation: Call setFilterTouchesWhenObscured(true) on all sensitive Views, or globally in the theme.
13
+ languages:
14
+ - java
15
+ patterns:
16
+ - pattern-either:
17
+ - pattern: |
18
+ $VIEW.setOnClickListener($LISTENER);
19
+ metadata:
20
+ cwe: "CWE-1021: Improper Restriction of Rendered UI Layers or Frames"
21
+ owasp-mobile: "M1: Improper Platform Usage"
22
+ masvs: "MASVS-PLATFORM-3"
23
+ category: android-ui
24
+ precision: low
25
+ confidence: low
26
+ source: "ZhuMa V4.1 Rule Expansion"
27
+ references:
28
+ - https://cwe.mitre.org/data/definitions/1021.html
29
+ - https://developer.android.com/privacy-and-security/risks/tapjacking
30
+
31
+ - id: zm-android-layout-no-filter-touches
32
+ severity: MEDIUM
33
+ message: |
34
+ Detected an Activity or Fragment layout without android:filterTouchesWhenObscured="true".
35
+ This should be set on all layouts that handle sensitive user interactions (login, payment, PIN entry).
36
+ Remediation: Add android:filterTouchesWhenObscured="true" to the root layout element.
37
+ languages:
38
+ - java
39
+ patterns:
40
+ - pattern-either:
41
+ - pattern: |
42
+ public void onCreate(Bundle $B) {
43
+ super.onCreate($B);
44
+ setContentView($LAYOUT);
45
+ ...
46
+ }
47
+ metadata:
48
+ cwe: "CWE-1021: Improper Restriction of Rendered UI Layers or Frames"
49
+ owasp-mobile: "M1: Improper Platform Usage"
50
+ masvs: "MASVS-PLATFORM-3"
51
+ category: android-ui
52
+ precision: low
53
+ confidence: low
54
+ source: "ZhuMa V4.1 Rule Expansion"
55
+ references:
56
+ - https://cwe.mitre.org/data/definitions/1021.html
57
+
58
+ - id: zm-android-overlay-alert-no-filter
59
+ severity: LOW
60
+ message: |
61
+ Detected use of WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY without tapjacking protection.
62
+ Applications that use overlays without filterTouchesWhenObscured expose users to tapjacking.
63
+ Remediation: Ensure your own overlays do not obscure sensitive actions; implement touch filtering for incoming overlays.
64
+ languages:
65
+ - java
66
+ patterns:
67
+ - pattern-either:
68
+ - pattern: |
69
+ $PARAMS.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
70
+ - pattern: |
71
+ $PARAMS.type = WindowManager.LayoutParams.$TYPE
72
+ metadata:
73
+ cwe: "CWE-1021: Improper Restriction of Rendered UI Layers or Frames"
74
+ owasp-mobile: "M1: Improper Platform Usage"
75
+ masvs: "MASVS-PLATFORM-3"
76
+ category: android-ui
77
+ precision: low
78
+ confidence: low
79
+ source: "ZhuMa V4.1 Rule Expansion"
80
+ references:
81
+ - https://cwe.mitre.org/data/definitions/1021.html
@@ -0,0 +1,41 @@
1
+ # CWE-114: 动态加载外部 DEX/JAR (Android)
2
+ # 逐码 ZhuMa V4.0 — Android 规则库
3
+ # 来源: V3 审计引擎 VULN-CE-004
4
+
5
+ rules:
6
+ - id: zm-android-dynamic-dex-external-storage
7
+ severity: HIGH
8
+ message: |
9
+ 检测到从外部存储或网络路径动态加载 DEX/JAR 文件。
10
+ 如果加载的 DEX 文件来自不可信来源(如 sdcard/Downloads),
11
+ 攻击者可推送恶意 DEX 触发热更新加载实现代码注入。
12
+ 修复:
13
+ 1. 动态加载的 DEX 必须做签名校验
14
+ 2. 存储路径限定在 APP 私有目录 (data/data/<pkg>/)
15
+ 3. 优先使用 Google Play Core 的 SplitCompat / Play Feature Delivery
16
+ languages:
17
+ - java
18
+ patterns:
19
+ - pattern-either:
20
+ - pattern: |
21
+ new DexClassLoader($PATH, $CL, $OPT)
22
+ - pattern: |
23
+ new DexFile($PATH)
24
+ - pattern: |
25
+ new PathClassLoader($PATH, $CL, $OPT)
26
+ - metavariable-regex:
27
+ metavariable: $PATH
28
+ regex: '(?i)(sdcard|external|download|cache|http)'
29
+ metadata:
30
+ cwe: "CWE-114: Process Control"
31
+ owasp-mobile: "M1: Improper Platform Usage"
32
+ masvs: "MASVS-CODE-4"
33
+ category: android-code-execution
34
+ precision: medium
35
+ confidence: medium
36
+ likelihood: low
37
+ impact: high
38
+ source: "V3 Audit Engine - VULN-CE-004"
39
+ references:
40
+ - https://cwe.mitre.org/data/definitions/114.html
41
+ - https://developer.android.com/guide/playcore/feature-delivery
@@ -0,0 +1,66 @@
1
+ # CWE-200: 剪贴板敏感数据泄露 (Android)
2
+ # 逐码 ZhuMa V4.0 — Android 规则库
3
+ # 来源: V3 审计引擎 VULN-CLIP-001
4
+
5
+ rules:
6
+ - id: zm-android-clipboard-sensitive-data-no-clear
7
+ severity: HIGH
8
+ message: |
9
+ 检测到剪贴板写入操作 + 代码中存在敏感数据字段 (password/token/code)
10
+ 但未检测到清除剪贴板的操作 (clearPrimaryClip)。
11
+ 这可能导致 Token/密码/验证码通过剪贴板泄露给其他 APP。
12
+ 修复: 敏感数据复制后立即调用 clipboardManager.clearPrimaryClip();
13
+ 或对输入框设置 FLAG_SECURE 防止截屏。
14
+ languages:
15
+ - java
16
+ patterns:
17
+ - pattern: |
18
+ $CM.setPrimaryClip($CLIP)
19
+ - pattern-not: |
20
+ ...
21
+ $CM.setPrimaryClip($CLIP);
22
+ ...
23
+ $CM.clearPrimaryClip();
24
+ ...
25
+ metadata:
26
+ cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
27
+ owasp-mobile: "M1: Improper Platform Usage"
28
+ masvs: "MASVS-STORAGE-4"
29
+ category: android-data-exposure
30
+ precision: low
31
+ confidence: low
32
+ note: |
33
+ 此规则仅检测剪贴板写入操作;确认"敏感数据"需要结合上下文人工审计。
34
+ V3 引擎 (VULN-CLIP-001) 通过检测 password/token/code 等关键词交叉验证。
35
+ source: "V3 Audit Engine - VULN-CLIP-001"
36
+ references:
37
+ - https://developer.android.com/reference/android/content/ClipboardManager
38
+
39
+ - id: zm-android-mediastore-no-is-pending
40
+ severity: WARNING
41
+ message: |
42
+ 检测到 MediaStore 写入操作但未使用 IS_PENDING 标记。
43
+ Android 10+ 中,向 MediaStore 写入的临时文件在写入完成前可能被
44
+ 其他 APP 读取。IS_PENDING 标记可锁定文件直到写入完成。
45
+ 修复: put(MediaStore.MediaColumns.IS_PENDING, 1) 然后在写入完成后清除。
46
+ languages:
47
+ - java
48
+ patterns:
49
+ - pattern: |
50
+ $RESOLVER.insert(MediaStore.$TYPE.EXTERNAL_CONTENT_URI, $VALUES)
51
+ - pattern-not: |
52
+ ...
53
+ $VALUES.put(MediaStore.MediaColumns.IS_PENDING, ...);
54
+ ...
55
+ $RESOLVER.insert(...);
56
+ ...
57
+ metadata:
58
+ cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
59
+ owasp-mobile: "M1: Improper Platform Usage"
60
+ masvs: "MASVS-STORAGE-4"
61
+ category: android-data-exposure
62
+ precision: low
63
+ confidence: low
64
+ source: "V3 Audit Engine - VULN-CLIP-002"
65
+ references:
66
+ - https://developer.android.com/reference/android/provider/MediaStore.MediaColumns#IS_PENDING
@@ -0,0 +1,111 @@
1
+ # CWE-200: Debug Build Artifacts Leaking to Release (Android)
2
+ # ZhuMa V4.0 - Android Rule Library
3
+ # Source: ZhuMa V4.1 Rule Expansion - build configuration hardening
4
+
5
+ rules:
6
+ - id: zm-android-debuggable-true
7
+ severity: HIGH
8
+ message: |
9
+ Detected android:debuggable="true" in code reference or BuildConfig check.
10
+ Apps with debuggable=true allow ADB debugging, heap dumps, and process inspection
11
+ by anyone with USB access or on the same network (for wireless debugging).
12
+ This must never be true in production release builds.
13
+ Remediation: Ensure android:debuggable="false" in release manifest.
14
+ Check build.gradle / build.gradle.kts for debuggable configuration.
15
+ languages:
16
+ - java
17
+ patterns:
18
+ - pattern-either:
19
+ - pattern: $S = "true"
20
+ metadata:
21
+ cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
22
+ owasp-mobile: "M8: Code Tampering"
23
+ masvs: "MASVS-RESILIENCE-2"
24
+ category: android-build
25
+ precision: low
26
+ confidence: low
27
+ source: "ZhuMa V4.1 Rule Expansion"
28
+ references:
29
+ - https://cwe.mitre.org/data/definitions/200.html
30
+ - https://developer.android.com/privacy-and-security/risks/debuggable
31
+
32
+ - id: zm-android-buildconfig-debug-missing-guard
33
+ severity: MEDIUM
34
+ message: |
35
+ Detected BuildConfig.DEBUG used as a conditional in a way that may not protect release builds.
36
+ While BuildConfig.DEBUG is the intended guard, check that ProGuard/R8 is not stripping
37
+ this condition and that all debug code paths are properly removed.
38
+ Remediation: Ensure BuildConfig.DEBUG checks are not optimized away. Use debugImplementation
39
+ for debug-only dependencies so they are physically absent from release builds.
40
+ languages:
41
+ - java
42
+ patterns:
43
+ - pattern-either:
44
+ - pattern: BuildConfig.DEBUG
45
+ metadata:
46
+ cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
47
+ owasp-mobile: "M8: Code Tampering"
48
+ masvs: "MASVS-RESILIENCE-2"
49
+ category: android-build
50
+ precision: low
51
+ confidence: low
52
+ source: "ZhuMa V4.1 Rule Expansion"
53
+ references:
54
+ - https://cwe.mitre.org/data/definitions/200.html
55
+
56
+ - id: zm-android-test-only-debug-settings
57
+ severity: MEDIUM
58
+ message: |
59
+ Detected test/development configuration patterns (mock servers, test endpoints, debug flags).
60
+ These should never appear in production release builds as they may expose debug endpoints
61
+ or bypass security controls.
62
+ Remediation: Remove all test configuration constants. Use BuildConfig fields or
63
+ build variants to inject environment-specific values.
64
+ languages:
65
+ - java
66
+ patterns:
67
+ - pattern-either:
68
+ - pattern: |
69
+ private static final boolean $DEBUG = true;
70
+ - pattern: |
71
+ public static final boolean $DEBUG = true;
72
+ - pattern: |
73
+ private static final String $ENV = "debug";
74
+ - metavariable-regex:
75
+ metavariable: $DEBUG
76
+ regex: '(?i)(.*[Dd]ebug.*|.*[Tt]est[Mm]ode.*|.*[Mm]ock.*)'
77
+ metadata:
78
+ cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
79
+ owasp-mobile: "M8: Code Tampering"
80
+ masvs: "MASVS-RESILIENCE-2"
81
+ category: android-build
82
+ precision: medium
83
+ confidence: medium
84
+ source: "ZhuMa V4.1 Rule Expansion"
85
+ references:
86
+ - https://cwe.mitre.org/data/definitions/200.html
87
+
88
+ - id: zm-android-webview-debugging-enabled-release
89
+ severity: HIGH
90
+ message: |
91
+ Detected WebView.setWebContentsDebuggingEnabled(true) without BuildConfig.DEBUG guard.
92
+ WebView debugging allows Chrome DevTools to inspect WebView content, JavaScript context,
93
+ and network traffic. If enabled in release builds, anyone with ADB access can extract data.
94
+ Remediation: Always wrap setWebContentsDebuggingEnabled(true) in a BuildConfig.DEBUG check
95
+ or remove it entirely from release builds.
96
+ languages:
97
+ - java
98
+ patterns:
99
+ - pattern-either:
100
+ - pattern: setWebContentsDebuggingEnabled(true)
101
+ - pattern: WebView.setWebContentsDebuggingEnabled(true)
102
+ metadata:
103
+ cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
104
+ owasp-mobile: "M8: Code Tampering"
105
+ masvs: "MASVS-RESILIENCE-2"
106
+ category: android-build
107
+ precision: high
108
+ confidence: high
109
+ source: "ZhuMa V4.1 Rule Expansion"
110
+ references:
111
+ - https://cwe.mitre.org/data/definitions/200.html
@@ -0,0 +1,61 @@
1
+ # CWE-200: 敏感数据日志泄露 (Android)
2
+ # 逐码 ZhuMa V4.0 — Android 规则库
3
+ # 来源: V3 审计引擎 VULN-CLIP-001 (剪贴板敏感数据)
4
+
5
+ rules:
6
+ - id: zm-android-log-sensitive-data
7
+ severity: WARNING
8
+ message: |
9
+ 检测到 Log.d/Log.e/Log.i 输出可能包含敏感数据。
10
+ 如果日志参数包含 Token、密码、密钥等敏感信息,生产环境日志可能被
11
+ adb logcat、第三方 SDK 日志采集、或 crash report 泄露。
12
+ 修复: 生产构建中移除所有敏感数据的日志输出;使用 ProGuard/R8 去除 Log 调用。
13
+ languages:
14
+ - java
15
+ patterns:
16
+ - pattern-either:
17
+ - pattern: |
18
+ Log.$LEVEL($TAG, $TOKEN)
19
+ - pattern: |
20
+ android.util.Log.$LEVEL($TAG, $TOKEN)
21
+ - metavariable-regex:
22
+ metavariable: $TOKEN
23
+ regex: '(?i)(token|password|secret|key|auth|credential|ssn|credit_card)'
24
+ metadata:
25
+ cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
26
+ owasp-mobile: "M8: Code Tampering"
27
+ masvs: "MASVS-STORAGE-4"
28
+ category: android-data-exposure
29
+ precision: low
30
+ confidence: low
31
+ likelihood: high
32
+ impact: medium
33
+ source: "V3 Audit Engine - CLIP pattern"
34
+ references:
35
+ - https://developer.android.com/privacy-and-security/risks/logging-sensitive-data
36
+ - https://source.android.com/docs/core/architecture/security
37
+
38
+ - id: zm-android-log-exception-with-sensitivedata
39
+ severity: WARNING
40
+ message: |
41
+ 检测到 Log.e 输出异常信息可能包含请求/响应体。
42
+ 如果异常信息中包含 HTTP Response Body 或请求参数,可能泄露 Token、用户数据等。
43
+ 修复: 仅记录异常类型名称,不记录异常 message(可能包含用户数据)。
44
+ languages:
45
+ - java
46
+ patterns:
47
+ - pattern-either:
48
+ - pattern: |
49
+ Log.e($TAG, $EX.getMessage())
50
+ - pattern: |
51
+ Log.e($TAG, $EX.toString())
52
+ - pattern: |
53
+ android.util.Log.e($TAG, $EX.getMessage())
54
+ metadata:
55
+ cwe: "CWE-200: Exposure of Sensitive Information to an Unauthorized Actor"
56
+ owasp-mobile: "M8: Code Tampering"
57
+ masvs: "MASVS-STORAGE-4"
58
+ category: android-data-exposure
59
+ precision: medium
60
+ confidence: low
61
+ source: "V3 Audit Engine"