We have to be super careful with our client's sensitive data, including PII, financial records, and login credentials. That's a given! Sensitive Data Exposure occurs when a web application fails to protect confidential information, accidentally or intentionally. Either way, there are serious consequences. Exposed data can then be exploited by malicious actors, ranging from identity theft to financial fraud.
One way this can happen is by returning too much information in response to a user query/request. Another possibility is through the logging of unsecured or unsanitized information (in plaintext!).
There are even more vulnerabilities that can arise from sensitive data storage!
- Insecure data handling (storing, transmitting, disposing of sensitive data). Don't store data in plaintext!
- Using weak (or none at all!) encryption for sensitive data.
- Lack of access controls/allowing unauthorized access to sensitive data, or unintentionally sharing sensitive data. This could even be a security misconfiguration with excessive permissions.
- Having poor/or insufficient session management.
- Not validating input properly/enough, leaving the web application open to an injection attack.
- Using third-party libraries with vulnerabilities.
- Having easily accessible/unprotected filesystems that could be subject to malware or user attacks.
- Lack of headers that prevent browser caching.
- Lack of HTTPS on authenticated pages.
OK, I'll bite. How can we prevent it? It's really pretty easy!
- Avoid logging sensitive data! If you don't log it, you've minimized the risk of unauthorized access and a potential data breach!
- Log only what's necessary for monitoring, debugging, or auditing. You can do this with log filtering.
- Avoid logging passwords, credit card numbers, and PII!
- If you must log, use data masking (pseudonymizing).
- Or just exclude specific fields or data.
- Do not return excessive information.
- Segment and filter the data returned to users only to what they need to see, based on their permissions.
- Using strong encryption is THE BEST WAY to store sensitive data!
Learn more here about logging!
https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html#data-to-exclude