---
title: "CWE-1236: Improper Neutralization of Formula Elements in a CSV File"
url: https://radicalnotion.ai/cwe/cwe-1236
type: cwe
description: "The product saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by a spreadsheet product."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-1236: Improper Neutralization of Formula Elements in a CSV File

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

## Description

The product saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by a spreadsheet product.

## Background

User-provided data is often saved to traditional databases. This data can be exported to a CSV file, which allows users to read the data using spreadsheet software such as Excel, Numbers, or Calc. This software interprets entries beginning with '=' as formulas, which are then executed by the spreadsheet software. The software's formula language often allows methods to access hyperlinks or the local command line, and frequently allows enough characters to invoke an entire script.

## Alternate terms

- CSV Injection
- Formula Injection
- Excel Macro Injection

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | The weakness is in the implementation of a software's CSV export feature, in particular how it formats formula entries as the output gets flattened into a text file. |

## Applicable platforms

**Technologies:** Other (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Application Data, Execute Unauthorized Code or Commands | Attackers can populate data fields which, when saved to a CSV file, may attempt information exfiltration or other malicious activity when automatically executed by the spreadsheet software. Note that current versions of Excel warn users of untrusted content. |

## Potential mitigations

### Implementation

When generating CSV output, ensure that formula-sensitive metacharacters are effectively escaped or removed from all data before storage in the resultant CSV. Risky characters include '=' (equal), '+' (plus), '-' (minus), and '@' (at).

Effectiveness: Moderate. Unfortunately, there is no perfect solution, since different spreadsheet products act differently.

### Implementation

If a field starts with a formula character, prepend it with a ' (single apostrophe), which prevents Excel from executing the formula.

Effectiveness: Moderate. It is not clear how effective this mitigation is with other spreadsheet software.

### Architecture and Design

Certain implementations of spreadsheet software might disallow formulas from executing if the file is untrusted, or if the file is not authored by the current user.

Effectiveness: Limited. This mitigation has limited effectiveness because it often depends on end users opening spreadsheet software safely.

## 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

Hyperlinks or other commands can be executed when a cell begins with the formula identifier, '='

Attack code:

```other
=HYPERLINK(link_location, [friendly_name])
```

Good code:

```other
HYPERLINK(link_location, [friendly_name])
```

Stripping the leading equals sign, or simply not executing formulas from untrusted sources, impedes malicious activity.

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2019-12134 | Low privileged user can trigger CSV injection through a contact form field value |
| CVE-2019-4521 | Cloud management product allows arbitrary command execution via CSV injection |
| CVE-2019-17661 | CSV injection in content management system via formula code in a first or last name |

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

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-35157 | - | critical | 9.8 | - | No | 2026-05-11 |
| CVE-2026-31049 | - | critical | 9.8 | - | No | 2026-04-14 |
| CVE-2025-56267 | - | critical | 9.8 | - | No | 2025-09-08 |
| CVE-2023-47295 | - | critical | 9.8 | - | No | 2025-06-23 |
| CVE-2024-55532 | Apache Ranger: Improper Neutralization of Formula Elements in a CSV File | critical | 9.8 | - | No | 2025-03-03 |
| CVE-2023-46400 | - | critical | 9.8 | - | No | 2025-01-23 |
| CVE-2023-46401 | - | critical | 9.8 | - | No | 2025-01-23 |
| CVE-2024-3214 | Relevanssi – A Better Search \<= 4.22.1 - Unauthenticated Second Order CSV Injection | critical | 9.8 | - | No | 2024-04-09 |
| CVE-2024-29375 | - | critical | 9.8 | - | No | 2024-04-04 |
| CVE-2023-35899 | IBM Cloud Pak for Automation CSV injection | critical | 9.8 | - | No | 2024-03-05 |
| CVE-2023-51763 | ActiveAdmin CSV Injection leading to sensitive information disclosure | critical | 9.8 | - | No | 2023-12-24 |
| CVE-2022-45360 | WordPress Commenter Emails Plugin \<= 2.6.1 is vulnerable to CSV Injection | critical | 9.8 | - | No | 2023-11-07 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-74](https://radicalnotion.ai/cwe/cwe-74) | Improper Neutralization of Special Elements in Output Used by a Downstream Component |

## Frequently asked questions

### What is CWE-1236?

The product saves user-provided information into a Comma-Separated Value (CSV) file, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as a command when the file is opened by a spreadsheet product.

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

325 recorded CVEs are attributed to CWE-1236, including CVE-2026-35157, CVE-2026-31049 and CVE-2025-56267.

### How do you prevent CWE-1236?

When generating CSV output, ensure that formula-sensitive metacharacters are effectively escaped or removed from all data before storage in the resultant CSV. Risky characters include '=' (equal), '+' (plus), '-' (minus), and '@' (at).

### How is CWE-1236 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-1236?

Exploiting CWE-1236 can lead to: Read Application Data, Execute Unauthorized Code or Commands.

### Is CWE-1236 actively exploited?

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

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

---

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