본문으로 건너뛰기
cccskills
무료GitHub에 공개

mobile-insecure-storage

Detects sensitive data stored insecurely on mobile devices (Android/iOS). Trigger on: SharedPreferences, NSUserDefaults, SQLite, Room DB, DataStore, Core Data, Keychain misconfiguration, external storage, backup exposure, plaintext files, unencrypted databases, adb backup, iCloud backup, NSFileProtection, EncryptedSharedPreferences, SQLCipher, allowBackup, FLAG_SECURE, keyboard cache, sensitive logs. Covers MASVS-STORAGE-1 (local storage) and MASVS-STORAGE-2 (exposure to unauthorized actors).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md7.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Mobile Insecure Data Storage

What Is Broken and Why

Mobile apps often store sensitive data (credentials, tokens, PII, keys) in locations accessible to other apps, backups, or physical device extraction. Android's SharedPreferences and iOS's NSUserDefaults are plaintext XML/plist files readable with root/jailbreak. External storage is world-readable. Backups (ADB/iCloud) can expose the entire app sandbox unless explicitly excluded. Logging APIs persist sensitive data in system logs readable by other apps. The attacker gains access to credentials or session tokens without ever touching the backend.

Key Signals

  • allowBackup="true" in AndroidManifest.xml without fullBackupContent exclusion rules
  • SharedPreferences files in /data/data/<pkg>/shared_prefs/ containing tokens, passwords, or keys
  • SQLite databases in the app sandbox without SQLCipher encryption
  • Files in /sdcard/ or getExternalStorageDirectory() containing sensitive content
  • iOS files lacking NSFileProtectionComplete data protection class
  • Keychain items with kSecAttrAccessibleAlways or no accessibility constraints
  • Log statements (Log.d, NSLog, print) containing session tokens or user data
  • Input fields without inputType="textPassword" or secureTextEntry=true
  • App switcher screenshots capturing password or payment screens

Methodology

Android:

  1. Decompile APK: apktool d app.apk — review AndroidManifest.xml for allowBackup, fullBackupContent
  2. Pull sandbox via ADB: adb backup -f backup.ab -noapk <pkg> → extract with android-backup-extractor
  3. Inspect /data/data/<pkg>/ (rooted): shared_prefs/, databases/, files/
  4. Check SharedPreferences XML for plaintext credentials or tokens
  5. Open SQLite databases: sqlite3 app.db .dump — look for unencrypted sensitive tables
  6. Search for external storage usage: grep -r "getExternalStorage" in decompiled source
  7. Check for sensitive log output: adb logcat | grep -i "password\|token\|secret\|key"
  8. Use objection: android hooking list activities → android clipboard monitor

iOS:

  1. Pull IPA and extract app bundle; examine Info.plist for NSAllowsArbitraryLoads
  2. Use iMazing or ideviceinstaller to pull app sandbox data
  3. Check Data Protection class on files: objection --gadget TARGET run ios filesystem list
  4. Inspect NSUserDefaults: <uuid>.plist in Library/Preferences
  5. Check Keychain: objection run ios keychain dump
  6. Dynamic: Frida hook NSFileManager writeToFile to observe Data Protection class used
  7. Background the app — screenshot the app switcher for sensitive data capture

Payloads & Tools

# Android — pull and extract backup
adb backup -f backup.ab -noapk TARGET_PKG
java -jar abe.jar unpack backup.ab backup.tar
tar xvf backup.tar

# Android — inspect SharedPreferences (rooted)
adb shell "cat /data/data/TARGET_PKG/shared_prefs/*.xml"

# Android — check logcat for leaks
adb logcat | grep -iE "password|token|secret|api.?key|session|auth"

# iOS — Frida: dump NSUserDefaults
frida -U TARGET -e "ObjC.classes.NSUserDefaults.standardUserDefaults().dictionaryRepresentation()"

# iOS — objection: keychain dump
objection --gadget TARGET run ios keychain dump

# iOS — check Data Protection class
frida -U TARGET -l data_protection_check.js

Bypass Techniques

  • Backup extraction without root — ADB backup works on non-rooted devices if allowBackup=true
  • Keychain extraction on jailbroken device — Keychain items without kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly survive device-to-device migration
  • Memory scraping — even encrypted storage decrypts into memory; dump process memory with gcore or Frida memory scanner
  • Log persistence — adb logcat -d captures prior log buffer; sensitive data logged before crash is preserved

Exploitation Scenarios

Scenario 1 — ADB Backup Token Theft Setup: App stores JWT in SharedPreferences, allowBackup=true. → Trigger: Attacker with USB access runs adb backup. → Impact: Extracts valid session token, authenticates to backend as victim.

Scenario 2 — External Storage Credential Exposure Setup: App writes exported reports to getExternalStorageDirectory(). → Trigger: Malicious app with READ_EXTERNAL_STORAGE reads the files. → Impact: PII and embedded tokens from reports leaked to third-party app.

Scenario 3 — iOS Keychain Accessible After Reboot Setup: App stores password in Keychain with kSecAttrAccessibleAlways. → Trigger: Attacker with physical device access extracts Keychain via jailbreak. → Impact: Password retrieved even when device is locked/rebooted.

False Positives

  • SharedPreferences containing non-sensitive config (theme, language preference)
  • SQLite databases storing only public content (cached news articles, offline maps)
  • Keychain items scoped to the correct access control group — confirm accessibility attribute
  • Log output in debug builds only — verify the production build strips debug logs

Fix Patterns

// Android — encrypted SharedPreferences
val masterKey = MasterKey.Builder(context).setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build()
val prefs = EncryptedSharedPreferences.create(context, "secure_prefs", masterKey,
    EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
    EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM)

// Android — exclude from backup
// res/xml/backup_rules.xml
// <exclude domain="sharedpref" path="." />
// iOS — Keychain with strict access control
let access = SecAccessControlCreateWithFlags(nil, kSecAttrAccessibleWhenPasscodeSetThisDeviceOnly,
    .userPresence, nil)
// iOS — exclude file from backup
var url = URL(fileURLWithPath: sensitiveFilePath)
try url.setResourceValues({ v in v.isExcludedFromBackup = true }())

Related Skills

[[mobile-weak-crypto]] is the direct mitigation path: data that must be stored locally should be protected using properly implemented cryptography with keys in the Android Keystore or iOS Secure Enclave. [[mobile-auth-bypass]] overlaps when insecure storage holds auth tokens — a stolen JWT from SharedPreferences enables direct backend access without triggering biometric checks. [[mobile-resilience]] controls (root/jailbreak detection) are the last line of defense if storage protections fail, since extraction typically requires root or jailbreak access.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Exploit pervasive logical flaws in Multi-Factor Authentication (MFA/2FA) implementations to bypass the secondary authentication challenge entirely. Techniques include response manipulation, referal spoofing, token reuse, and predictable backup codes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Complete PortSwigger deep-dive with exact payloads for every lab variant including zero-day techniques

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

Execute AS-REP Roasting to extract and crack the NTLM hashes of Active Directory user accounts that have the "Do not require Kerberos preauthentication" flag explicitly enabled. This attack generates a recoverable Ticket Granting Ticket (TGT) without requiring the attacker to authenticate first.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ShulkwiSEC/bb-huge232026년 7월 11일 업데이트

ShulkwiSEC의 스킬 모두 보기

이 스킬의 문제 신고