feat(sast): Android and iOS app analysis with mobsfscan (#442)
This commit was merged in pull request #442.
This commit is contained in:
1 parent
82736a1eec
commit
a9ca31d60c
29 files changed
+964
-15
No files matched your search
@@ -27,6 +27,7 @@ For the **CRA** framework (40 controls) the split is **21 covered · 0 needs_too
|
||||
- **Custom semgrep detectors**, shipped in the binary and matched back to controls **by rule id** so a broad CWE can't over-attribute:
|
||||
- for Python and JavaScript/TypeScript: `cra-ai-1`, `7`, `10`, `14` (secure-by-default, weak password hashing, insecure session cookies, weak data-at-rest ciphers), `cra-ai-20` (shell commands and SQL built from variables, request input echoed into a response), `cra-ai-8` (hard-coded credentials, Python) and `cra-ai-15` (plain `http://` requests);
|
||||
- for C and C++ firmware: `cra-ai-8`, `13`, `16`, `20` (hard-coded credentials including `#define` macros, broken hash/cipher, `rand()`, unbounded string functions and non-literal format strings), next to cppcheck for memory safety.
|
||||
- **mobsfscan** for Android and iOS apps, bound **by CWE** (a mobsfscan binding only ever attaches mobsfscan findings): `cra-ai-1` (debuggable, exported components, outdated `minSdkVersion`), `7`, `8`, `9`, `13`, `14`, `15` (cleartext, TLS, App Transport Security), `16` and `20`. Each binding lists only the languages mobsfscan has rules for under those CWEs, so `cra-ai-1` covers Java and Kotlin (its manifest checks) but not Swift.
|
||||
- **8 grounded surface checks** (`cra-ai-6`, `11`, `12`, `24`, `27`, `28`, `29`, `30`): the absence-based controls (no rate limiting, no security logging, no update-signature check…) that have no syntactic pattern.
|
||||
- **Marked not_code_checkable** (`cra-ai-2`, `3`, `4`, `5`, among the 19): minimal attack surface, secure architecture, least privilege, tamper protection.
|
||||
|
||||
@@ -34,7 +35,7 @@ For the **CRA** framework (40 controls) the split is **21 covered · 0 needs_too
|
||||
|
||||
Each binding in the control map names the **languages** its rules run on (`languages`, empty for language-independent tools such as gitleaks, syft and osv). A test keeps these in step with the rule pack. Each scan run records the source languages it saw outside vendor code (`ScanRun.languages`).
|
||||
|
||||
The CRA status calls a covered control **"no violation found"** only when one of its bindings applies to those languages *and* no tool it relies on failed in that scan (a skipped `sast`, `sast_c_cpp` or `cve_lookup` stage). Otherwise the control is **not assessed**, with the reason: not scanned yet, no rule for the languages found, a tool that did not complete, or languages unknown (a run from before they were recorded). A C-only firmware repo therefore never reads "no violation found" for controls only Python rules check (#368, #387).
|
||||
The CRA status calls a covered control **"no violation found"** only when one of its bindings applies to those languages *and* no tool it relies on failed in that scan (a skipped `sast`, `sast_c_cpp`, `sast_mobile` or `cve_lookup` stage). Otherwise the control is **not assessed**, with the reason: not scanned yet, no rule for the languages found, a tool that did not complete, or languages unknown (a run from before they were recorded). A C-only firmware repo therefore never reads "no violation found" for controls only Python rules check (#368, #387).
|
||||
|
||||
At scale, the **master-controls** corpus (breakpilot's deduped clusters, exported as OSCAL) currently provides **~2,882 code-checkable controls** (2,143 `network` + 739 `source_code`), matched semantically.
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ names while the scan runs.
|
||||
- *Firmware analysieren* -- for firmware, lists the libraries and toolchain the build uses.
|
||||
2. **Static code analysis** (*Statische Codeanalyse*) -- Semgrep with
|
||||
Prüfwerk's own rules (Python, JavaScript/TypeScript, C and C++; see
|
||||
[Tools](/reference/tools)); for C and C++ also cppcheck, which follows values through the code
|
||||
[Tools](/reference/tools)); for Android and iOS apps mobsfscan (code,
|
||||
AndroidManifest and Info.plist); for C and C++ also cppcheck, which follows values through the code
|
||||
(out-of-bounds writes, uninitialised reads, null dereferences). Vendor and
|
||||
third-party code (HAL, CMSIS, vendored libraries) is left out of the code
|
||||
findings and listed under **Nicht ausgeführt**; it stays in the SBOM.
|
||||
|
||||
@@ -33,6 +33,32 @@ finds the defects that matter in firmware: out-of-bounds writes, uninitialised
|
||||
reads, null dereferences and leaks. It parses the code and never runs it. Its
|
||||
findings are **Codeanalyse (SAST)** findings with the tool name `cppcheck`.
|
||||
|
||||
## mobsfscan -- Android and iOS Apps
|
||||
|
||||
[mobsfscan](https://github.com/MobSF/mobsfscan) (LGPL-3.0, used unchanged) runs
|
||||
on trees with Java, Kotlin, Swift or Objective-C code. It checks the code and
|
||||
the app settings:
|
||||
|
||||
- **AndroidManifest.xml:** `debuggable`, `allowBackup`, cleartext traffic, an
|
||||
outdated `minSdkVersion`, exported components, task hijacking.
|
||||
- **Info.plist:** App Transport Security exceptions (`NSAllowsArbitraryLoads`).
|
||||
- **Code:** WebViews with a JavaScript bridge or ignored TLS errors, weak hashes
|
||||
and ciphers, ECB mode and static IVs, `java.util.Random` for security,
|
||||
world-readable storage, trust-all certificate handling, command and SQL
|
||||
injection, unsafe deserialisation, sensitive data in logs.
|
||||
|
||||
Each finding carries its CWE and the OWASP MASVS requirement. mobsfscan runs
|
||||
once with the Android and once with the iOS rules when a repository holds both
|
||||
apps (React Native, Flutter); on its own it would check such a repository as
|
||||
Android only. It runs on the same Semgrep engine with metrics off, never reads
|
||||
a `.mobsf` file from your repository, and skips `Pods/`, `build/`, `.gradle/`,
|
||||
`DerivedData/`, `Carthage/` and `node_modules/`. Its findings are
|
||||
**Codeanalyse (SAST)** findings with the tool name `mobsfscan`.
|
||||
|
||||
Not reported: the app-wide "missing protection" hints (no certificate pinning,
|
||||
no root or jailbreak detection, no screenshot protection). They name no place in
|
||||
the code and are heuristics. Dart code (Flutter) has no rules yet.
|
||||
|
||||
## Vendor Code Exclusion
|
||||
|
||||
Firmware projects carry their silicon vendor's SDK (HAL, CMSIS, board support)
|
||||
|
||||
Reference in new issue
Block a user