T09 · Insecure Skill Coding Practices
- Location
downloader.py:214- Finding
OS Command Injection Through the User-Controlled Report Type
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This financial-report downloader has a coherent purpose, but crafted report-type input can be interpreted as shell commands and run arbitrary local commands.
Review carefully before installing. Use only trusted, fixed report-type values, avoid passing free-form input, and prefer --dry-run until the shell=True command construction is fixed with argument-list subprocess calls and strict report-type allowlisting. Expect the skill to contact external financial disclosure sources and store downloaded files in the OpenClaw workspace.
downloader.py:214OS Command Injection Through the User-Controlled Report Type
This is a classic tool-parameter abuse issue: subprocess.run is invoked with shell=True, so attacker-controlled parameters can alter the meaning of the command rather than being passed as data. In an agent skill, this is especially dangerous because the skill is explicitly designed to process external inputs and orchestrate other tools/scripts, making it an attractive command-execution primitive.
print()
try:
result = subprocess.run(
cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True,
The skill documents direct execution of Python scripts, shell script creation, and filesystem writes, but it does not declare any explicit tool scope such as permissions or allowed-tools. This creates a trust gap where an agent or user may invoke shell and file access beyond what is transparently disclosed, increasing the risk of unintended command execution or access to sensitive local paths.
The primary description is written in Chinese and presents report-type parameters such as 年报/中报 as the default interaction model, without stating that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is justified and documented.
The code claims subprocess is a safer replacement for os.system, but the actual implementation still uses shell=True with a dynamic string. That preserves the primary risk of shell injection while potentially giving a false sense of safety to maintainers and users, making misuse more likely to persist unnoticed.
Shell command execution is assembled from values that are directly or indirectly user-controlled, yet there is no explicit guardrail, escaping, or warning that dangerous characters are prohibited. Because this skill accepts free-form stock identifiers and names, malicious input can exploit shell parsing rather than merely causing a failed lookup or download.
The helper executes dynamically constructed command strings with subprocess.run(..., shell=True). Multiple command components are derived from user-influenced inputs such as stock identifier, mapped company name, and report type, so shell metacharacters in those values can lead to command injection and arbitrary command execution. In this skill's context, the tool runs local scripts from privileged filesystem paths, which increases the blast radius.
print()
try:
result = subprocess.run(
cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
universal_newlines=True,
SQP-3 applies to natural-language policy issues in any file, including markdown. This document forces a single language for all instructions and examples without user opt-in or justification, which may violate language/locale neutrality expectations.
The documented behavior is a 'downloader' for global financial reports, which implies outbound network access to third-party sources. For markdown files, SQP-2 requires warnings about behaviors that may affect privacy or system integrity; here, there is no explicit user-facing notice that the skill will contact external services to fetch documents.
This is a markdown file, so SQP-2 applies to omissions in user-facing safety disclosures. The README states where downloaded files are saved, but it does not explicitly warn that the skill will create and persist files under /root/.openclaw/workspace/exports/, which affects local data storage and filesystem state.
The 'Output Files' section says downloaded files are written under /root/.openclaw/workspace/exports/, but the later 'Related Files' section lists the output as /root/.openclaw/workspace/archive/. These are mutually inconsistent statements about where the downloader stores its results, creating an intent/documentation mismatch.
This markdown file describes that the skill downloads reports and creates JSON, CSV, and PDF files under fixed export directories, which affects local user data and disk usage. Although the behavior is described functionally, there is no explicit warning or caution about filesystem writes, storage impact, or overwriting/accumulating downloaded data.
The file's natural-language interface text, descriptions, and CLI help are entirely in Chinese, with no indication that users may select another language or locale. Under the stated policy, forcing a specific language without opt-in is a natural-language policy concern.
This JSON manifest-like data uses Chinese descriptions and labels as the apparent default presentation language, but the file does not indicate that users can opt into this locale or that the skill is intentionally region-specific. Under the policy for natural-language violations, forcing a specific language without user choice can be a locale-policy issue.