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

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.

Submission Date :

Nov. 21, 2019, midnight

Modification Date :

2023-06-29 00:00:00+00:00

Organization :

MITRE
Extended Description

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

Example Vulnerable Codes

Example - 1

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

<xhtml_p>=HYPERLINK(link_location, [friendly_name])</xhtml_p>

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

<xhtml_p>HYPERLINK(link_location, [friendly_name])</xhtml_p>

Related Weaknesses

This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined to give an overview of the different insight to similar items that may exist at higher and lower levels of abstraction.

Visit http://cwe.mitre.org/ for more details.