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.
OWASP Top 10 Mapping
This testing category relates to the following OWASP Top 10 2021 categories:
Quick Reference
| Test ID | Name | CWEs | Difficulty |
|---|---|---|---|
| WSTG-CRYP-01 | Weak TLS Testing | CWE-326, CWE-327 | Advanced |
| WSTG-CRYP-02 | Padding Oracle Testing | CWE-327, CWE-347 | Advanced |
| WSTG-CRYP-03 | Unencrypted Channel Testing | CWE-319, CWE-311 | Advanced |
| WSTG-CRYP-04 | Weak Encryption Testing | CWE-327, CWE-326, CWE-261 | Advanced |
Detailed Test Cases
WSTG-CRYP-01: Weak TLS Testing
AdvancedThis 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.
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
WSTG-CRYP-02: Padding Oracle Testing
AdvancedThis 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.
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
WSTG-CRYP-03: Unencrypted Channel Testing
AdvancedThis 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.
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)
WSTG-CRYP-04: Weak Encryption Testing
AdvancedThis 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.
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
Relevant Certifications
The following certifications cover cryptography concepts:
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 →