T09 · Insecure Skill Coding Practices
- Location
scripts/tklr_agent_wrapper.py:1899- Finding
Delayed Shell Command Injection Through Email Alert Content
- Content
View full analysis
str: """Build the email delivery command — the one shape that is easy to get wrong. It nests a printf inside `sh -c` inside a TOML literal string, and each layer eats one level of escaping: the `\\\\n` written here survives TOML verbatim, becomes `\\n` after the dispatcher's shlex.split, and is finally interpreted by printf. Hand-written versions of this have shipped without a `From:` header (himalaya then exits 1 on every alert, forever) and with the newlines collapsed. Generating it removes the whole class of mistake. """ lines = [ f"From: {from_addr}", f"To: {to_addr}", "Subject: Reminder: {name} - starts {when} ({start})", "", "{name}", "When: {start} ({when})", "{description}", "", ] body = "\\\\n".join(lines) return f'sh -c "printf \\"{body}\\" | himalaya message send"' ``` The address validator excludes whitespace, commas, and extra `@` characters, but does not exclude sh ...[truncated 5942 chars]- Remediation
View remediation
