Cybersecurity glossary

What is Formula Injection?

Learn what formula injection is, how untrusted input becomes executable spreadsheet or expression formulas, how it relates to CSV injection, and how to keep formula interpreters safe.

Application securityUpdated August 11, 2026
Also known asSpreadsheet formula injectionExpression formula abuseCell formula injection

Definition

Formula Injection is a vulnerability in which untrusted input is interpreted as a formula or expression by a spreadsheet engine, calculation feature, or similar evaluator—causing unintended computation, external calls, or—on misconfigured clients—command execution when the formula runs.

Why formula injection matters

Spreadsheets are business operating systems. When applications import, export, or evaluate cell logic, they inherit a powerful expression language. Formula Injection is what happens when attacker-controlled text is accepted as that language instead of as inert data.

Impact spans phishing pop-ups for finance teams, data pulled from unexpected URLs, and—when evaluators are server-side—confidential calculation abuse or worse.

How formula injection works

1

Untrusted text enters a formula context

Exports, imports, paste APIs, or calc fields accept attacker strings.

2

Interpreter detects a formula marker

Prefixes such as = or locale-specific markers switch the cell into formula mode.

3

Expression evaluates with client/server power

Functions may fetch URLs, craft links, or invoke legacy desktop features.

4

User or system trust is abused

People trust 'their export'; servers trust 'their formula engine'.

Surfaces beyond CSV

XLSX round-trips

Workbooks uploaded and re-downloaded preserve hostile formulas.

In-app calculators

Pricing or scoring DSLs that eval user formulas on the server.

BI paste paths

Clipboard import into dashboards that auto-detect formulas.

Partner EDI-like sheets

Scheduled spreadsheet drops executed by automation accounts.

Prevention that works

ControlNotes
Force literal cellsNeutralize = + - @ on write; mark cells as text in XLSX APIs
Allowlist server DSLsParse AST; permit math only—no network or exec functions
Sanitize on importStrip or escape formulas when ingesting untrusted workbooks
Separate evaluation hostsRun formula workers without secret access or egress if needed
Endpoint hardeningDisable legacy DDE/auto-links in managed Office policies
Content warningsLabel downloads that contain user-generated fields
  • Map every import, export, and evaluate path that touches spreadsheet-like input.
  • Neutralize formula prefixes for all untrusted cell values on the way out and in.
  • If you evaluate formulas server-side, ban network, file, and code-exec functions.
  • Add tests with =HYPERLINK / =WEBSERVICE style payloads where relevant.
  • Treat uploaded workbooks as active content, not static documents.
  • Harden analyst endpoints that routinely open application exports.
  • Document which roles are exposed to formula-bearing files.
  • Track formula injection as a distinct finding from generic XSS or RCE.

The practical takeaway

Formula injection is interpreter confusion: data becomes spreadsheet (or DSL) code. Neutralize markers for clients, and tightly allowlist any server-side expression language.

If your product speaks “Excel,” assume attackers will submit formulas until proven otherwise.

Related security terms

Frequently asked questions

What is formula injection in simple terms?

Data that should be plain text is treated as a formula by Excel, Sheets, or an in-app calculator. Leading = or similar markers make the client compute attacker logic.

How does it differ from CSV injection?

CSV injection is the common file-export path. Formula injection is the broader problem: any channel that feeds untrusted strings into a formula interpreter, including XLSX uploads, pasted cells, or embedded calc engines.

Can formula injection happen server-side?

Yes. Products that evaluate spreadsheet-like expressions or business formulas on the server can execute hostile expressions if the evaluator is too powerful.

What functions are concerning?

External data functions, hyperlink constructors used for phishing, and legacy command/DDE bridges on desktop office suites. Exact risk depends on client and policy.

How do you prevent it?

Force literal text for untrusted cells, neutralize formula prefixes on import/export, and—if server evaluation is required—allowlist operators and ban network/filesystem functions.

Is prefixing with a quote enough?

It is a widely used neutralization for spreadsheet clients. Combine it with server-side allowlists when you evaluate formulas yourself.

Who is the victim?

Often an analyst or admin opening your export—or your own server if you evaluate formulas centrally.

References

Explore authoritative guidance and frameworks related to formula injection.

Explore every security definition

Return to the glossary to search by term, alias, starting letter, or security category.

Browse glossary