Fundamentos Testing Seguridad Móvil
Testing seguridad apps móviles valida protección datos, comunicación segura, autenticación y resistencia a ingeniería inversa.
OWASP Mobile Top 10
- Improper Platform Usage
- Insecure Data Storage
- Insecure Communication
- Insecure Authentication
- Insufficient Cryptography
Testing Seguridad iOS
Almacenamiento Inseguro Datos (iOS)
// INSEGURO: UserDefaults (texto plano)
UserDefaults.standard.set("token", forKey: "auth_token")
// SEGURO: Keychain
func saveToKeychain(key: String, value: String) {
let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecAttrAccount as String: key,
kSecValueData as String: value.data(using: .utf8)!
]
SecItemAdd(query as CFDictionary, nil)
}
Certificate Pinning (iOS)
func urlSession(
_ session: URLSession,
didReceive challenge: URLAuthenticationChallenge,
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void
) {
let pinnedHash = "sha256_hash"
let serverHash = serverCertificateData.sha256()
if serverHash == pinnedHash {
completionHandler(.useCredential, URLCredential(trust: serverTrust))
}
}
Testing Seguridad Android
Almacenamiento Inseguro (Android)
// INSEGURO: SharedPreferences
val prefs = getSharedPreferences("prefs", MODE_PRIVATE)
prefs.edit().putString("token", "sensitive").apply()
// SEGURO: EncryptedSharedPreferences
val masterKey = MasterKey.Builder(context)
.setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
.build()
val encryptedPrefs = EncryptedSharedPreferences.create(
context, "secure_prefs", masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
Testing con Frida
# Instalar Frida
pip install frida-tools
# Listar apps
frida-ps -U
# Bypass detección root
frida -U -l bypass-root.js -f com.example.app
Análisis Estático
# Decompile APK
apktool d app.apk
# Buscar secretos hardcoded
grep -r "api_key" decompiled/
Conclusión
Testing seguridad apps móviles requiere conocimiento específico de plataforma y herramientas especializadas. Combinar análisis estático, testing dinámico y manipulación runtime permite identificar vulnerabilidades antes de que atacantes las exploten.