T09 · Insecure Skill Coding Practices
- Location
SKILL.md:903- Finding
Unvalidated Rate-Limit Values Interpolated into Shell Commands
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 903–930
Vulnerability Type: Command injection through unsafe shell interpolation
Risk Level: HighVulnerable code:
text ### Template: ClawHub Rate-Limit Wait When ClawHub returns 429 Too Many Requests: sessions_spawn( task="Install or publish skill to ClawHub, handling rate limits. If 429 received, wait Retry-After seconds then retry. Max 3 attempts.", label="clawhub-ops" ) Inside the subagent: 1. First attempt: run clawhub command 2. If 429: extract Retry-After header (e.g., 60 seconds) 3. exec(command="sleep {Retry-After}", yieldMs={Retry-After * 1000 + 1000}, timeout={Retry-After + 10}) 4. Second attempt: retry the clawhub command 5. If still 429 after 3 attempts: write error.md, reply to parent with failure ### Template: GitHub Rate-Limit Wait When GitHub API returns 403 with "rate limit exceeded": sessions_spawn( task="GitHub API operation, handle rate limits. If 403 received, wait suggested reset time then retry. Max 3 attempts.", label="github-ops" ) Inside the subagent: 1. Check for X-RateLimit-Reset header 2. Calculate wait time: (reset_timestamp - now) + 5 seconds buffer 3. exec(command="sleep {wait_seconds}", yieldMs={wait_seconds * 1000 + 1000}, timeout={wait_seconds + 30}) 4. Retry with Authorization header using token from TOOLS.mdTechnical Analysis
The Skill instructs an agent to extract values from remote HTTP response headers and interpolate them directly into command strings. It does not require strict numeric parsing, range validation, shell escaping, or argument-array execution.
If an implementation passes the resulting string to a shell, metacharacters embedded in an attacker-influenced value can terminate or extend the intended
sleepcommand. Arithmetic fields such asyieldMsandtimeoutdo not mitigate injection into the separate command string.The GitHub template ...[truncated 1322 chars]
- Remediation
View remediation
Remediation Suggestions
- Parse rate-limit values as base-10 integers and reject values containing anything other than the expected numeric syntax.
- Enforce a conservative range, such as
0 <= wait_seconds <= configured_maximum. - For date-based headers, use a trusted date parser and calculate the delay internally rather than evaluating header text.
- Execute
sleepwith an argument-array API, such as["sleep", str(wait_seconds)], without invoking a shell. - Do not construct
yieldMsortimeoutuntil numeric validation succeeds. - Treat missing, negative, overflowing, malformed, or excessively large values as errors and apply a fixed safe fallback.
- Add tests covering shell metacharacters, whitespace, negative numbers, decimal values, integer overflow, and excessive delays.
