CWE-212: Improper Removal of Sensitive Information Before Storage or Transfer
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.
Last updated
Overview
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.
Real-world CVEs
60 recorded CVEs are caused by CWE-212 (Improper Removal of Sensitive Information Before Storage or Transfer). The highest-severity and most recent are shown first. 18 new CWE-212 CVEs have been recorded so far in 2026 (12 in 2025).
- CVE-2022-2818Critical · CVSS 9.8 · EPSS 74th2022-08-15
- CVE-2026-43824Critical · CVSS 9.6 · EPSS 13th2026-05-02
- CVE-2022-1650
Improper Removal of Sensitive Information Before Storage or Transfer in eventsource/eventsource
Critical · CVSS 9.3 · EPSS 78th2022-05-12 - CVE-2026-32891
Anchorr Privilege Escalation: Jellyseerr User → Anchorr Admin via Stored XSS
Critical · CVSS 9.1 · EPSS 6th2026-03-20 - CVE-2026-39937
Global vanishing does not completely remove user email
High · CVSS 8.8 · EPSS 18th2026-04-07 - CVE-2022-30617High · CVSS 8.8 · EPSS 71th2022-05-19
- CVE-2022-0355High · CVSS 8.8 · EPSS 80th2022-01-26
- CVE-2020-15094High · CVSS 8.8 · EPSS 87th2020-09-02
- CVE-2026-53604
nebula-mesh: CA private key not zeroized on web mobile-bundle error paths
High · CVSS 8.7 - CVE-2026-27640
tfplan2md has Sensitive Value Exposure in Generated Reports
High · CVSS 8.5 · EPSS 22th2026-02-25 - CVE-2025-65965
Grype has a credential disclosure vulnerability in Grype JSON output
High · CVSS 8.2 · EPSS 4th2025-11-25 - CVE-2022-4734High · CVSS 8.1 · EPSS 53th2022-12-25
Showing 12 of 60 recorded CWE-212 CVEs. Track new ones as they are published and get AI-written analysis and fixes.
Monitor CWE-212 vulnerabilitiesCommon consequences
What can happen when CWE-212 is exploited.
Read Files or Directories, Read Application Data
Affects: Confidentiality
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.
How it happens
When it is introduced
Typically introduced during these phases of the software lifecycle.
How to prevent it
Practical mitigations for CWE-212, grouped by where in the lifecycle they apply.
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.
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.
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].
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.
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.
How to detect it
Automated Static Analysis
Tools are available to analyze documents (such as PDF, Word, etc.) to look for private information such as names, addresses, etc.
Code examples
Illustrative examples from MITRE showing how the weakness appears in code.
This code either generates a public HTML user information page or a JSON response containing the same user information.
Vulnerable example
// API flag, output JSON if setThe 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.
Illustrative examples
Real CVEs that MITRE cites as examples of this weakness.
- 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.
Terminology & mappings
Mapped taxonomies
- PLOVER: Cross-Boundary Cleansing Infoleak
Attack patterns
CAPEC attack patterns that exploit this weakness.
Frequently asked questions
Common questions about CWE-212.
- 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?
- 60 recorded CVEs are attributed to CWE-212, including CVE-2022-2818, CVE-2026-43824, CVE-2022-1650.
- 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?
- 60 recorded CVEs are caused by CWE-212; none are currently in CISA's KEV catalog of actively exploited flaws.
References
- MITRE CWE definition (CWE-212) (opens in a new tab)
- CWE-212 vulnerabilities on NVD (opens in a new tab)
- Learn: What is a CWE?
Weakness data is sourced from the MITRE CWE catalog (v4.20). CVE associations are aggregated and kept current by RadicalNotion.AI.
Stay ahead of CWE-212
Get alerted the moment a new CWE-212 vulnerability affects your stack, with AI-written analysis, severity context, and remediation guidance.