Back

M01: Improper Credential Usage - Overview

Table of Contents

What is Improper Credential Usage?

Improper Credential Usage occurs when mobile applications store, transmit, or use authentication credentials (passwords, API keys, tokens, certificates) insecurely. This includes hardcoding credentials in source code, storing them in plain text, or exposing them through logs and error messages.

Mobile applications often require credentials for various purposes:

Core Concept

Unlike traditional web applications, mobile apps are distributed binaries that run on potentially compromised devices. This creates unique challenges:

``

Mobile App Binary → Installed on User Device → Potentially Reverse Engineered

Contains Hardcoded API Keys → Extracted by Attacker → Used to Access Backend

Backend Systems Compromised

``

Key Vulnerability Points

  1. Hardcoded Credentials: Embedding secrets directly in application code
  2. Insecure Local Storage: Storing credentials in plain text on device
  3. Logging Sensitive Data: Writing credentials to application logs
  4. Transmission Issues: Sending credentials over insecure channels
  5. Backup Exposure: Including credentials in device backups

Why Does This Matter?

The Business Impact

The Technical Impact

Technical Context

Mobile-Specific Challenges

Binary Distribution: Device Storage: Platform Differences:

| Platform | Storage Mechanism | Risks |

|----------|------------------|-------|

| Android | SharedPreferences, Internal Storage, SQLite | Accessible on rooted devices, backup exposure |

| iOS | Keychain, UserDefaults, CoreData | Accessible on jailbroken devices, iCloud backup sync |

Attack Surface

  1. Static Analysis: Decompiling app to find hardcoded secrets
  2. Dynamic Analysis: Runtime inspection of memory and storage
  3. Network Interception: Capturing credentials in transit
  4. Backup Analysis: Extracting data from device backups
  5. Log Analysis: Finding credentials in system or app logs

Real-World Impact

Case Study 1: Mobile Banking App

Incident: A popular banking app hardcoded an API key for their backend services. Impact: Cost: $15 million in incident response, regulatory fines, and customer compensation

Case Study 2: Ride-Sharing Application

Incident: App stored user credentials in plain text on device. Impact: Cost: $8 million settlement, complete redesign of authentication system

Case Study 3: Social Media Platform

Incident: OAuth tokens stored without encryption in app's shared preferences. Impact: Cost: 2.3 million compromised accounts, $20 million in remediation

Prevalence and Statistics

Industry Research Findings

Verizon Mobile Security Index 2023: OWASP Mobile Security Testing Guide: Common Vulnerabilities:

Common Misunderstandings

❌ Myth 1: "Obfuscation Protects Credentials"

Reality: Obfuscation is not encryption. Hardcoded credentials can still be extracted with reverse engineering tools, just with slightly more effort.

❌ Myth 2: "Only Android Apps Are Vulnerable"

Reality: iOS apps are equally vulnerable. While the App Store review process may catch some issues, IPA files can be analyzed just like APKs.

❌ Myth 3: "Environment Variables Are Secure"

Reality: Build-time environment variables end up compiled into the binary. They're not secure for sensitive credentials.

❌ Myth 4: "Users Won't Root/Jailbreak Their Devices"

Reality: According to research, 10-15% of Android devices are rooted, and 5-10% of iOS devices are jailbroken. That's millions of potentially vulnerable users.

❌ Myth 5: "Our App Isn't Important Enough to Target"

Reality: Automated tools scan thousands of apps daily looking for exposed credentials. Attacks are often opportunistic, not targeted.

The Mobile Security Difference

Why This Is Worse on Mobile

| Aspect | Web Applications | Mobile Applications |

|--------|-----------------|---------------------|

| Code Access | Server-side, not accessible | Binary distributed to users |

| Storage | Server-controlled | User device, potentially compromised |

| Updates | Instant deployment | User must download update |

| Control | Full control over environment | No control over user device |

| Analysis | Can't decompile backend | Easy to decompile app |

Defense Complexity

Mobile applications must defend against:

What's Next?

Now that you understand the importance and impact of improper credential usage:

  1. Attack Vectors: Learn how attackers discover and exploit credential issues
  2. Prevention: Implement secure credential management practices
  3. Examples: See vulnerable vs secure code patterns
  4. Lab: Practice identifying and fixing credential issues

Key Takeaways

Never hardcode credentials in mobile application source code

Always use platform-provided secure storage (Keychain/KeyStore)

Implement proper encryption for any stored credentials

Avoid logging sensitive information at all costs

Use certificate pinning for API communications

Implement secure token refresh mechanisms

Regular security audits of credential handling

Assume the device is compromised when designing security

---

Remember: In mobile security, credentials are the keys to the kingdom. Protect them accordingly. Part of OWASP Mobile Top 10 - Educational Repository