Przejdź do treści
Biblioteka skilli
Bezpieczeństwo · Przegląd i audyt

mobile-security-audit

/mobile-security-audit

Przeprowadza audyt bezpieczeństwa aplikacji iOS według MASVS i zasad Secure Enclave.

Licencja
MIT
Ostatnia zmiana repozytorium
10.11.2026

Ocena i bezpieczeństwo

86/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność21 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść25 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 10.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Przeprowadza audyt bezpieczeństwa aplikacji iOS według MASVS i zasad Secure Enclave.

Oryginalny opis (EN)

Use when auditing iOS apps. Enforce Secure Enclave & MASVS.

Jak działa

  1. When to Use
  2. 1. Authentication & Hardware-Backed Key Binding
  3. 2. At-Rest Encryption & SwiftData / CoreData Storage
  4. 3. Apple Privacy Manifest (PrivacyInfo.xcprivacy)
  5. 4. Runtime Integrity & Anti-Tampering
  6. 5. PII & Financial Data Sanitization
Sekcje z nagłówków SKILL.md, w oryginale · 54 linii, 560 słów
Podgląd SKILL.md
---
name: mobile-security-audit
description: Use when auditing iOS apps. Enforce Secure Enclave & MASVS.
version: 1.0.0
author: Vanguard
license: MIT
metadata:
  hermes:
    tags: [ios, swift, security, masvs, secure-enclave, keychain]
    related_skills: [security-audit, gstack-cso]
---

# Mobile Security Audit (iOS & Swift)

Perform static and dynamic security audits for iOS applications against OWASP MASVS (Mobile Application Security Verification Standard), Apple platform security invariants, and Secure Enclave specifications.

## When to Use
- Auditing iOS / Swift applications for credential security, storage encryption, or biometrics.
- Reviewing apps handling sensitive financial data, statements, or health records on-device.
- Preparing an iOS app for App Store Review privacy manifest (`PrivacyInfo.xcprivacy`) compliance.
- Investigating runtime tampering, reverse engineering, or jailbreak bypass vulnerabilities.

## 1. Authentication & Hardware-Backed Key Binding

### Avoid Pure Boolean LocalAuthentication
- **Vulnerability**: Returning a boolean from `LAContext.evaluatePolicy` can be trivially bypassed via runtime instrumentation (Frida, Substrate, LLDB) by hooking the method to return `true`.
- **Enforcement**: Gate sensitive assets (database encryption keys, session tokens) behind Keychain items protected by Secure Enclave Access Control:
  - Access flag: `kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly` or `kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly`.
  - Access control: `SecAccessControlCreateWithFlags(kCFAllocatorDefault, ..., [.biometryCurrentSet, .devicePasscode], &error)`.
  - When keys are held in the Secure Enclave, the hardware processor itself refuses decryption unless biometrics/passcode are verified. Hooking userland code cannot extract keys.

### Detect Biometric Enrollment Tampering
- **Vulnerability**: A malicious actor with temporary device access can enroll a new fingerprint or Face ID profile in iOS Settings to bypass biometric gates.
- **Enforcement**: Check `LAContext.evaluatedPolicyDomainState`.
  - The domain state hash changes whenever the biometric database on the device is modified.
  - Store the domain state hash on first enrollment; if it differs upon subsequent unlock, invalidate session keys and force re-authentication.

## 2. At-Rest Encryption & SwiftData / CoreData Storage

### Complete File Protection (`NSFileProtectionComplete`)
- **Mechanism**: Class A encryption keys are maintained in the Secure Enclave and evicted from volatile memory the instant the screen is locked.
- **Recursive Application**: Setting `.protectionKey: FileProtectionType.complete` on a database directory only protects the directory inode, NOT existing files or newly created SQLite journal files (`.store`, `.store-wal`, `.store-shm`). Traversal must recursively apply attributes across all existing items.
- **Host Testing Pitfall**: `FileManager.setAttributes([.protectionKey: FileProtectionType.complete], ...)` throws `NSCocoaErrorDomain Code=256 / NSPOSIXErrorDomain Code=22 (EINVAL)` when executed on macOS APFS.
  - Guard Data Protection calls with `#if os(iOS)` so local test runners and CI (`swift test`) do not fail with POSIX 22 while maintaining strict protection on iOS devices.

## 3. Apple Privacy Manifest (`PrivacyInfo.xcprivacy`)

- **App Store Mandate**: Required for all iOS 17+ App Store submissions.
- **Configuration**:
  - `NSPrivacyTracking`: Set to `false` for zero-tracking / local-first apps.
  - `NSPrivacyCollectedDataTypes`: Empty array when no telemetry or cloud analytics are collected.
  - `NSPrivacyAccessedAPITypes`: Declare required reason APIs (e.g. `NSPrivacyAccessedAPICategoryFileTimestamp` with reason `C617.1` for app container cache/storage management).
- **SwiftPM Bundling**: Swift Package Manager targets must explicitly declare `resources: [.process("Resources")]` or `.copy(...)` in `Package.swift` to include `PrivacyInfo.xcprivacy` in the generated resource bundle.

## 4. Runtime Integrity & Anti-Tampering

- **Injection Detection**: Check `ProcessInfo.processInfo.environment["DYLD_INSERT_LIBRARIES"]` for injected runtime hooks.
- **Debugger Attachment**: Query `sysctl` with `[CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid()]` and verify `(info.kp_proc.p_flag & P_TRACED) == 0`.
- **Filesystem Integrity**: Check for jailbreak binaries (`/Applications/Cydia.app`, `/bin/bash`, `/usr/sbin/sshd`, Substrate dylibs) and probe sandbox write constraints against `/private/`.

## 5. PII & Financial Data Sanitization

- **Regex Bounds**: Bound repeating character classes in statement and OCR parsers to prevent ReDoS on large text payloads.
- **PII Scrubbing**: Mask Primary Account Numbers (PAN) to the last 4 digits (`•••• •••• •••• 1234`) and redact SSNs (`[REDACTED-SSN]`) before any string reaches debug logs, UI previews, or error diagnostics.

Wersje

W bazie nie ma innych skilli o nazwie mobile-security-audit.

Migawka bazy z 13.11.2026 · wersja paczki 3fc59d20b0e5 (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 1 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 90mobile-code-review
    Przegląda kod natywnych aplikacji Android i iOS pod kątem bezpieczeństwa według OWASP MASVS v2.1.0, także w pull requestach i modułach.
  • 91owasp-security
    Prowadzi przeglądy bezpieczeństwa i audyty podatności według standardów OWASP, w tym ASVS, MASVS, Kubernetes Top 10 i aplikacji agentowych, z utwardzaniem manifestów i obroną agentów LLM.
  • 100mobile-app-security-review
    Przegląda bezpieczeństwo aplikacji iOS i Android według OWASP MASVS i MASTG przed wydaniem, na autoryzowanych buildach testowych.
  • 100security-requirements
    Definiuje wymagania bezpieczeństwa aplikacji wg OWASP ASVS 5.0 i MASVS, zamienia je w kryteria akceptacji i testy.
  • 100swift-security
    Zabezpiecza dane w aplikacjach Apple: Keychain, uwierzytelnianie biometryczne przez LAContext, CryptoKit, przypinanie certyfikatów i wymagania MASVS.
  • 100swift-security
    Obejmuje bezpieczeństwo iOS i macOS w aplikacji fintech: Keychain, LocalAuthentication z Face ID i Touch ID, CryptoKit, klucze Secure Enclave i bezpieczne przechowywanie tokenów.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.