T09 · Insecure Skill Coding Practices
- Location
SKILL.md:239- Finding
Command Injection Through Unescaped Workflow Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 239–304
Vulnerability Type: Command injection through string-based command construction
Risk Level: HighVulnerable Code
python self.call_skill('auth', f'check-access --username {user} --client {afm} --action compliance_management') client = self.call_skill('clients', f'view --afm {afm} --compliance-summary') deadlines = self.call_skill('monitoring', f'check aade --client {afm}') self.call_skill('banking', f'reconcile --afm {afm} --period {month}') vat = self.call_skill('compliance', f'vat-return --client {afm} --period {month} --prepare') efka = self.call_skill('efka', f'contribution-calc --afm {afm} --period {month}')python def call_skill(self, skill_type, command): """Execute command on specific skill with error handling""" skill_name = self.skills[skill_type] try: result = openclaw_execute(f"openclaw skills use {skill_name} {command}") return result except Exception as e: self.handle_skill_error(skill_name, command, e) return self.get_fallback_result(skill_type)Technical Analysis
Workflow parameters such as
user,afm, andmonthare inserted directly into command strings using Python formatted-string interpolation. The resulting string is passed toopenclaw_executewithout visible validation, escaping, or separation into a fixed executable and an argument array.If
openclaw_executeinvokes a command shell, an attacker-controlled parameter containing shell metacharacters, command substitutions, redirections, or additional command-line tokens could alter the intended command. Even if no shell is used, unrestricted additional arguments may still manipulate the downstream OpenClaw command.The documented AFM and period formats are not enforced by the shown implementation. Expected constraints such as
ELfollowed by nine digits and a strict `YYYY-MM ...[truncated 1419 chars]- Remediation
View remediation
Remediation Suggestions
- Replace string-based execution with an API that accepts a fixed executable and an argument array, with shell processing explicitly disabled.
- Validate each parameter before dispatch:
- AFM:
^EL[0-9]{9}$ - Period: a strict
YYYY-MMvalue with a valid month - Username: an explicit allowlist of permitted characters and bounded length
- AFM:
- Reject values beginning with option prefixes or containing whitespace, control characters, shell metacharacters, or path separators unless explicitly required.
- Do not rely exclusively on quoting or escaping; structured argument passing should be the primary control.
- Define typed command objects rather than allowing arbitrary command strings to cross the orchestration boundary.
- Execute delegated skills using a dedicated, least-privileged operating-system account with access only to the required client and workflow data.
- Add tests containing command separators, substitutions, redirections, newlines, and injected options to verify that all such values are rejected.
