T09 · Insecure Skill Coding Practices
- Location
scripts/generate_report.py:89- Finding
Shell Command Injection Through the Git Repository Path
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This report generator is not visibly deceptive, but it needs Review because an unsafe Git command can run arbitrary shell commands and generated HTML is not sanitized.
Review or fix the script before installing. Do not pass untrusted Git paths, CSV/JSON content, or Git commit messages to it; avoid HTML/PDF/email workflows until output escaping, path validation, and explicit send confirmation are added. Run it only in a restricted workspace with data you are comfortable including in a report.
scripts/generate_report.py:89Shell Command Injection Through the Git Repository Path
scripts/generate_report.py:193Stored HTML and Script Injection in Generated Reports
{md_content}claw.json:8Unnecessary and Unpinned Third-Party Dependencies
The skill is presented as a report generator, but it also accesses Git history and can transmit generated content via SMTP. Those behaviors expand the data collection and exfiltration surface beyond what many users would reasonably infer from the high-level description, creating a risk of harvesting sensitive repository metadata or emailing internal content without sufficiently explicit consent.
This is a true tool-parameter abuse issue because attacker-controlled input is passed into a shell command context, enabling misuse of the Git tool invocation to execute arbitrary commands. In an agent skill, this is especially dangerous because repository paths may come from user-provided parameters or connected data sources, turning a reporting feature into code execution.
"""从Git仓库提取今日提交记录"""
try:
cmd = f'git -C "{repo_path}" log --since="{days} days ago" --pretty=format:"%h|%an|%s|%ad" --date=short'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode != 0:
print(f"[WARN] Git仓库读取失败: {result.stderr.strip()}")
return []
The README advertises automatic email sending even though the skill is described primarily as a report generator, expanding behavior into outbound communication and possible data exfiltration. In a skill that aggregates CSV/JSON/Git data, sending reports by email can transmit sensitive work information without clear scope boundaries, consent prompts, or recipient restrictions.
The skill description omits a clear warning that it may collect data from multiple sources and automatically send generated reports by email. Because daily reports can include internal project status, risks, and personnel attribution, missing disclosure undermines informed consent and can lead to unintended disclosure of sensitive business information.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
## 使用方法
The invocation phrases are broad and underspecified, which can cause the skill to trigger on generic requests like 'daily report' without confirming data sources, output format, or whether side effects such as email sending are intended. Overbroad activation increases the chance of unintended processing of local/project data and accidental execution of sensitive features.
The skill instructs the agent to read input files, write output reports, and execute a Python script, but it declares no explicit tool scope or permission boundaries. That creates an authorization gap where an agent may use filesystem and shell capabilities without a clear least-privilege contract, increasing the chance of unintended file access or command execution against user-supplied paths.
The trigger phrases are broad enough that normal conversation about reports or summarizing work could invoke the skill unintentionally. In this skill's context, accidental activation matters because it can lead to file access, Git inspection, script execution, and possibly email sending, turning a prompt-matching issue into a security-relevant consent problem.
The skill states that it collects data from multiple sources and can send email, but it does not prominently warn users that local files, JSON/CSV content, Git commit history, and generated reports may be accessed or transmitted. In an enterprise reporting context, that omission is dangerous because the accessed material is likely to contain sensitive internal project details, employee activity, or other confidential information.
The manifest requests the "exec" permission even though the stated purpose is generating daily work reports from collected data. For a reporting skill, process execution is not inherently required and materially expands the attack surface by allowing spawned commands or auxiliary programs, which could be abused for arbitrary code execution or unauthorized local actions if the skill logic is compromised or extended unsafely.
This code file contains user-facing natural-language content entirely in Chinese, including the title, usage, CLI help, and generated report sections, but nowhere indicates that the tool is China-region-specific or that users may choose another language. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The manifest focuses on collecting data from sources and generating reports, but the implementation invokes external programs via subprocess for both git log access and wkhtmltopdf-based PDF rendering. Spawning system commands is a broader execution capability that is not stated in the manifest and is not necessary to justify at the intent level for a daily report generator.
This is a true command-injection risk because untrusted input (repo_path) is interpolated into a shell command and executed with shell=True. An attacker who can control the repository path could inject additional shell metacharacters or commands, leading to arbitrary command execution in the agent environment.
"""从Git仓库提取今日提交记录"""
try:
cmd = f'git -C "{repo_path}" log --since="{days} days ago" --pretty=format:"%h|%an|%s|%ad" --date=short'
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode != 0:
print(f"[WARN] Git仓库读取失败: {result.stderr.strip()}")
return []
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
# 尝试使用 wkhtmltopdf
try:
subprocess.run(
["wkhtmltopdf", "--quiet", html_path, output_path],
check=True,
capture_output=True,
The manifest describes collecting work data, analyzing it, and producing a structured daily report in Markdown, HTML, or PDF. This code also sends the generated report over SMTP, which is a distinct outbound communication capability not mentioned in the stated skill purpose or output formats.
The HTML formatter sets lang="zh-CN" and emits Chinese footer/content conventions, which enforces a Chinese locale in generated artifacts. Because the skill does not expose a locale choice or explain a justified regional limitation, this conflicts with the language/locale policy.
No suspicious patterns detected.