A6 Sensitive Data Exposure
A6 Sensitive Data Exposure
Many web applications do not properly protect sensitive data, such as credit cards, tax IDs, and authentication credentials. Attackers may steal or modify such weakly protected data to conduct credit card fraud, identity theft, or other crimes. Sensitive data deserves extra protection such as encryption at rest or in transit, as well as special precautions when exchanged with the browser.
The full perils of unsafe cryptography, SSL usage, and data protection are well beyond the scope of the Top 10. That said, for all sensitive data, do all of the following, at a minimum:
- Considering the threats you plan to protect this data from (e.g., insider attack, external user), make sure you encrypt all sensitive data at rest and in transit in a manner that defends against these threats.
- Don’t store sensitive data unnecessarily. Discard it as soon as possible. Data you don’t have can’t be stolen.
- Ensure strong standard algorithms and strong keys are used, and proper key management is in place. Consider using FIPS 140 validated cryptographic modules.
- Ensure passwords are stored with an algorithm specifically designed for password protection, such as bcrypt, PBKDF2, or scrypt.
- Disable autocomplete on forms collecting sensitive data and disable caching for pages that contain sensitive data.
- Cryptography Storage Cheat Sheet
6.2Â Providing Cryptographic Functionality
- Secure Cryptographic Storage Design
- Only store sensitive data that you need
- Use strong approved Authenticated Encryption
- Store a one-way and salted value of passwords
- Ensure that the cryptographic protection remains secure even if access controls fail
- Ensure that any secret key is protected from unauthorized access
- Define a key lifecycle
- Store unencrypted keys away from the encrypted data
- Use independent keys when multiple keys are required
- Protect keys in a key vault
- Document concrete procedures for managing keys through the lifecycle
- Build support for changing algorithms and keys when needed
- Document concrete procedures to handle a key compromise
- Limit quantity of data encrypted with one key
- Follow applicable regulations on use of cryptography
This article provides a simple model to follow when implementing solutions to protect data at rest.
6.3 Password Storage Cheat Sheet
- Do not limit the character set and set long max lengths for credentials
- Use a cryptographically strong credential-specific salt
- Impose infeasible verification on attacker
- Design password storage assuming eventual compromise
6.4 Transport Layer
- Â Introduction
- Transport Layer Protection Cheat Sheet Providing Transport Layer Protection with SSL/TLS
- Benefits
- Basic Requirements
- SSL vs. TLS
- When to Use a FIPS 140-2 Validated Cryptomodule
- Secure Server Design
- 2.5.1Â Rule - Use TLS for All Login Pages and All Authenticated Pages
- Use TLS on Any Networks (External and Internal) Transmitting Sensitive Data
- Do Not Provide Non-TLS Pages for Secure Content
- Do Not Mix TLS and Non-TLS Content
- Use "Secure" Cookie Flag
- Keep Sensitive Data Out of the URL
- Prevent Caching of Sensitive Data
- Use HTTP Strict Transport Security
- Use Public Key Pinning
- Server Certificate
- Use Strong Keys & Protect Them
- Use a Certificate That Supports Required Domain Names
- Use Fully Qualified Names in Certificates
- Do Not Use Wildcard Certificates
- Do Not Use RFC 1918 Addresses in Certificates
- Use an Appropriate Certification Authority for the Application's User Base
- Always Provide All Needed Certificates
- Â Be aware of and have a plan for the SHA-1 deprecation plan
- Server Protocol and Cipher Configuration
- Test your overall TLS/SSL setup and your Certificate
- Client (Browser) Configuration
- Additional Controls
- Providing Transport Layer Protection for Back End and Other Connections
- Tools
Learn More:
- OWASP Cryptographic Storage Cheat SheetÂ
- OWASP Password Storage Cheat SheetÂ
- OWASP Transport Layer Protection Cheat SheetÂ
- OWASP Testing Guide: Chapter on SSL/TLS TestingÂ
- CWE Entry 310 on Cryptographic IssuesÂ
- CWE Entry 312 onCleartextStorage of Sensitive Information
- CWE Entry 319 onCleartextTransmission of Sensitive Information
- CWE Entry 326 on Weak Encryption