exploiting-csv-formula-injection

Detects and exploits CSV formula injection in spreadsheet export and import features.

954|172|Updated Mar 13, 2026
One-click install
npx skills add https://github.com/xalgord/xalgorix --skill exploiting-csv-formula-injection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: exploiting-csv-formula-injection
Source: https://github.com/xalgord/xalgorix/tree/main/internal/tools/skills/data/web-application-security/exploiting-csv-formula-injection
Command: npx skills add https://github.com/xalgord/xalgorix --skill exploiting-csv-formula-injection

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Applications that export user-controlled data to CSV or Excel files can silently turn stored input into executable spreadsheet formulas, leading to client-side command execution and data exfiltration when staff open the export. This Skill provides a systematic workflow to find, validate, and demonstrate CSV/DDE formula injection during authorized penetration tests.

Core Features & Use Cases

  • Export Surface Mapping: Trace user-controlled fields (profiles, tickets, comments) through to every CSV/XLSX export, including admin-only reports and audit logs.
  • Detection and Bypass Payloads: Test all four formula trigger characters (=, +, -, @), whitespace/control-character filter bypasses, and comma/quote cell breakout.
  • Impact Demonstration: Weaponize confirmed injection with HYPERLINK/WEBSERVICE data exfiltration to an out-of-band listener, DDE command execution on a controlled victim VM, and stored-XSS-via-CSV-import variants.
  • Use Case: During a web app pentest, set a profile field to =WEBSERVICE(...) , trigger the admin user export, and confirm via an OOB callback that opening the file in Excel exfiltrates adjacent cells, then report with reproduction steps and remediation guidance.

Quick Start

Test the target application's profile fields and admin CSV export for formula injection using benign arithmetic payloads first, then confirm execution by opening the export in Excel or LibreOffice.

Frequently Asked Questions about exploiting-csv-formula-injection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test for CSV formula injection in a web application?

Submit benign arithmetic payloads like =1+1, +1+1, -1+1, and @SUM(1+1) into user-controlled fields, then download the CSV or Excel export and open it in Excel or LibreOffice. If the cell shows the computed result instead of the literal text, the field is vulnerable.

What characters trigger formula execution in Excel and CSV files?

A cell is treated as a formula when it begins with =, +, -, or @. Filters that only strip = are bypassed by the other three characters, and leading spaces, tabs, or carriage returns are trimmed by Excel before parsing, defeating naive starts-with checks.

Can CSV injection exfiltrate data without macros?

Yes. HYPERLINK and WEBSERVICE formulas leak adjacent cell contents to an attacker URL on click or on file open, with no macro warning in many configurations. Confirm the callback using an out-of-band listener such as Burp Collaborator, interactsh, or a logging web server.

Does DDE command execution still work in modern Excel?

Modern Excel shows warning prompts before launching external programs via =cmd|'/c calc'!A1, but users frequently click through, and legacy, registry-tweaked, or LibreOffice configurations may execute automatically. Validate behavior on a controlled victim VM, never production machines.

Why does my CSV injection payload not execute when the export is opened?

Common causes are the application neutralizing cells by prefixing a single quote, the payload landing mid-row instead of at a cell start, or the spreadsheet client blocking external content. Try comma/quote breakout to control the cell and test both Excel and LibreOffice.

How should applications prevent CSV formula injection?

Prefix every exported cell beginning with =, +, -, @, or leading whitespace with a single quote or tab to force literal text. Additionally escape quotes and commas per RFC 4180, serve downloads as text/csv with Content-Disposition: attachment, and disable DDE via Office group policy.