---
title: "CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer"
url: https://radicalnotion.ai/cwe/cwe-212
type: cwe
description: "The product stores, transfers, or shares a resource that contains sensitive information, but it does not properly remove that information before the product makes the resource available to unauthorized actors."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 136
- **Of those, in CISA KEV:** 0
- **New in 2026:** 53
- **CWE catalog version:** 4.21

## Description

The product stores, transfers, or shares a resource that contains sensitive information, but it does not properly remove that information before the product makes the resource available to unauthorized actors.

Resources that may contain sensitive data include documents, packets, messages, databases, etc. While this data may be useful to an individual user or small set of users who share the resource, it may need to be removed before the resource can be shared outside of the trusted group. The process of removal is sometimes called cleansing or scrubbing.

For example, a product for editing documents might not remove sensitive data such as reviewer comments or the local pathname where the document is stored. Or, a proxy might not remove an internal IP address from headers before making an outgoing request to an Internet site.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Architecture and Design | - |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |
| Operation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Files or Directories, Read Application Data | Sensitive data may be exposed to an unauthorized actor in another control sphere. This may have a wide range of secondary consequences that will depend on what data is exposed. One possibility is the exposure of system data - such as file locations, software versions, or device data - that allow an attacker to craft a specific, more effective attack. Alternately, insufficient redaction of Private Personal Information (PPI), Personally Identifiable Information (PII), or other types of information might not harm the secure operation of the product itself, but could be violations of expectations by the product's users. |

## Potential mitigations

### Requirements

Clearly specify which information should be regarded as private or sensitive, and require that the product offers functionality that allows the user to cleanse the sensitive information from the resource before it is published or exported to other parties.

### Architecture and Design (Separation of Privilege)

Compartmentalize the system to have "safe" areas where trust boundaries can be unambiguously drawn. Do not allow sensitive data to go outside of the trust boundary and always be careful when interfacing with a compartment outside of the safe area.

Ensure that appropriate compartmentalization is built into the system design, and the compartmentalization allows for and reinforces privilege separation functionality. Architects and designers should rely on the principle of least privilege to decide the appropriate time to use privileges and the time to drop privileges.

### Implementation, Operation (Attack Surface Reduction)

Some tools can automatically analyze documents to redact, strip, or "sanitize" private information, although some human review might be necessary. Tools may vary in terms of which document formats can be processed.

When calling an external program to automatically generate or convert documents, invoke the program with any available options that avoid generating sensitive metadata. Some formats have well-defined fields that could contain private data, such as Exchangeable image file format (Exif), which can contain potentially sensitive metadata such as geolocation, date, and time \[REF-1515\] \[REF-1516\].

### Implementation (Attack Surface Reduction)

Use naming conventions and strong types to make it easier to spot when sensitive data is being used. When creating structures, objects, or other complex entities, separate the sensitive and non-sensitive data as much as possible.

Effectiveness: Defense in Depth. This makes it easier to spot places in the code where data is being used that is unencrypted.

### Implementation

Avoid errors related to improper resource shutdown or release (CWE-404), which may leave the sensitive data within the resource if it is in an incomplete state.

## Detection methods

### Automated Static Analysis

Tools are available to analyze documents (such as PDF, Word, etc.) to look for private information such as names, addresses, etc.

## Demonstrative examples

### Example 1

This code either generates a public HTML user information page or a JSON response containing the same user information.

Bad code:

```php
// API flag, output JSON if set
$json = $_GET['json']
$username = $_GET['user']
if(!$json)
{
    $record = getUserRecord($username);
    foreach($record as $fieldName => $fieldValue)
    {
        if($fieldName == "email_address") {

            // skip displaying user emails
            continue;
        }
        else{
            writeToHtmlPage($fieldName,$fieldValue);
        }
    }
}
else
{
    $record = getUserRecord($username);
    echo json_encode($record);
}
```

