---
title: "CWE-312: Cleartext Storage of Sensitive Information"
url: https://radicalnotion.ai/cwe/cwe-312
type: cwe
description: "The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-312: Cleartext Storage of Sensitive Information

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 770
- **Of those, in CISA KEV:** 2
- **New in 2026:** 145
- **CWE catalog version:** 4.21

## Description

The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | OMISSION: This weakness is caused by missing a security tactic during the architecture and design phase. |

## Applicable platforms

**Languages:** Go (Undetermined)

**Technologies:** Cloud Computing (Undetermined), ICS/OT (Undetermined), Mobile (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Application Data | 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. |

## Potential mitigations

### Implementation, System Configuration, Operation

When storing data in the cloud (e.g., S3 buckets, Azure blobs, Google Cloud Storage, etc.), use the provider's controls to encrypt the data at rest. \[REF-1297\] \[REF-1299\] \[REF-1301\]

### Implementation, System Configuration, Operation

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.

## Detection methods

### Automated Static Analysis

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

## Demonstrative examples

### Example 1

The following code excerpt stores a plaintext user account ID in a browser cookie.

Bad code:

```java
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.

### Example 2

This code writes a user's login information to a cookie so the user does not have to login again later.

Bad code:

```php
function persistLogin($username, $password){
    $data = array("username" => $username, "password"=> $password);
    setcookie ("userdata", $data);
}
```

### Example 3

The following code attempts to establish a connection, read in a password, then store it to a buffer.

Bad code:

```c
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.

### Example 4

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.

Bad code:

```java
# Java Web App ResourceBundle properties file
...
webapp.ldap.username=secretUsername
webapp.ldap.password=secretPassword
...
```

Bad code:

```aspnet
...
<connectionStrings>
    <add name="ud_DEV" connectionString="connectDB=uDB; uid=db2admin; pwd=password; dbalias=uDB;" providerName="System.Data.Odbc" />
</connectionStrings>
...
```

### Example 5

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" \[REF-1283\]. 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.

### Example 6

In 2021, a web site operated by PeopleGIS stored data of US municipalities in Amazon Web Service (AWS) Simple Storage Service (S3) buckets.

Bad code:

```other
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. [REF-1296] [REF-1295]
```

Good code:

```other
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. [REF-1297]
```

While it was not publicly disclosed how the data was protected after discovery, multiple options could have been considered.

### Example 7

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.

Bad code:

```shell
New-AzStorageEncryptionScope -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -EncryptionScopeName testscope -StorageEncryption
```

Bad code:

```other
ResourceGroupName: MyResourceGroup, StorageAccountName: MyStorageAccount
Name  State  Source  RequireInfrastructureEncryption
testscope  Enabled  Microsoft.Storage
```

Good code:

```shell
New-AzStorageEncryptionScope -ResourceGroupName "MyResourceGroup" -AccountName "MyStorageAccount" -EncryptionScopeName testscope -StorageEncryption -RequireInfrastructureEncryption
```

Result code:

```other
ResourceGroupName: MyResourceGroup, StorageAccountName: MyStorageAccount
Name  State  Source  RequireInfrastructureEncryption
testscope  Enabled  Microsoft.Keyvault  True
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2022-26390 | wireless battery product stores credentials and Personal Health Information (PHI) without encryption |
| CVE-2022-30275 | Remote Terminal Unit (RTU) uses a driver that relies on a password stored in plaintext. |
| CVE-2009-2272 | password and username stored in cleartext in a cookie |
| CVE-2009-1466 | password stored in cleartext in a file with insecure permissions |
| CVE-2009-0152 | chat program disables SSL in some circumstances even when the user says to use SSL. |
| CVE-2009-1603 | Chain: product uses an incorrect public exponent when generating an RSA key, which effectively disables the encryption |
| CVE-2009-0964 | storage of unencrypted passwords in a database |
| CVE-2008-6157 | storage of unencrypted passwords in a database |
| CVE-2008-6828 | product stores a password in cleartext in memory |
| CVE-2008-1567 | storage of a secret key in cleartext in a temporary file |
| CVE-2008-0174 | SCADA product uses HTTP Basic Authentication, which is not encrypted |
| CVE-2007-5778 | login credentials stored unencrypted in a registry key |
| CVE-2001-1481 | Cleartext credentials in world-readable file. |
| CVE-2005-1828 | Password in cleartext in config file. |
| CVE-2005-2209 | Password in cleartext in config file. |
| CVE-2002-1696 | Decrypted copy of a message written to disk given a combination of options and when user replies to an encrypted message. |
| CVE-2004-2397 | Cleartext storage of private key and passphrase in log file when user imports the key. |
| CVE-2002-1800 | Admin password in cleartext in a cookie. |
| CVE-2001-1537 | Default configuration has cleartext usernames/passwords in cookie. |
| CVE-2001-1536 | Usernames/passwords in cleartext in cookies. |
| CVE-2005-2160 | Authentication information stored in cleartext in a cookie. |

## Real CVEs with this weakness (sample of 12 of 770)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2023-22894 | Strapi leaking sensitive user information by filtering on private fields | high | 7.5 | - | Yes | 2023-04-19 |
| CVE-2011-4723 | D-Link DIR-300 Router Cleartext Storage of a Password Vulnerability | medium | 6.9 | - | Yes | 2011-12-20 |
| CVE-2026-22240 | Plaintext Passwords Vulnerability in BLUVOYIX | critical | 10.0 | - | No | 2026-01-14 |
| CVE-2022-43757 | Rancher: Exposure of sensitive fields | critical | 9.9 | - | No | 2023-02-07 |
| CVE-2021-36782 | Rancher: Plaintext storage and exposure of credentials in Rancher API and cluster.management.cattle.io object | critical | 9.9 | - | No | 2022-09-07 |
| CVE-2020-9045 | C•CURE 9000 and victor Video Management System - Cleartext storage of user credentials upon installation or upgrade of software. | critical | 9.9 | - | No | 2020-05-21 |
| CVE-2026-128974 | - | critical | 9.8 | - | No | 2026-11-18 |
| CVE-2026-15721 | Query Console SQL Injection Leading to Sensitive Data Disclosure in Bilin Software's HUMANIST Digital Human Resources | critical | 9.8 | - | No | 2026-08-04 |
| CVE-2025-65826 | - | critical | 9.8 | - | No | 2025-12-10 |
| CVE-2025-30124 | - | critical | 9.8 | - | No | 2025-07-28 |
| CVE-2024-46340 | - | critical | 9.8 | - | No | 2024-12-10 |
| CVE-2023-2809 | Use of Cleartext credentials in Sage 200 Spain | critical | 9.8 | - | No | 2023-10-04 |

## Related attack patterns (CAPEC)

- [CAPEC-37](https://radicalnotion.ai/capec/capec-37): Retrieve Embedded Sensitive Data

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-311](https://radicalnotion.ai/cwe/cwe-311) | Missing Encryption of Sensitive Data |
| Parent | [CWE-922](https://radicalnotion.ai/cwe/cwe-922) | Insecure Storage of Sensitive Information |
| Child | [CWE-313](https://radicalnotion.ai/cwe/cwe-313) | Cleartext Storage in a File or on Disk |
| Child | [CWE-314](https://radicalnotion.ai/cwe/cwe-314) | Cleartext Storage in the Registry |
| Child | [CWE-315](https://radicalnotion.ai/cwe/cwe-315) | Cleartext Storage of Sensitive Information in a Cookie |
| Child | [CWE-316](https://radicalnotion.ai/cwe/cwe-316) | Cleartext Storage of Sensitive Information in Memory |
| Child | [CWE-317](https://radicalnotion.ai/cwe/cwe-317) | Cleartext Storage of Sensitive Information in GUI |
| Child | [CWE-318](https://radicalnotion.ai/cwe/cwe-318) | Cleartext Storage of Sensitive Information in Executable |
| Child | [CWE-526](https://radicalnotion.ai/cwe/cwe-526) | Cleartext Storage of Sensitive Information in an Environment Variable |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Plaintext Storage of Sensitive Information | - | - |
| Software Fault Patterns | Exposed Data | SFP23 | - |
| ISA/IEC 62443 | Req CR 4.1 a) | Part 4-2 | - |
| ISA/IEC 62443 | Req SR 4.1 | Part 3-3 | - |
| OWASP Golang Secure Coding Practices Guide | Data Protection | - | - |

## Frequently asked questions

### What is CWE-312?

The product stores sensitive information in cleartext within a resource that might be accessible to another control sphere.

### What CVEs are caused by CWE-312?

770 recorded CVEs are attributed to CWE-312, including CVE-2023-22894, CVE-2011-4723 and CVE-2026-22240. 2 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### Is CWE-312 part of the OWASP Top 10?

CWE-312 maps to OWASP Golang Secure Coding Practices Guide: Data Protection in the OWASP security taxonomy.

### How do you prevent CWE-312?

When storing data in the cloud (e.g., S3 buckets, Azure blobs, Google Cloud Storage, etc.), use the provider's controls to encrypt the data at rest.

### How is CWE-312 detected?

Automated Static Analysis: 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.)

### What are the consequences of CWE-312?

Exploiting CWE-312 can lead to: Read Application Data.

### Is CWE-312 actively exploited?

Yes. 2 CWE-312 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 770 recorded CVEs.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/312.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-312). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
