Mobile Traffic Inspection

Intercepting mobile app traffic revealed hardcoded API keys, insecure data storage, and lack of certificate pinning.

Overview

Mobile applications often communicate with backend APIs to send and receive data. Without proper security controls, this traffic can be intercepted, modified, or analyzed by attackers, leading to data breaches, account takeover, and API abuse.

Type: Insecure Communication
Affected: Android & iOS Applications
Impact: Data exposure, API key theft
CVSS: 8.8 (Critical)

The Vulnerability

During mobile application security assessments, we discovered that many apps lack basic security controls for network communication. By setting up a proxy and installing a custom CA certificate, we could intercept all HTTPS traffic between the mobile app and its backend servers.

Technical Details

The main issues identified were:

// Hardcoded API keys found in decompiled app public class APIConfig { public static final String API_KEY = "sk_live_1234567890abcdef"; public static final String SECRET = "supersecretkey123"; public static final String DATABASE_URL = "mongodb://admin:password@cluster.mongodb.net"; }

Attack Scenario

// Intercepted traffic showing sensitive data POST /api/login HTTP/1.1 Host: api.vulnerable-app.com Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... { "userId": "user_12345", "email": "victim@example.com", "creditCard": "4111111111111111", "cvv": "123", "apiKey": "sk_live_abcdef123456" }

Real-World Impact

Root Cause

Remediation

// Secure implementation with certificate pinning // Android Network Security Config <network-security-config> <domain-config> <domain includeSubdomains="true">api.secure-app.com</domain> <pin-set> <pin digest="SHA-256">base64EncodedPublicKey1=</pin> <pin digest="SHA-256">base64EncodedPublicKey2=</pin> </pin-set> </domain-config> </network-security-config> // Secure API key storage (Android Keystore) KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); SecretKey key = (SecretKey) keyStore.getKey("api_key", null);

Timeline

Test your mobile app security