OWASP A02:2021 - Cryptographic Failures

Overview

Cryptographic Failures (previously known as Sensitive Data Exposure) focuses on failures related to cryptography which often leads to sensitive data exposure or system compromise. This category represents failures in protecting data both in transit and at rest.

Risk Rating: High CWE Mappings: 29 CWEs mapped to this category Prevalence: Common in applications handling sensitive data Previous Ranking: A03:2017 (Sensitive Data Exposure)

What are Cryptographic Failures?

Cryptographic failures occur when applications fail to properly protect sensitive data through inadequate or missing cryptographic controls. This includes weak encryption, poor key management, insecure protocols, and transmission of sensitive data in plaintext.

Common Vulnerabilities

1. Weak or Missing Encryption

  • Description: Use of weak cryptographic algorithms or missing encryption entirely

  • Examples: MD5, SHA1, DES, RC4, or plaintext storage

2. Insecure Data Transmission

  • Description: Sensitive data transmitted over unencrypted channels

  • Examples: HTTP instead of HTTPS, unencrypted database connections

3. Poor Key Management

  • Description: Inadequate protection of cryptographic keys

  • Examples: Hardcoded keys, weak key generation, improper key storage

4. Weak Random Number Generation

  • Description: Use of predictable or weak random number generators

  • Examples: Using rand() instead of cryptographically secure generators

5. Certificate and TLS Issues

  • Description: Improper SSL/TLS implementation

  • Examples: Invalid certificates, weak cipher suites, missing HSTS

Testing Methodology

1. Information Gathering

  • Identify data transmission methods (HTTP/HTTPS)

  • Analyze SSL/TLS implementation

  • Check for sensitive data in client-side code

  • Review cookie security attributes

2. SSL/TLS Testing

3. Certificate Analysis

4. Data Transmission Analysis

Common Attack Vectors

1. Man-in-the-Middle (MITM) Attacks

  • Exploit weak SSL/TLS configurations

  • Certificate spoofing

  • Downgrade attacks (HTTPS → HTTP)

2. Padding Oracle Attacks

  • Exploit CBC mode vulnerabilities

  • Target applications using AES-CBC incorrectly

3. Weak Hash Exploitation

4. Key Recovery Attacks

  • Extract hardcoded keys from source code

  • Exploit weak key generation algorithms

  • Side-channel attacks on key operations

Tools and Techniques

SSL/TLS Testing Tools

Cryptographic Analysis Tools

  • Hashcat: Advanced password recovery

  • John the Ripper: Password cracking

  • CyberChef: Cryptographic analysis and decoding

  • Cryptool: Educational cryptography tool

Network Analysis

Exploitation Examples

Example 1: Weak Hash Function Exploitation

Example 2: SSL/TLS Downgrade Attack

Example 3: Hardcoded Key Extraction

Example 4: CBC Padding Oracle Attack

Impact Assessment

Data at Risk

  • Personal Information: Names, addresses, SSNs, phone numbers

  • Financial Data: Credit cards, bank accounts, payment information

  • Authentication Data: Passwords, session tokens, API keys

  • Medical Records: Health information, medical history

  • Business Data: Trade secrets, intellectual property

Attack Scenarios

  1. Data Breach: Sensitive data exposed through weak encryption

  2. Session Hijacking: Weak session management leads to account takeover

  3. MITM Attacks: Unencrypted communications intercepted

  4. Credential Theft: Weak password hashing enables credential recovery

Prevention and Mitigation

1. Use Strong Cryptographic Algorithms

2. Proper SSL/TLS Configuration

3. Secure Password Hashing

4. Secure Key Management

Testing Checklist

Data Protection Assessment

Cryptographic Implementation Testing

Protocol Security Testing

Application-Level Crypto Testing

Advanced Testing Techniques

Side-Channel Analysis

Entropy Analysis

Reporting Template

Finding: Cryptographic Failure - [Specific Issue]

Severity: High/Critical CVSS Score: [Calculate based on impact]

Description: [Detailed description of the cryptographic failure]

Technical Details:

  • Algorithm Used: [e.g., MD5, DES, etc.]

  • Key Length: [if applicable]

  • Implementation: [Library/framework used]

Steps to Reproduce:

  1. [Step-by-step reproduction]

  2. [Include testing commands/scripts]

  3. [Evidence screenshots]

Proof of Concept:

Impact:

  • Data at Risk: [Types of sensitive data affected]

  • Attack Scenario: [How attacker could exploit]

  • Business Impact: [Financial/operational consequences]

Recommendation:

  1. Immediate: [Quick fixes to reduce risk]

  2. Short-term: [Proper implementation fixes]

  3. Long-term: [Architectural improvements]

References:

  • OWASP Top 10 A02:2021

  • NIST SP 800-57: Key Management

  • RFC 8446: TLS 1.3


This reference guide is part of a comprehensive OWASP Top 10 penetration testing series. For advanced cryptographic analysis techniques and automated testing tools, refer to the complete blog series.

Last updated