T09 · Insecure Skill Coding Practices
- Location
SKILL.json:2- Finding
Unrestricted Local Python Code Execution Exceeds the Document-Creation Scope
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.json, lines 2-8
Vulnerability Type: Arbitrary local code execution through an unrestricted command argument
Risk Level: HighVulnerable Code
json "name": "python-exec", "description": "Executes Python code locally via PowerShell", "commands": { "run": { "arguments": { "code": "string" } } }Technical Analysis
The
runcommand accepts a generic string namedcode, while the skill description states that the supplied Python code is executed locally through PowerShell. No command schema, operation allowlist, module restriction, path constraint, sandbox requirement, or input validation is declared.This interface exposes substantially more capability than the Office-document creation purpose documented in
SKILL.md. Python code is not limited topython-docx,openpyxl, orpython-pptx; it can use standard-library functions such as file operations, subprocess creation, environment inspection, and network access where permitted by the host.The package does not include the command implementation, so implementation-specific safeguards cannot be verified. Nevertheless, the declared unrestricted source-code interface itself creates an unsafe execution boundary: if untrusted or attacker-influenced content reaches
run.code, it may be interpreted as executable Python rather than document data.Attack Path
- An attacker supplies content that influences or controls the
codeargument passed to the skill'sruncommand. - The Agent invokes
runwhile processing a document-generation request. - The skill passes the unrestricted string to local Python execution through PowerShell, as declared in
SKILL.json. - The Python payload performs operations unrelated to document creation, such as reading or modifying files, inspecting environment variables, starting subprocesses, or initiating network requests.
- Thos ...[truncated 1035 chars]
- An attacker supplies content that influences or controls the
- Remediation
View remediation
Remediation Suggestions
- Remove the generic
codeargument and replace it with narrowly scoped operations such ascreate_word_document,create_spreadsheet, andcreate_presentation. - Accept validated structured data rather than executable source code. Define strict schemas for document content, output format, and formatting options.
- Restrict output paths to a dedicated workspace. Canonicalize paths and reject absolute paths and traversal sequences.
- If generic Python execution is an intentional requirement, run it in an isolated sandbox with:
- A non-privileged, disposable operating-system identity.
- Read-only or explicitly allowlisted filesystem mounts.
- Network access disabled by default.
- Process, CPU, memory, execution-time, and output-size limits.
- Subprocess and dangerous module restrictions.
- No inherited secrets, credentials, or sensitive environment variables.
- Require explicit, informed user approval immediately before executing arbitrary code, showing the exact code and requested capabilities.
- Add authorization checks and audit logging for each execution, including the caller, code digest, approved capabilities, output paths, and result.
- Include the actual execution implementation in the reviewable package so that quoting, PowerShell invocation, sandboxing, and validation controls can be audited.
- Keep the moderator-approval requirement documented in
SKILL.md, but do not treat approval alone as a substitute for technical isolation and least privilege.
- Remove the generic
