masaudit 0.1.0__tar.gz

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 (66) hide show
  1. masaudit-0.1.0/LICENSE +201 -0
  2. masaudit-0.1.0/PKG-INFO +192 -0
  3. masaudit-0.1.0/README.md +164 -0
  4. masaudit-0.1.0/pyproject.toml +46 -0
  5. masaudit-0.1.0/setup.cfg +4 -0
  6. masaudit-0.1.0/src/masaudit/__init__.py +6 -0
  7. masaudit-0.1.0/src/masaudit/__main__.py +7 -0
  8. masaudit-0.1.0/src/masaudit/cli.py +422 -0
  9. masaudit-0.1.0/src/masaudit/config.py +118 -0
  10. masaudit-0.1.0/src/masaudit/detect.py +50 -0
  11. masaudit-0.1.0/src/masaudit/detectors/__init__.py +0 -0
  12. masaudit-0.1.0/src/masaudit/detectors/android.py +887 -0
  13. masaudit-0.1.0/src/masaudit/detectors/ci.py +270 -0
  14. masaudit-0.1.0/src/masaudit/detectors/cross.py +407 -0
  15. masaudit-0.1.0/src/masaudit/detectors/ios.py +658 -0
  16. masaudit-0.1.0/src/masaudit/detectors/kmp.py +129 -0
  17. masaudit-0.1.0/src/masaudit/engine.py +270 -0
  18. masaudit-0.1.0/src/masaudit/fix.py +212 -0
  19. masaudit-0.1.0/src/masaudit/importers.py +300 -0
  20. masaudit-0.1.0/src/masaudit/lexer.py +103 -0
  21. masaudit-0.1.0/src/masaudit/model.py +84 -0
  22. masaudit-0.1.0/src/masaudit/parsers/__init__.py +0 -0
  23. masaudit-0.1.0/src/masaudit/parsers/gradle.py +161 -0
  24. masaudit-0.1.0/src/masaudit/parsers/manifest.py +82 -0
  25. masaudit-0.1.0/src/masaudit/parsers/pbxproj.py +387 -0
  26. masaudit-0.1.0/src/masaudit/parsers/plist.py +172 -0
  27. masaudit-0.1.0/src/masaudit/parsers/workflows.py +434 -0
  28. masaudit-0.1.0/src/masaudit/parsers/xcconfig.py +122 -0
  29. masaudit-0.1.0/src/masaudit/parsers/xmlsafe.py +91 -0
  30. masaudit-0.1.0/src/masaudit/profile.py +87 -0
  31. masaudit-0.1.0/src/masaudit/report/__init__.py +0 -0
  32. masaudit-0.1.0/src/masaudit/report/jsonout.py +145 -0
  33. masaudit-0.1.0/src/masaudit/report/markdown.py +334 -0
  34. masaudit-0.1.0/src/masaudit/report/sarif.py +145 -0
  35. masaudit-0.1.0/src/masaudit/report/terminal.py +118 -0
  36. masaudit-0.1.0/src/masaudit/rules/__init__.py +0 -0
  37. masaudit-0.1.0/src/masaudit/rules/_book_sections.json +199 -0
  38. masaudit-0.1.0/src/masaudit/rules/_maswe.json +314 -0
  39. masaudit-0.1.0/src/masaudit/rules/_meta.json +11 -0
  40. masaudit-0.1.0/src/masaudit/rules/android.json +931 -0
  41. masaudit-0.1.0/src/masaudit/rules/ci.json +166 -0
  42. masaudit-0.1.0/src/masaudit/rules/cross.json +246 -0
  43. masaudit-0.1.0/src/masaudit/rules/ios.json +639 -0
  44. masaudit-0.1.0/src/masaudit/rules/kmp.json +72 -0
  45. masaudit-0.1.0/src/masaudit/safety.py +161 -0
  46. masaudit-0.1.0/src/masaudit/suppress.py +131 -0
  47. masaudit-0.1.0/src/masaudit.egg-info/PKG-INFO +192 -0
  48. masaudit-0.1.0/src/masaudit.egg-info/SOURCES.txt +64 -0
  49. masaudit-0.1.0/src/masaudit.egg-info/dependency_links.txt +1 -0
  50. masaudit-0.1.0/src/masaudit.egg-info/entry_points.txt +2 -0
  51. masaudit-0.1.0/src/masaudit.egg-info/top_level.txt +1 -0
  52. masaudit-0.1.0/tests/test_android_parsers.py +116 -0
  53. masaudit-0.1.0/tests/test_attack_regressions.py +88 -0
  54. masaudit-0.1.0/tests/test_ci_workflows.py +129 -0
  55. masaudit-0.1.0/tests/test_cli.py +291 -0
  56. masaudit-0.1.0/tests/test_cross_masking.py +34 -0
  57. masaudit-0.1.0/tests/test_fix.py +155 -0
  58. masaudit-0.1.0/tests/test_ios_parsers.py +438 -0
  59. masaudit-0.1.0/tests/test_lexer.py +69 -0
  60. masaudit-0.1.0/tests/test_profile.py +80 -0
  61. masaudit-0.1.0/tests/test_report.py +137 -0
  62. masaudit-0.1.0/tests/test_rule_metadata.py +92 -0
  63. masaudit-0.1.0/tests/test_rules.py +41 -0
  64. masaudit-0.1.0/tests/test_safety.py +84 -0
  65. masaudit-0.1.0/tests/test_sarif.py +112 -0
  66. masaudit-0.1.0/tests/test_suppress.py +144 -0
