Platform Usage / Sensitive Information in Local Storage

Web and API


Sensitive information in local storage is a vulnerability, which allows attackers to gain unauthorized access to sensitive information stored on a user’s local storage. This vulnerability can be found in web and API applications and is identified by the CWE-312: Cleartext Storage of Sensitive Information in a Local File. The OWASP Testing Guide provides guidance on detecting this vulnerability.


The risk posed by this vulnerability is high. Attackers can gain access to sensitive information by exploiting this vulnerability, which can be used for malicious activities. This could lead to financial losses, reputation damage, and other serious consequences.


The best way to prevent this vulnerability is to encrypt the sensitive information stored on the user’s local storage. This ensures that the data is secure and only authorized personnel can access it. Additionally, developers should also implement measures to prevent the leakage of sensitive information in the form of log files and other sources.


The following example demonstrates the usage of the Cipher class in Java to encrypt and decrypt sensitive information stored on the local storage.

Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] encryptedData = cipher.doFinal(dataToEncrypt);

Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, secretKey);
byte[] decryptedData = cipher.doFinal(encryptedData);

Curious? Convinced? Interested?

Arrange a no-obligation consultation with one of our product experts today.