The programmer is careful to not display the user's e-mail address when displaying the public HTML page. However, the e-mail address is not removed from the JSON response, exposing the user's e-mail address.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2023-1974 | product does not remove EXIF data from images, which can include GPS coordinates |
| CVE-2020-26220 | Customer relationship management (CRM) product does not strip Exif data from images |
| CVE-2019-3733 | Cryptography library does not clear heap memory before release |
| CVE-2005-0406 | Some image editors modify a JPEG image, but the original EXIF thumbnail image is left intact within the JPEG. (Also an interaction error). |
| CVE-2002-0704 | NAT feature in firewall leaks internal IP addresses in ICMP error messages. |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2022-2818 | Improper Removal of Sensitive Information Before Storage or Transfer in cockpit-hq/cockpit | critical | 9.8 | - | No | 2022-08-15 |
| CVE-2026-43824 | github.com/argoproj/argo-cd/: Argo CD: Information disclosure via ServerSideDiff allows reading Kubernetes Secret data | critical | 9.6 | - | No | 2026-05-02 |
| CVE-2025-37959 | bpf: Scrub packet on bpf\_redirect\_peer | critical | 9.4 | - | No | 2025-05-20 |
| CVE-2022-1650 | Improper Removal of Sensitive Information Before Storage or Transfer in eventsource/eventsource | critical | 9.3 | - | No | 2022-05-12 |
| CVE-2020-11684 | - | critical | 9.1 | - | No | 2020-09-14 |
| CVE-2026-130796 | Flowise 3.1.3 through 3.1.4 MCP Server Token Disclosure via Public Chatflow Endpoint | high | 8.8 | - | No | 2026-11-17 |
| CVE-2026-85094 | - | high | 8.8 | - | No | 2026-09-04 |
| CVE-2026-39937 | Global vanishing does not completely remove user email | high | 8.8 | - | No | 2026-04-07 |
| CVE-2022-30617 | Improper Removal of Sensitive Information Before Storage or Transfer in Strapi | high | 8.8 | - | No | 2022-05-19 |
| CVE-2022-0355 | Improper Removal of Sensitive Information Before Storage or Transfer in feross/simple-get | high | 8.8 | - | No | 2022-01-26 |
| CVE-2021-0340 | Elevation of privilege in Framework | high | 8.8 | - | No | 2021-02-10 |
| CVE-2020-15094 | RCE in Symfony | high | 8.8 | - | No | 2020-09-02 |

## Related attack patterns (CAPEC)

- [CAPEC-168](https://radicalnotion.ai/capec/capec-168): Windows ::DATA Alternate Data Stream

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-669](https://radicalnotion.ai/cwe/cwe-669) | Incorrect Resource Transfer Between Spheres |
| Child | [CWE-226](https://radicalnotion.ai/cwe/cwe-226) | Sensitive Information in Resource Not Removed Before Reuse |
| Child | [CWE-1266](https://radicalnotion.ai/cwe/cwe-1266) | Improper Scrubbing of Sensitive Data from Decommissioned Device |
| Can precede | [CWE-201](https://radicalnotion.ai/cwe/cwe-201) | Insertion of Sensitive Information Into Sent Data |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Cross-Boundary Cleansing Infoleak | - | - |

## Frequently asked questions

### What is CWE-212?

The product stores, transfers, or shares a resource that contains sensitive information, but it does not properly remove that information before the product makes the resource available to unauthorized actors.

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

136 recorded CVEs are attributed to CWE-212, including CVE-2022-2818, CVE-2026-43824 and CVE-2025-37959.

### How do you prevent CWE-212?

Clearly specify which information should be regarded as private or sensitive, and require that the product offers functionality that allows the user to cleanse the sensitive information from the resource before it is published or exported to other parties.

### How is CWE-212 detected?

Automated Static Analysis: Tools are available to analyze documents (such as PDF, Word, etc.) to look for private information such as names, addresses, etc.

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

Exploiting CWE-212 can lead to: Read Files or Directories, Read Application Data.

### Is CWE-212 actively exploited?

136 recorded CVEs are caused by CWE-212; none are currently in CISA's KEV catalog of actively exploited flaws.

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

---

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