T09 · Insecure Skill Coding Practices
- Location
scripts/check-negative.js:68- Finding
Shell Command Injection Through Negative Review Alerts
- Content
View full analysis
`**[${review.platform}]** ${review.author} ⭐${review.rating}\n` + `사유: ${reason}\n` + `> ${review.content}\n` ).join('\n'); sendDiscordAlert(config.alert.discordChannelId, message); ``` ### Technical Analysis The script creates a command as a single string and executes it through `execSync()`, which invokes a system shell. It attempts to secure the message by escaping only double-quote characters: ```js message.replace(/"/g, '\\"') ``` Escaping double quotes does not neutralize shell substitutions inside a double-quoted shell argument. Constructs such as `$(command)` and backtick command substitution are still interpreted by the shell. Review content, author names, platform values, and the configured Discord channel ID are interpolated into this shell command. The script loads every JSON file under the configured review directory without validating the structure or sanitizing individual fields. Therefore, malicious content in a persisted review can reach the command execution sink. ### Attack Path 1. Discord alerts are enabled in `config.json`, and the negative-review checker is invoked manually or through the documented recurring automation. 2. A malicious r ...[truncated 1880 chars]- Remediation
View remediation
