T09 · Insecure Skill Coding Practices
Warning
- Location
scripts/script.sh:134- Finding
Unescaped User Input Enables CSV Formula Injection and iCalendar Content Injection
- Content
View full analysis
> "$SLOT_FILE" ``` ```bash while IFS=',' read -r sid sdate sstart send slabel scat screated; do [ "$sid" = "id" ] && continue local dnum="${sdate//-/}" local snum="${sstart/:/}00" local enum="${send/:/}00" echo "BEGIN:VEVENT" echo "UID:${sid}@slot-manager" echo "DTSTART:${dnum}T${snum}" echo "DTEND:${dnum}T${enum}" echo "SUMMARY:${slabel}" echo "CATEGORIES:${scat}" echo "DESCRIPTION:Created by Slot Manager v${VERSION}" echo "END:VEVENT" done < "$SLOT_FILE" ``` ```bash csv) local outfile="${SLOT_DIR}/slots_export.csv" cp "$SLOT_FILE" "$outfile" ``` ### Technical Analysis The `label` and `category` arguments are controlled by the user and are written directly into a comma-separated record without CSV quoting, quote escaping, newline rejection, or spreadsheet formula neutralization. A value beginning with `=`, `+`, `-`, or `@` may be interpreted as a formula when the exported CSV is opened in spreadsheet software. Depending on the spreadsheet application and its security configuration, a formula can initiate external requests, expose data through attacker-controlled URLs, or invoke legacy formula features such as Dynamic Data Exchange. Commas, quotation marks, carriage returns, and line feeds can also alter the CSV record structure. Because the script subsequently parses the same file using `IFS=','`, crafted values can shift columns or introduce additional records. The iCalendar export similarly places the stored label and category directly into `SUMMARY` and `CATEGORIES`. RFC 5545 requires escaping of backslashes, commas, semicolons, and line breaks. A crafted newline can terminat ...[truncated 1545 chars]- Remediation
View remediation
