Identifies and exploits insecure local data storage in Android/iOS mobile apps, including unencrypted databases, SharedPreferences, world-readable files, and Keychain/Keystore misuse. For OWASP M9 pentesting.
How this skill is triggered — by the user, by Claude, or both
Slash command
/cybersecurity-skills-zh:exploiting-insecure-data-storage-in-mobileThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
使用此技能的场景:
使用此技能的场景:
不适用于:未获授权情况下在生产用户设备上使用 —— 数据提取技术需要物理访问权限或 root/越狱权限。
Android 存储路径:
# 内部存储(应用私有,需要 root)
/data/data/<package_name>/
├── shared_prefs/ # SharedPreferences XML 文件
├── databases/ # SQLite 数据库
├── files/ # 通用文件
├── cache/ # 缓存数据
├── lib/ # 本地库
└── app_webview/ # WebView 数据
# 外部存储(旧版 Android 上全局可读)
/sdcard/Android/data/<package_name>/
# 检查全局可读文件
adb shell run-as <package_name> ls -la /data/data/<package_name>/
iOS 存储路径:
# 应用沙盒(在已越狱设备上可通过 SSH 访问)
/var/mobile/Containers/Data/Application/<UUID>/
├── Documents/ # 用户数据,默认备份
├── Library/
│ ├── Preferences/ # NSUserDefaults plist 文件
│ ├── Caches/ # 缓存数据
│ └── Application Support/
└── tmp/ # 临时文件
# 拉取 SharedPreferences 文件
adb shell run-as <package_name> cat shared_prefs/*.xml
# 或在 root 设备上
adb pull /data/data/<package_name>/shared_prefs/ ./shared_prefs/
# 搜索敏感数据
grep -ri "password\|token\|secret\|key\|session\|auth\|cookie" shared_prefs/
常见不安全存储模式:
<!-- 明文凭据 -->
<string name="user_password">mysecretpass123</string>
<string name="auth_token">eyJhbGciOiJIUzI1NiIs...</string>
<string name="api_key">sk-live-abc123def456</string>
<!-- 敏感个人身份信息(PII) -->
<string name="user_ssn">123-45-6789</string>
<string name="credit_card">4111111111111111</string>
# 拉取数据库
adb pull /data/data/<package_name>/databases/ ./databases/
# 打开并检查
sqlite3 databases/app.db
.tables
.schema users
SELECT * FROM users;
SELECT * FROM sessions;
SELECT * FROM tokens;
# 在所有表中搜索敏感列
sqlite3 databases/app.db ".dump" | grep -i "password\|token\|secret\|credit"
检查未加密的 SQLCipher 数据库:
# 如果数据库无需密码即可打开,则未加密
sqlite3 databases/app.db "SELECT count(*) FROM sqlite_master;"
# 执行成功 = 未加密(漏洞)
# 使用 Objection
objection --gadget com.target.app explore
ios keychain dump
# 检查保护级别属性
# kSecAttrAccessibleWhenUnlocked —— 适用于大多数数据
# kSecAttrAccessibleAlways —— 存在漏洞:设备锁定时仍可访问
# kSecAttrAccessibleAfterFirstUnlock —— 适用于后台应用
Android:
# 检查是否启用了备份
aapt dump badging target.apk | grep -i "allowBackup"
# android:allowBackup="true" = 漏洞
# 提取备份数据
adb backup -f backup.ab -apk <package_name>
java -jar abe.jar unpack backup.ab backup.tar
tar xvf backup.tar
# 检查提取数据中的敏感信息
# 检查外部存储
adb shell ls -la /sdcard/Android/data/<package_name>/
iOS:
# 检查备份排除设置
# Documents/ 中的文件默认备份
# 检查 NSURLIsExcludedFromBackupKey 属性
objection --gadget com.target.app explore
ios plist cat Info.plist
# 转储进程内存以查找敏感数据
objection --gadget com.target.app explore
memory search "password" --string
memory search "BEGIN RSA PRIVATE KEY" --string
memory dump all /tmp/memdump/
# Android:检查日志中的敏感数据
adb logcat -d | grep -i "password\|token\|key\|secret"
| 术语 | 定义 |
|---|---|
| SharedPreferences | Android 基于 XML 格式的键值存储;常被误用于明文存储凭据 |
| Keychain Services | iOS 安全凭据存储,在现代设备上由 Secure Enclave 硬件支持 |
| Android Keystore | Android 上由硬件支持的密码密钥存储;密钥无法从设备中提取 |
| SQLCipher | SQLite 数据库的透明加密扩展;防止在没有密码的情况下提取数据 |
| Data Protection API | iOS 文件级加密,与设备密码绑定;通过保护级别属性控制 |
npx claudepluginhub killvxk/cybersecurity-skills-zhIdentifies and exploits insecure local data storage in Android/iOS apps: unencrypted databases, world-readable files, insecure SharedPreferences, plaintext credentials, and improper keychain/keystore usage. For mobile penetration testing and OWASP M9/MASVS-STORAGE assessments.
Identifies and exploits insecure local data storage in Android/iOS apps: unencrypted databases, world-readable files, plaintext credentials, and improper keychain/keystore usage. For mobile penetration testing and OWASP M9 assessments.
Identifies and exploits insecure local data storage in Android/iOS apps including unencrypted databases, SharedPreferences, world-readable files, and keychain misuse. For mobile pentesting on OWASP M9.