masaudit-0.1.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ https://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,192 @@
1
+ Metadata-Version: 2.4
2
+ Name: masaudit
3
+ Version: 0.1.0
4
+ Summary: A free mobile security scanner that scales its advice to your app's risk profile.
5
+ Author-email: Hossam Atef <hossam9k@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/hossam9k/masaudit
8
+ Project-URL: Book, https://github.com/hossam9k/mobile-app-security
9
+ Project-URL: Sponsor, https://github.com/sponsors/hossam9k
10
+ Keywords: security,mobile,android,ios,masvs,sast,sarif
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Security
23
+ Classifier: Topic :: Software Development :: Quality Assurance
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: license-file
28
+
29
+ # masaudit
30
+
31
+ **A free mobile security scanner that scales its advice to your app's risk.**
32
+ Point it at an Android, iOS, or Kotlin Multiplatform project. It finds the weaknesses that matter
33
+ *for your kind of app*, explains each one in plain words, and tells you what you **don't** need.
34
+
35
+ A news app should never be told to pin certificates. A banking app should. Most scanners give
36
+ both the same list.
37
+
38
+ [![ci](https://github.com/hossam9k/masaudit/actions/workflows/ci.yml/badge.svg)](https://github.com/hossam9k/masaudit/actions/workflows/ci.yml)
39
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/hossam9k/masaudit/badge)](https://scorecard.dev/viewer/?uri=github.com/hossam9k/masaudit)
40
+ [![PyPI](https://img.shields.io/pypi/v/masaudit)](https://pypi.org/project/masaudit/)
41
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/hossam9k/masaudit/blob/main/LICENSING.md)
42
+
43
+ ---
44
+
45
+ ## Three ways in
46
+
47
+ | **Scan, no AI needed** | **Fix it with an AI assistant** | **Learn why** |
48
+ |---|---|---|
49
+ | `pipx run masaudit .` | Claude Code: `/plugin marketplace add hossam9k/masaudit` | Every rule links to the free book |
50
+ | Offline, Python 3.9+, zero dependencies. Writes `SECURITY-AUDIT.md`. | Audits, triages, fixes one finding at a time, reviews PRs. Works in any [Agent Skills](#use-it-with-an-ai-assistant) tool. | [*Mobile Application Security: A Study Book for Engineers*](https://github.com/hossam9k/mobile-app-security) |
51
+
52
+ ## See it on a real report
53
+
54
+ The repository ships a deliberately insecure demo app, *Acme Wallet*. Here's the same code
55
+ scanned under two profiles:
56
+
57
+ | | As a **banking** app | As a **news** app |
58
+ |---|---|---|
59
+ | Fix before release | 13 | 10 |
60
+ | Fix soon | 13 | 10 |
61
+ | Not needed for your app | 0 | 6: pinning, Keychain hardening, biometric key binding, … each with the reason |
62
+ | Full report | [sample-report-banking.md](https://github.com/hossam9k/masaudit/blob/main/docs/sample-report-banking.md) | [sample-report-news.md](https://github.com/hossam9k/masaudit/blob/main/docs/sample-report-news.md) |
63
+
64
+ Each finding says **why it matters**, **how to fix it** (with paste-ready code), **how to verify the
65
+ fix**, how long it takes, its OWASP MASWE/MASVS IDs, and the book section that explains it.
66
+
67
+ ## Scan without AI
68
+
69
+ ```bash
70
+ pipx run masaudit . # or: uvx masaudit . or: pip install masaudit
71
+ ```
72
+
73
+ No pip? Download `masaudit.pyz` from the [latest release](https://github.com/hossam9k/masaudit/releases/latest)
74
+ and run `python3 masaudit.pyz .`. It's one file, works offline, and needs nothing else.
75
+
76
+ The first run asks one question, **"What kind of app is this?"**, and offers to save your answer
77
+ in `.masaudit.ini`. In CI, or without an answer, it assumes a general app and says so.
78
+
79
+ ```bash
80
+ masaudit . --app-type banking # banking, fintech, health, ecommerce-cards, ecommerce,
81
+ # marketplace, social, content (or news), enterprise, game
82
+ masaudit . --format sarif --output masaudit.sarif
83
+ masaudit . --fail-on high # exit 1 on high or critical findings
84
+ masaudit --explain AND-004 # what a rule checks and how to fix it, offline
85
+ masaudit . --fix-safe # preview vetted safe fixes as a diff; changes nothing
86
+ ```
87
+
88
+ ### In CI
89
+
90
+ ```yaml
91
+ permissions:
92
+ contents: read
93
+ security-events: write # to show results in GitHub code scanning
94
+ steps:
95
+ - uses: actions/checkout@<commit-sha> # pin every action to a full commit SHA
96
+ with:
97
+ persist-credentials: false
98
+ - uses: hossam9k/masaudit@<commit-sha> # v0.1.0
99
+ with:
100
+ app-type: banking
101
+ fail-on: high
102
+ ```
103
+
104
+ The Action runs from its own pinned source: no download, no network. Results appear in the
105
+ Security tab. A [pre-commit hook](https://github.com/hossam9k/masaudit/blob/main/.pre-commit-hooks.yaml) is available too.
106
+
107
+ ### Team features
108
+
109
+ - **Suppress with a reason:** `// masaudit:ignore AND-015 internal activity, reachable only via signature permission`
110
+ on the line or the line above. A suppression without a reason is ignored and reported.
111
+ - **Baselines for older apps:** `masaudit . --update-baseline`, then `--baseline .masaudit-baseline.json`
112
+ fails CI only on *new* findings.
113
+ - **Bring your other tools:** `--import-sarif lint.sarif mobsfscan.sarif` calibrates Android Lint,
114
+ mobsfscan, Semgrep, and zizmor results by the same profile.
115
+
116
+ ## Use it with an AI assistant
117
+
118
+ **Claude Code**
119
+
120
+ ```text
121
+ /plugin marketplace add hossam9k/masaudit
122
+ /plugin install masaudit@masaudit
123
+ ```
124
+
125
+ Then `/masaudit:scan`, `/masaudit:fix`, `/masaudit:review`, or `/masaudit:explain AND-004`, or just
126
+ ask: *"Is my app ready for a pentest?"*
127
+
128
+ **Other tools** (Codex, GitHub Copilot, Cursor, Gemini CLI, and other tools that read
129
+ [Agent Skills](https://agentskills.io)): copy [`plugin/skills/masaudit/`](https://github.com/hossam9k/masaudit/tree/main/plugin/skills/masaudit) into
130
+ your tool's skills folder. The skill bundles the scanner, so it works offline.
131
+
132
+ **Any chat assistant:** the end of every `SECURITY-AUDIT.md` has a *Fix plan for your AI assistant*.
133
+ Paste it in.
134
+
135
+ The assistant confirms each finding in context, looks for what a scanner can't see (server-side
136
+ trust, biometric flows, token handling), and fixes one finding at a time. It asks before any
137
+ behavior-changing fix and never commits.
138
+
139
+ ## What it checks
140
+
141
+ 75 rules: 33 Android, 21 iOS, 10 cross-platform code, 8 CI and supply chain, 3 Kotlin Multiplatform.
142
+ See [docs/rules.md](https://github.com/hossam9k/masaudit/blob/main/docs/rules.md).
143
+
144
+ - **Network:** cleartext, ATS exceptions, user CAs, TLS bypasses, weak TLS, pinning (only where the profile needs it).
145
+ - **Storage:** Keychain classes, file protection, deprecated `EncryptedSharedPreferences`, Tink's silent cleartext fallback, backups, end-of-life SQLCipher.
146
+ - **Platform:** exported components, intent redirection, PendingIntent, deep links, FileProvider, WebView TLS, file access, JavaScript bridges, debugging.
147
+ - **Auth:** biometric prompts not bound to a key, keys that survive new enrollments, tokens in UserDefaults.
148
+ - **Code:** hardcoded secrets (masked in every output), ECB, fixed IVs, weak hashes and randomness, logged tokens.
149
+ - **Build and CI:** debuggable releases, R8 off, target SDK, unpinned actions, `pull_request_target`, script injection, committed signing keys.
150
+
151
+ ## How it compares
152
+
153
+ | | masaudit | MobSF | mobsfscan | Android Lint |
154
+ |---|---|---|---|---|
155
+ | Advice scaled to the app's risk | **Yes** | No | No | No |
156
+ | "Not needed for your app", with reasons | **Yes** | No | No | No |
157
+ | Plain-language why, fix, and verify per finding | **Yes** | Partly | Partly | Partly |
158
+ | Android + iOS + KMP + GitHub Actions | **Yes** | Android, iOS (binaries) | Android, iOS (source) | Android |
159
+ | Install | Single file, no dependencies | Docker | pip (Semgrep) | Android SDK |
160
+ | Imports the others' SARIF and calibrates it | **Yes** | — | — | — |
161
+
162
+ MobSF analyzes built binaries and does dynamic testing, which masaudit doesn't. Use both.
163
+
164
+ ## What it can't do
165
+
166
+ masaudit reads your source and configuration. It can't see your server, runtime behavior, or
167
+ business logic, which is where many real breaches happen. Every report ends with a *Residual risk*
168
+ section that says so, and lists anything the scanner couldn't decide. Rules marked *Check by hand*
169
+ need a human or an AI assistant to confirm.
170
+
171
+ ## Safe to run on any code
172
+
173
+ masaudit never executes project code, never follows symlinks out of the scan root, refuses XML
174
+ entity tricks, makes **no network calls** (a test enforces it), and masks secrets in every output.
175
+ No telemetry. See [SECURITY.md](https://github.com/hossam9k/masaudit/blob/main/SECURITY.md).
176
+
177
+ ## Contributing
178
+
179
+ False-positive reports are the most valuable contribution: a rule that cries wolf gets ignored.
180
+ Adding a rule takes about 30 minutes: see [CONTRIBUTING.md](https://github.com/hossam9k/masaudit/blob/main/CONTRIBUTING.md).
181
+
182
+ ## About
183
+
184
+ Built by **Hossam Atef**, a mobile engineer (Android, iOS, Kotlin Multiplatform), as the practical
185
+ companion to his free book,
186
+ [*Mobile Application Security: A Study Book for Engineers*](https://github.com/hossam9k/mobile-app-security).
187
+ Every rule traces to a section of the book, and the book records how each claim was verified.
188
+
189
+ masaudit is not an OWASP project; OWASP doesn't certify apps or endorse tools.
190
+ Licensing: code Apache-2.0, fix snippets MIT-0, explanations CC BY-SA 4.0. See [LICENSING.md](https://github.com/hossam9k/masaudit/blob/main/LICENSING.md).
191
+
192
+ masaudit is free. If it saved you an audit, you can [sponsor it](https://github.com/sponsors/hossam9k).
@@ -0,0 +1,164 @@
1
+ # masaudit
2
+
3
+ **A free mobile security scanner that scales its advice to your app's risk.**
4
+ Point it at an Android, iOS, or Kotlin Multiplatform project. It finds the weaknesses that matter
5
+ *for your kind of app*, explains each one in plain words, and tells you what you **don't** need.
6
+
7
+ A news app should never be told to pin certificates. A banking app should. Most scanners give
8
+ both the same list.
9
+
10
+ [![ci](https://github.com/hossam9k/masaudit/actions/workflows/ci.yml/badge.svg)](https://github.com/hossam9k/masaudit/actions/workflows/ci.yml)
11
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/hossam9k/masaudit/badge)](https://scorecard.dev/viewer/?uri=github.com/hossam9k/masaudit)
12
+ [![PyPI](https://img.shields.io/pypi/v/masaudit)](https://pypi.org/project/masaudit/)
13
+ [![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/hossam9k/masaudit/blob/main/LICENSING.md)
14
+
15
+ ---
16
+
17
+ ## Three ways in
18
+
19
+ | **Scan, no AI needed** | **Fix it with an AI assistant** | **Learn why** |
20
+ |---|---|---|
21
+ | `pipx run masaudit .` | Claude Code: `/plugin marketplace add hossam9k/masaudit` | Every rule links to the free book |
22
+ | Offline, Python 3.9+, zero dependencies. Writes `SECURITY-AUDIT.md`. | Audits, triages, fixes one finding at a time, reviews PRs. Works in any [Agent Skills](#use-it-with-an-ai-assistant) tool. | [*Mobile Application Security: A Study Book for Engineers*](https://github.com/hossam9k/mobile-app-security) |
23
+
24
+ ## See it on a real report
25
+
26
+ The repository ships a deliberately insecure demo app, *Acme Wallet*. Here's the same code
27
+ scanned under two profiles:
28
+
29
+ | | As a **banking** app | As a **news** app |
30
+ |---|---|---|
31
+ | Fix before release | 13 | 10 |
32
+ | Fix soon | 13 | 10 |
33
+ | Not needed for your app | 0 | 6: pinning, Keychain hardening, biometric key binding, … each with the reason |
34
+ | Full report | [sample-report-banking.md](https://github.com/hossam9k/masaudit/blob/main/docs/sample-report-banking.md) | [sample-report-news.md](https://github.com/hossam9k/masaudit/blob/main/docs/sample-report-news.md) |
35
+
36
+ Each finding says **why it matters**, **how to fix it** (with paste-ready code), **how to verify the
37
+ fix**, how long it takes, its OWASP MASWE/MASVS IDs, and the book section that explains it.
38
+
39
+ ## Scan without AI
40
+
41
+ ```bash
42
+ pipx run masaudit . # or: uvx masaudit . or: pip install masaudit
43
+ ```
44
+
45
+ No pip? Download `masaudit.pyz` from the [latest release](https://github.com/hossam9k/masaudit/releases/latest)
46
+ and run `python3 masaudit.pyz .`. It's one file, works offline, and needs nothing else.
47
+
48
+ The first run asks one question, **"What kind of app is this?"**, and offers to save your answer
49
+ in `.masaudit.ini`. In CI, or without an answer, it assumes a general app and says so.
50
+
51
+ ```bash
52
+ masaudit . --app-type banking # banking, fintech, health, ecommerce-cards, ecommerce,
53
+ # marketplace, social, content (or news), enterprise, game
54
+ masaudit . --format sarif --output masaudit.sarif
55
+ masaudit . --fail-on high # exit 1 on high or critical findings
56
+ masaudit --explain AND-004 # what a rule checks and how to fix it, offline
57
+ masaudit . --fix-safe # preview vetted safe fixes as a diff; changes nothing
58
+ ```
59
+
60
+ ### In CI
61
+
62
+ ```yaml
63
+ permissions:
64
+ contents: read
65
+ security-events: write # to show results in GitHub code scanning
66
+ steps:
67
+ - uses: actions/checkout@<commit-sha> # pin every action to a full commit SHA
68
+ with:
69
+ persist-credentials: false
70
+ - uses: hossam9k/masaudit@<commit-sha> # v0.1.0
71
+ with:
72
+ app-type: banking
73
+ fail-on: high
74
+ ```
75
+
76
+ The Action runs from its own pinned source: no download, no network. Results appear in the
77
+ Security tab. A [pre-commit hook](https://github.com/hossam9k/masaudit/blob/main/.pre-commit-hooks.yaml) is available too.
78
+
79
+ ### Team features
80
+
81
+ - **Suppress with a reason:** `// masaudit:ignore AND-015 internal activity, reachable only via signature permission`
82
+ on the line or the line above. A suppression without a reason is ignored and reported.
83
+ - **Baselines for older apps:** `masaudit . --update-baseline`, then `--baseline .masaudit-baseline.json`
84
+ fails CI only on *new* findings.
85
+ - **Bring your other tools:** `--import-sarif lint.sarif mobsfscan.sarif` calibrates Android Lint,
86
+ mobsfscan, Semgrep, and zizmor results by the same profile.
87
+
88
+ ## Use it with an AI assistant
89
+
90
+ **Claude Code**
91
+
92
+ ```text
93
+ /plugin marketplace add hossam9k/masaudit
94
+ /plugin install masaudit@masaudit
95
+ ```
96
+
97
+ Then `/masaudit:scan`, `/masaudit:fix`, `/masaudit:review`, or `/masaudit:explain AND-004`, or just
98
+ ask: *"Is my app ready for a pentest?"*
99
+
100
+ **Other tools** (Codex, GitHub Copilot, Cursor, Gemini CLI, and other tools that read
101
+ [Agent Skills](https://agentskills.io)): copy [`plugin/skills/masaudit/`](https://github.com/hossam9k/masaudit/tree/main/plugin/skills/masaudit) into
102
+ your tool's skills folder. The skill bundles the scanner, so it works offline.
103
+
104
+ **Any chat assistant:** the end of every `SECURITY-AUDIT.md` has a *Fix plan for your AI assistant*.
105
+ Paste it in.
106
+
107
+ The assistant confirms each finding in context, looks for what a scanner can't see (server-side
108
+ trust, biometric flows, token handling), and fixes one finding at a time. It asks before any
109
+ behavior-changing fix and never commits.
110
+
111
+ ## What it checks
112
+
113
+ 75 rules: 33 Android, 21 iOS, 10 cross-platform code, 8 CI and supply chain, 3 Kotlin Multiplatform.
114
+ See [docs/rules.md](https://github.com/hossam9k/masaudit/blob/main/docs/rules.md).
115
+
116
+ - **Network:** cleartext, ATS exceptions, user CAs, TLS bypasses, weak TLS, pinning (only where the profile needs it).
117
+ - **Storage:** Keychain classes, file protection, deprecated `EncryptedSharedPreferences`, Tink's silent cleartext fallback, backups, end-of-life SQLCipher.
118
+ - **Platform:** exported components, intent redirection, PendingIntent, deep links, FileProvider, WebView TLS, file access, JavaScript bridges, debugging.
119
+ - **Auth:** biometric prompts not bound to a key, keys that survive new enrollments, tokens in UserDefaults.
120
+ - **Code:** hardcoded secrets (masked in every output), ECB, fixed IVs, weak hashes and randomness, logged tokens.
121
+ - **Build and CI:** debuggable releases, R8 off, target SDK, unpinned actions, `pull_request_target`, script injection, committed signing keys.
122
+
123
+ ## How it compares
124
+
125
+ | | masaudit | MobSF | mobsfscan | Android Lint |
126
+ |---|---|---|---|---|
127
+ | Advice scaled to the app's risk | **Yes** | No | No | No |
128
+ | "Not needed for your app", with reasons | **Yes** | No | No | No |
129
+ | Plain-language why, fix, and verify per finding | **Yes** | Partly | Partly | Partly |
130
+ | Android + iOS + KMP + GitHub Actions | **Yes** | Android, iOS (binaries) | Android, iOS (source) | Android |
131
+ | Install | Single file, no dependencies | Docker | pip (Semgrep) | Android SDK |
132
+ | Imports the others' SARIF and calibrates it | **Yes** | — | — | — |
133
+
134
+ MobSF analyzes built binaries and does dynamic testing, which masaudit doesn't. Use both.
135
+
136
+ ## What it can't do
137
+
138
+ masaudit reads your source and configuration. It can't see your server, runtime behavior, or
139
+ business logic, which is where many real breaches happen. Every report ends with a *Residual risk*
140
+ section that says so, and lists anything the scanner couldn't decide. Rules marked *Check by hand*
141
+ need a human or an AI assistant to confirm.
142
+
143
+ ## Safe to run on any code
144
+
145
+ masaudit never executes project code, never follows symlinks out of the scan root, refuses XML
146
+ entity tricks, makes **no network calls** (a test enforces it), and masks secrets in every output.
147
+ No telemetry. See [SECURITY.md](https://github.com/hossam9k/masaudit/blob/main/SECURITY.md).
148
+
149
+ ## Contributing
150
+
151
+ False-positive reports are the most valuable contribution: a rule that cries wolf gets ignored.
152
+ Adding a rule takes about 30 minutes: see [CONTRIBUTING.md](https://github.com/hossam9k/masaudit/blob/main/CONTRIBUTING.md).
153
+
154
+ ## About
155
+
156
+ Built by **Hossam Atef**, a mobile engineer (Android, iOS, Kotlin Multiplatform), as the practical
157
+ companion to his free book,
158
+ [*Mobile Application Security: A Study Book for Engineers*](https://github.com/hossam9k/mobile-app-security).
159
+ Every rule traces to a section of the book, and the book records how each claim was verified.
160
+
161
+ masaudit is not an OWASP project; OWASP doesn't certify apps or endorse tools.
162
+ Licensing: code Apache-2.0, fix snippets MIT-0, explanations CC BY-SA 4.0. See [LICENSING.md](https://github.com/hossam9k/masaudit/blob/main/LICENSING.md).
163
+
164
+ masaudit is free. If it saved you an audit, you can [sponsor it](https://github.com/sponsors/hossam9k).
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "masaudit"
7
+ dynamic = ["version"]
8
+ description = "A free mobile security scanner that scales its advice to your app's risk profile."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ license = "Apache-2.0"
12
+ authors = [{ name = "Hossam Atef", email = "hossam9k@gmail.com" }]
13
+ keywords = ["security", "mobile", "android", "ios", "masvs", "sast", "sarif"]
14
+ dependencies = []
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3 :: Only",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Security",
28
+ "Topic :: Software Development :: Quality Assurance",
29
+ ]
30
+
31
+ [project.urls]
32
+ Homepage = "https://github.com/hossam9k/masaudit"
33
+ Book = "https://github.com/hossam9k/mobile-app-security"
34
+ Sponsor = "https://github.com/sponsors/hossam9k"
35
+
36
+ [project.scripts]
37
+ masaudit = "masaudit.cli:main"
38
+
39
+ [tool.setuptools.dynamic]
40
+ version = { attr = "masaudit.__version__" }
41
+
42
+ [tool.setuptools.packages.find]
43
+ where = ["src"]
44
+
45
+ [tool.setuptools.package-data]
46
+ masaudit = ["rules/*.json"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ """masaudit: a mobile security scanner that scales its advice to your app's risk."""
3
+
4
+ __version__ = "0.1.0"
5
+ BOOK_URL = "https://github.com/hossam9k/mobile-app-security"
6
+ REPO_URL = "https://github.com/hossam9k/masaudit"
@@ -0,0 +1,7 @@
1
+ # SPDX-License-Identifier: Apache-2.0
2
+ import sys
3
+
4
+ from masaudit.cli import main
5
+
6
+ if __name__ == "__main__":
7
+ sys.exit(main())