🔐 WSTG-CRYP: Cryptography

OWASP Web Security Testing Guide v4.2

By FixTheVuln Team Sources: OWASP WSTG v4.2
← OWASP WSTG Guide

Cryptography is the backbone of data protection in web applications, securing everything from login credentials to payment information. This category tests whether the application uses strong, properly configured encryption for data in transit (TLS/SSL) and at rest, and whether cryptographic implementations are free from known weaknesses like padding oracle attacks. Testing cryptography requires understanding both the protocols in use and the common implementation mistakes that weaken them. Weak TLS configurations, deprecated cipher suites, and improper certificate validation are among the most commonly found issues. These vulnerabilities directly impact compliance with standards like PCI DSS, HIPAA, and GDPR, making cryptography testing essential for both security assessments and regulatory audits.

Difficulty: Advanced 4 test cases

OWASP Top 10 Mapping

This testing category relates to the following OWASP Top 10 2021 categories:

A02

Quick Reference

Test ID Name CWEs Difficulty
WSTG-CRYP-01Weak TLS TestingCWE-326, CWE-327Advanced
WSTG-CRYP-02Padding Oracle TestingCWE-327, CWE-347Advanced
WSTG-CRYP-03Unencrypted Channel TestingCWE-319, CWE-311Advanced
WSTG-CRYP-04Weak Encryption TestingCWE-327, CWE-326, CWE-261Advanced

Detailed Test Cases

WSTG-CRYP-01: Weak TLS Testing

Advanced

This test evaluates the TLS/SSL configuration of the application including supported protocol versions, cipher suites, certificate validity, and key exchange mechanisms. Weak transport security allows attackers to intercept, decrypt, or modify data in transit.

Why it matters: Transport layer security is the primary protection for data in transit between users and the application. Weak TLS configurations expose sensitive data to network-level attacks including eavesdropping, man-in-the-middle attacks, and protocol downgrade attacks like POODLE and BEAST.

What to Check

  • Verify that only TLS 1.2 and TLS 1.3 are supported (no SSL 3.0, TLS 1.0, or TLS 1.1)
  • Check for weak cipher suites (RC4, DES, 3DES, export ciphers, NULL ciphers)
  • Validate certificate chain, expiration, and revocation status
  • Test for known TLS vulnerabilities (POODLE, BEAST, Heartbleed, CRIME, BREACH)
  • Verify that perfect forward secrecy (PFS) cipher suites are preferred
Tools: testssl.sh SSL Labs Nmap ssl-enum-ciphers sslyze OpenSSL s_client
CWE-326 CWE-327

WSTG-CRYP-02: Padding Oracle Testing

Advanced

This test checks whether the application is vulnerable to padding oracle attacks by analyzing how it responds to modified ciphertext. If the application reveals whether decryption padding is valid (through error messages or timing differences), attackers can decrypt ciphertext without the key.

Why it matters: Padding oracle attacks can decrypt any data encrypted with CBC-mode block ciphers when the application leaks padding validation results. This has been exploited in real-world attacks against ASP.NET, Java applications, and custom encryption implementations to steal session tokens, decrypt cookies, and forge encrypted data.

What to Check

  • Identify encrypted values in cookies, URL parameters, or hidden form fields
  • Modify encrypted values and observe error response differences
  • Measure response time differences between valid and invalid padding
  • Test encrypted session tokens for padding oracle vulnerabilities
  • Check if the application uses CBC mode without authenticated encryption
Tools: PadBuster Burp Suite Custom scripts POET
CWE-327 CWE-347

WSTG-CRYP-03: Unencrypted Channel Testing

Advanced

This test checks whether sensitive data such as credentials, personal information, payment details, or session tokens are transmitted over unencrypted HTTP connections. Even applications with HTTPS may have pages or API endpoints that fall back to HTTP.

Why it matters: Sensitive data transmitted over HTTP is visible to anyone who can observe network traffic, including users on the same Wi-Fi network, ISPs, and anyone with access to network infrastructure. This is trivially exploitable with freely available tools like Wireshark.

What to Check

  • Verify that all pages handling sensitive data are served exclusively over HTTPS
  • Check for mixed content where HTTPS pages load resources over HTTP
  • Test whether login forms can be accessed and submitted over HTTP
  • Verify that API endpoints transmitting sensitive data require HTTPS
  • Check for HTTP links in emails sent by the application (password reset, verification)
Tools: Burp Suite Wireshark Browser Developer Tools curl
CWE-319 CWE-311

WSTG-CRYP-04: Weak Encryption Testing

Advanced

This test evaluates whether the application uses strong, current encryption algorithms and proper key management for data at rest. Weak encryption includes deprecated algorithms (DES, RC4, MD5), insufficient key lengths, hardcoded keys, and improper use of cryptographic primitives.

Why it matters: Weak encryption provides a false sense of security. Data encrypted with broken algorithms or short keys can be decrypted by attackers with moderate resources. Hardcoded encryption keys found in source code or configuration files compromise all data encrypted with those keys.

What to Check

  • Identify encryption algorithms used for data at rest (passwords, PII, payment data)
  • Verify that passwords use adaptive hashing algorithms (bcrypt, Argon2, scrypt) not MD5/SHA-1
  • Check for hardcoded encryption keys in source code or configuration files
  • Verify that key lengths meet current recommendations (AES-256, RSA-2048 minimum)
  • Test for use of ECB mode which leaks data patterns in encrypted output
Tools: Custom code review Burp Suite hashID John the Ripper CyberChef
CWE-327 CWE-326 CWE-261

Relevant Certifications

The following certifications cover cryptography concepts:

Security+CISSPCEH

Frequently Asked Questions

What are the most common cryptographic weaknesses in web applications?

The most common weaknesses include using deprecated TLS versions (TLS 1.0, 1.1, SSL 3.0), weak cipher suites (RC4, DES, export ciphers), missing HSTS headers, improper certificate validation, transmitting sensitive data over HTTP, and using weak hashing algorithms (MD5, SHA-1) for passwords instead of purpose-built password hashing functions like bcrypt or Argon2.

What is a padding oracle attack and how does it work?

A padding oracle attack exploits applications that reveal whether the padding of an encrypted message is valid through different error messages or response times. By systematically modifying ciphertext bytes and observing the application's response, an attacker can decrypt the entire message without knowing the key. Prevention requires using authenticated encryption (like AES-GCM) and ensuring consistent error responses.

How does cryptography testing relate to compliance requirements like PCI DSS?

PCI DSS mandates strong cryptography for transmitting and storing cardholder data, requiring TLS 1.2 or higher, prohibiting weak ciphers, and mandating proper key management. HIPAA requires encryption of electronic protected health information, and GDPR expects encryption as a technical measure for data protection. Failing cryptography tests often means failing compliance audits as well.

CyberFolio

Mastering web security testing? Showcase your skills.

Build a free, shareable cybersecurity portfolio that highlights your certifications, projects, and skills.

Build Your Portfolio →

Related WSTG Categories

WSTG-INFO
Information Gathering
WSTG-CONF
Configuration and Deployment Management
WSTG-IDNT
Identity Management
WSTG-ATHN
Authentication Testing
← Back to Home ← All WSTG Categories