usd-2022-0053 | CSV-Injection in User Profile in CPTO 6.3.8.6
Advisory ID: usd-2022-0053
Product: Cash Point & Transport Optimizer CPTO
Affected Version: 6.3.8.6 (#718) 06.07.2021
Vulnerability Type: CWE 1236 - Improper Neutralization of Formula Elements in a CSV File
Security Risk: Medium
Vendor URL: https://www.sesami.io/
Vendor acknowledged vulnerability: Yes
Vendor Status: Fixed
CVE number: CVE-2023-31295
CVE Link: Pending
Description
A spreadsheet formula can be inserted into the User Profile field. The inserted spreadsheet formula executes when an exported users CSV file is opened in a spreadsheet software such as LibreOffice Calc.
Fix
Users should update CPTO to its current version.
This attack is difficult to mitigate, and explicitly disallowed from quite a few bug bounty programs. To remediate it, ensure that no cells begin with any of the following characters:
Equals to (=)
Plus (+)
Minus (-)
At (@)
Tab (0x09)
Carriage return (0x0D)
Keep in mind that it is not sufficient to make sure that the untrusted user input does not start with these characters. You also need to take care of the field separator (e.g., ‘,’, or ‘;’) and quotes (e.g., ', or "), as attackers could use this to start a new cell and then have the dangerous character in the middle of the user input, but at the beginning of a cell.
Alternatively, apply the following sanitization to each field of the CSV, so that their content will be read as text by the spreadsheet editor:
- Wrap each cell field in double quotes
- Prepend each cell field with a single quote
- Escape every double quote using an additional double quote
References
https://owasp.org/www-community/attacks/CSV_Injection
Timeline
- 2022-11-03: Vulnerabilities discovered by Marcus Nilsson.
- 2022-11-28: The Responsible Disclosure tries to establish contact with vendor for the first time.
- 2023-04-27: CVE IDs are requested and subsequently reserved.
- 2023-05-12: Trying to establish contact via phone and email has been unsucessful, usd AG's customer notifies the team that vulnerabilities should by fixed come autumn.
- 2023-11-23: Marcus Nilsson got in touch with vendor, the advisories shall be published without a Proof-Of-Concept of the exploits in December.
- 2022-12-21: Advisory published by usd AG.
Credits
This security vulnerability was found by Marcus Nilsson of usd AG.