T09 · Insecure Skill Coding Practices
- Location
SKILL.md:234- Finding
User-Controlled CSV Formula Injection in Divination Log
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 234-244 and 259-269
Vulnerability Type: CSV formula injection caused by persisting an insufficiently validated user-controlled subject
Risk Level: MediumVulnerable Instruction Snippets
text ## Input format [date]-[divination subject]-[6-digit number] Rules: - Full format: 2026/3/12-[example subject]-987778 - Number only: date=current date (2026/5/25), subject=No misfortune - The number must contain six digits, each from 6 through 9 - An invalid number results in an error and no divinationtext | Step | Content | Method | |------|---------|--------| | Step 1 | Validate number | Rule validation | ... | Step 8 | Archive record | Write CSV/JSON |The user-controlled subject is ultimately stored in the
占何事subject column ofreferences/yijing-log.csv.Technical Analysis
The Skill validates the six-digit divination number but specifies no equivalent validation or output neutralization for the user-controlled subject before Step 8 writes the record to CSV.
CSV itself is a data format, but common spreadsheet applications interpret cells beginning with
=,+,-, or@as formulas. An attacker can therefore submit a valid divination request whose subject begins with a spreadsheet formula. Correct CSV quoting alone does not necessarily prevent formula interpretation after the file is opened.The current repository log row is benign, and no existing formula payload was found. The vulnerability exists in the instructed processing path for future user input.
Attack Path
- An attacker supplies an otherwise valid request containing a subject that begins with a spreadsheet formula and a valid six-digit value.
- The Skill validates only the six-digit value, so the crafted subject remains accepted.
- The Agent follows the archival step and writes the subject into
references/yijing-log.csv. - A user l ...[truncated 1058 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat every user-controlled CSV field as untrusted, including the divination subject, date, and any generated text that may incorporate user input.
- Before CSV persistence, neutralize fields whose first non-whitespace character is
=,+,-, or@. A common defensive measure is to prefix such values with an apostrophe, subject to the behavior of the target spreadsheet application. - Reject or normalize carriage returns, line feeds, null bytes, and other control characters to prevent record-structure manipulation.
- Enforce a reasonable maximum subject length and define an explicit character policy.
- Use a trusted CSV serializer for delimiter escaping and quoting. Do not rely on quoting alone to prevent formula execution.
- Prefer JSON or a structured database when spreadsheet compatibility is unnecessary.
- Add explicit instructions to Step 1 and Step 8 requiring validation and spreadsheet-formula neutralization before writing any record.
- Add regression tests covering subjects beginning with
=,+,-, and@, including variants preceded by whitespace, tabs, or control characters.
