T09 · Insecure Skill Coding Practices
- Location
SKILL.md:14- Finding
Spreadsheet Formula Injection Through Untrusted CSV Fields
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 14-43
Vulnerability Type: CSV/spreadsheet formula injection
Risk Level: MediumVulnerable Instruction Snippet
The following is an English rendering of the complete relevant instruction segment:
text Input format: Date VehiclePlate Station Volume×UnitPrice=Amount [CardDeduction/Cash] [Mileage] Generate the refueling master table using these nine columns: SequenceNumber,RefuelingDate,VehiclePlate,Mileage,Station,Volume(L),UnitPrice,Amount,CardDeductionFlag Extract card-deduction records when the card-deduction flag equals "CardDeduction". Generate the card-deduction subtable: Date,ProjectPoint,ProjectTarget,ProjectDetails,Flag,Summary,IncomeAmount,ExpenseAmount WeChat,He Weiguang,AdvancePayment+Station,,Receive+VehiclePlate+Station+RefuelingFee+Expression+AmountDeductedFrom+StationRechargeCard,Amount,0 Date,ProjectPoint,ProjectTarget,ProjectDetails,Flag,Summary,IncomeAmount,ExpenseAmount WeChat,VehiclePlate,Refueling,,Pay+VehiclePlate+Station+RefuelingFee+Expression+AmountDeductedFrom+StationRechargeCard,0,AmountTechnical Analysis
The Skill directs the agent to place user-controlled vehicle plates, station names, and related values directly into a CSV file and into derived accounting-summary cells. It does not require spreadsheet-safe encoding or neutralization of values beginning with formula indicators such as
=,+,-, or@.CSV quoting alone does not reliably prevent this vulnerability because spreadsheet applications can still interpret a quoted cell as a formula after parsing the CSV. Consequently, an attacker-controlled textual field can become active spreadsheet content when an operator opens the generated report.
Strict numeric validation is also absent from the documented workflow. Fields presented as mileage, volume, unit price, or amount should therefore not be assumed safe merely bec ...[truncated 1556 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat every user-controlled CSV field as untrusted, including vehicle plates, station names, dates, mileage, and transaction values.
- Before serialization, neutralize any textual cell whose first non-whitespace character is
=,+,-, or@. Use a spreadsheet-compatible text prefix such as a single quote, or another neutralization method appropriate to the target spreadsheet software. - Apply standard CSV encoding after formula neutralization:
- Enclose fields containing commas, quotation marks, carriage returns, or newlines in double quotes.
- Escape each embedded double quote by doubling it.
- Parse numeric fields using strict allow-listed formats. Reject values containing formula operators, control characters, unexpected whitespace, or nonnumeric suffixes.
- Validate dates, vehicle plates, station names, and mileage against documented length and character constraints.
- Sanitize source values before constructing derived summary fields so unsafe content cannot be propagated into multiple cells.
- Add explicit security instructions and adversarial examples to
SKILL.md. - Add tests covering cells beginning with each formula indicator, values with leading whitespace, embedded commas, quotation marks, and multiline input.
- Where feasible, generate a structured workbook format with cells explicitly typed as text instead of relying on CSV type inference.
