CWE-312: Cleartext Storage of Sensitive Information
The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.
Last updated
The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.
Last updated
CWE-312 (Cleartext Storage of Sensitive Information) is a base-level software weakness catalogued by MITRE in the Common Weakness Enumeration (CWE). It describes a recurring type of mistake that can lead to exploitable security vulnerabilities.
770 recorded CVEs are caused by CWE-312 (Cleartext Storage of Sensitive Information), including 2 in CISA's KEV (Known Exploited Vulnerabilities) catalog. KEVs are shown first. 145 new CWE-312 CVEs have been recorded so far in 2026 (94 in 2025).
Strapi leaking sensitive user information by filtering on private fields
D-Link DIR-300 Router Cleartext Storage of a Password Vulnerability
Plaintext Passwords Vulnerability in BLUVOYIX
Rancher: Exposure of sensitive fields
Rancher: Plaintext storage and exposure of credentials in Rancher API and cluster.management.cattle.io object
C•CURE 9000 and victor Video Management System - Cleartext storage of user credentials upon installation or upgrade of software.
Query Console SQL Injection Leading to Sensitive Data Disclosure in Bilin Software's HUMANIST Digital Human Resources
Use of Cleartext credentials in Sage 200 Spain
Showing 12 of 770 recorded CWE-312 CVEs. Get an alert for each new one, with AI-written analysis and fixes.
Monitor these CVEsWhat can happen when CWE-312 is exploited.
Read Application Data
Affects: Confidentiality
An attacker with access to the system could read sensitive information stored in cleartext (i.e., unencrypted). Even if the information is encoded in a way that is not human-readable, certain techniques could determine which encoding is being used, then decode the information.
Typically introduced during these phases of the software lifecycle.
Languages
Technologies
Practical mitigations for CWE-312, grouped by where in the lifecycle they apply.
In some systems/environments such as cloud, the use of "double encryption" (at both the software and hardware layer) might be required, and the developer might be solely responsible for both layers, instead of shared responsibility with the administrator of the broader system/environment.
Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Effectiveness: High
MITRE examples of the weakness in code.
The following code excerpt stores a plaintext user account ID in a browser cookie.
Vulnerable example
response.addCookie( new Cookie("userAccountID", acctID);Because the account ID is in plaintext, the user's account information is exposed if their computer is compromised by an attacker.
This code writes a user's login information to a cookie so the user does not have to login again later.
Vulnerable example
function persistLogin($username, $password){
$data = array("username" => $username, "password"=> $password);
setcookie ("userdata", $data);
}The following code attempts to establish a connection, read in a password, then store it to a buffer.
Vulnerable example
server.sin_family = AF_INET; hp = gethostbyname(argv[1]);
if (hp==NULL) error("Unknown host");
memcpy( (char *)&server.sin_addr,(char *)hp->h_addr,hp->h_length);
if (argc < 3) port = 80;
else port = (unsigned short)atoi(argv[3]);
server.sin_port = htons(port);
if (connect(sock, (struct sockaddr *)&server, sizeof server) < 0) error("Connecting");
...
while ((n=read(sock,buffer,BUFSIZE-1))!=-1) {
write(dfd,password_buffer,n);
...While successful, the program does not encrypt the data before writing it to a buffer, possibly exposing it to unauthorized actors.
The following examples show a portion of properties and configuration files for Java and ASP.NET applications. The files include username and password information but they are stored in cleartext.
Vulnerable example
# Java Web App ResourceBundle properties file
...
webapp.ldap.username=secretUsername
webapp.ldap.password=secretPassword
...Vulnerable example
...
<connectionStrings>
<add name="ud_DEV" connectionString="connectDB=uDB; uid=db2admin; pwd=password; dbalias=uDB;" providerName="System.Data.Odbc" />
</connectionStrings>
...In 2022, the OT:ICEFALL study examined products by 10 different Operational Technology (OT) vendors. The researchers reported 56 vulnerabilities and said that the products were "insecure by design" [4]. If exploited, these vulnerabilities often allowed adversaries to change how the products operated, ranging from denial of service to changing the code that the products executed. Since these products were often used in industries such as power, electrical, water, and others, there could even be safety implications.
At least one OT product stored a password in plaintext.
In 2021, a web site operated by PeopleGIS stored data of US municipalities in Amazon Web Service (AWS) Simple Storage Service (S3) buckets.
Vulnerable example
A security researcher found 86 S3 buckets that could be accessed without authentication (CWE-306) and stored data unencrypted (CWE-312). These buckets exposed over 1000 GB of data and 1.6 million files including physical addresses, phone numbers, tax documents, pictures of driver's license IDs, etc. [6] [5]
Safe example
The sensitive information could have been protected by ensuring that the buckets did not have public read access, e.g., by enabling the s3-account-level-public-access-blocks-periodic rule to Block Public Access. In addition, the data could have been encrypted at rest using the appropriate S3 settings, e.g., by enabling server-side encryption using the s3-bucket-server-side-encryption-enabled setting. Other settings are available to further prevent bucket data from being leaked. [7]
While it was not publicly disclosed how the data was protected after discovery, multiple options could have been considered.
Consider the following PowerShell command examples for encryption scopes of Azure storage objects. In the first example, an encryption scope is set for the storage account.
Vulnerable example
New-AzStorageEncryptionScope -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -EncryptionScopeName testscope -StorageEncryptionVulnerable example
ResourceGroupName: MyResourceGroup, StorageAccountName: MyStorageAccount
Name State Source RequireInfrastructureEncryption
testscope Enabled Microsoft.StorageSafe example
New-AzStorageEncryptionScope -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -EncryptionScopeName testscope -StorageEncryption -RequireInfrastructureEncryptionResulting query
ResourceGroupName: MyResourceGroup, StorageAccountName: MyStorageAccount
Name State Source RequireInfrastructureEncryption
testscope Enabled Microsoft.Keyvault TrueReal CVEs that MITRE cites as examples of this weakness.
CAPEC attack patterns that exploit this weakness.
Common questions about CWE-312.
Weakness data is sourced from the MITRE CWE catalog (v4.21). CVE associations are aggregated and kept current by RadicalNotion.AI.
Get an alert when a new CWE-312 CVE affects your products, with AI-written analysis and remediation steps.