T09 · Insecure Skill Coding Practices
- Location
SKILL.md:42- Finding
Shell Command Injection Through Unsafe Parameter Interpolation
- Content
View full analysis
' \ ./.venv/bin/python -m toutiao_poster post \ --title '' \ --content-text '<content>' \ --headless ``` ```bash TOUTIAO_COOKIE='<cookie_header>' \ ./.venv/bin/python -m toutiao_poster post \ --title '<title>' \ --content-text '<content>' \ --docx-wait-seconds 60 \ --headless \ --publish ``` ```bash TOUTIAO_COOKIE='<cookie_header>' \ ./.venv/bin/python -m toutiao_poster post \ --title '<title>' \ --content-text '<content>' \ --image '/abs/path/1.png' \ --image '/abs/path/2.jpg' \ --docx-wait-seconds 60 \ --headless \ --publish ``` ### Technical Analysis The documented commands place user-controlled `cookie_header`, `title`, and `content` values directly inside a shell command using single quotes. Dynamically supplied image paths are expected to be inserted in the same manner. Single quotes only protect a value while the value itself contains no single quote. An attacker can provide an apostrophe to terminate the quoted argument and then append shell operators and an arbitrary command. Subsequent text can be neutralized with a shell comment or otherwise arranged to preserve valid shell syntax. For example, a malicious title conceptually shaped as: ```text '; id > /tmp/proof; # ``` would transform the title argument into shell syntax resembling: ```bash --title ''; id > /tmp/proof; #' ``` If an agent constructs and executes the documented command through a shell, `id > /tmp/proof` is interpreted as a separate command rather than article text. The cookie assignment is vulnerable to the same quoting problem. This is particularly sensitive because the resulting process operates in an environment that may contain a valid Toutiao session cooki ...[truncated 1861 chars]- Remediation
View remediation
