04 Июн, 2025

How a Release-Notes Field Became a CSV Injection Vector

Background — When Spreadsheets Can Execute Code

The tested firmware-management portal lets product teams export “What’s New” notes as a CSV file so translators and partners can localise release content. Because spreadsheet software automatically evaluates leading formula characters (=, +, @, -), any user-supplied text that reaches the CSV unescaped can transform an innocent data file into an executable payload. That is exactly what happened here: the platform wrote untrusted release-note text straight into the CSV, turning every download into a potential attack surface.

Discovery — From Release Notes to Remote Calls

1. Open the Create Firmware wizard.

2. In the What’s New field, enter a formula payload such as:

				
					=HYPERLINK("https://example.com","Link")

				
			

3. Save the firmware record.

4. Click Translate to download the “Firmware details” ZIP.

5. Extract swm_translate_rn.csv and open it in any spreadsheet editor.

6. Observe that the payload appears as a live hyperlink; clicking it triggers an outbound request.

Technical Root Cause — Unescaped Input in CSV Export

The backend builds the CSV by concatenating field values with commas:

				
					row = f'{firmware_id},"{whats_new}",{language_code},...'

				
			
  • No escaping of initial = + - @ characters.

  • No double-quote handling beyond crude wrapping.

  • Same template reused across multiple export actions, so any user with firmware-creation rights could embed formulas in other teams’ CSV downloads.

Real-World Risks — What Attackers Could Do

Command execution (Windows only)

Credential phish / data exfiltration

Malicious macro chain

Internal pivot

Broader Lessons — CSV Is Not Plain Text

Common misconceptions:

• “It’s just text, nothing can run.” — Spreadsheet viewers execute formulas by design.

• “Only Excel is risky.” — LibreOffice, Numbers, and Google Sheets support formulas too (though with varied payload depth).

• “Escaping quotes is enough.” — Formula injection depends on leading characters, not embedded quotes.

Anything downloadable by users should be treated like active content unless proven inert.

Recommendations — How to Do It Right

Escape or prefix dangerous characters
  • Prepend a single quote (') to any cell value that begins with =, +, -, or @.
  • Many libraries (e.g., OWASP CSV Injection prevention) provide helpers.

Offer safer formats
  • Provide translators with XLSX or JSON where formulas can be explicitly disabled.

Content-security awareness
  • Flag any release-note text containing formula characters for reviewer approval.

Limit privileges
  • Only approved roles should create firmware records; translators need read-only access.

User education & warnings
  • Display a banner on export pages: “CSV files may contain formulas—open only in a trusted environment.”

Conclusion — Small Field, Big Blast Radius

One unescaped string in a CSV can execute code, leak data, or trick users with crafted hyperlinks. Treat spreadsheet exports with the same rigour you apply to HTML: validate, sanitise, and assume nothing about the viewer’s environment.

Другие Услуги

Готовы к безопасности?

Связаться с нами