Back to skill

Security audit

工作量拆分-Cosmic

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent COSMIC document-analysis purpose, but its shell-command handling of user-supplied paths creates a real review-worthy safety concern.

Install only if you trust the requirement documents and can run the workflow in a restricted workspace. Avoid paths or filenames containing shell metacharacters, review generated CSV files before opening them in spreadsheet software, and prefer a patched version that uses safe filesystem APIs instead of shell commands for path handling.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
prompts/workspace-prep.md:16
Finding

Shell Command Injection Through User-Controlled Document Paths

Content
View full analysis
" ``` ### 2. Prepare the Markdown requirement document Check the requirement document format: **If it is a `.md` file**: - Use the Shell tool to copy the file to the output path ```bash cp "" "/" ``` ``` The original prompt uses localized placeholder names, but the operative commands are the `mkdir -p` and `cp` invocations shown above. ### Technical Analysis The workspace-preparation prompt instructs a subagent to interpolate the user-provided requirement path and derived document name directly into shell commands. Enclosing a value in double quotes does not make it safe for shell evaluation. Command substitutions using `$()` or backticks remain active inside double-quoted strings. Shell metacharacters that are interpreted during expansion can therefore result in command execution if an attacker-controlled path is inserted into the command without robust escaping. The source document path originates from user input, while the output directory is derived from the source filename. Consequently, both commands can process attacker-controlled text. The prompt does not require: - Canonicalization of the supplied path. - Validation of the filename against an allowlist. - Rejection of shell substitution syntax. - Argument-safe filesystem APIs. - Verification that the resolved destination remains under the intended `results/` directory. ### Attack Path 1. An attacker supplies a requirement document whose path or filename contains shell substitution syntax, such as: ```text docs/spec$(touch /tmp/skill-pwned).md ``` 2. The main Skill derives the output directory from this filename and passes the v ...[truncated 1420 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/md2csv.py:15
Finding

CSV Formula Injection in Markdown-to-CSV Conversion

Content
View full analysis
None: content = pathlib.Path(md_path).read_text(encoding="utf-8") lines = [l.strip() for l in content.splitlines() if l.strip().startswith("|")] separator_re = re.compile(r"^\|[\s\-:|]+\|$") data_lines = [l for l in lines if not separator_re.match(l)] if not data_lines: logger.warning("No table data found in %s", md_path) sys.exit(1) row_count = 0 with open(csv_path, "w", encoding="utf-8-sig", newline="") as f: writer = csv.writer(f) for line in data_lines: cells = [c.strip() for c in line.split("|")[1:-1]] writer.writerow(cells) row_count += 1 ``` The source contains localized log text, but that text does not affect the vulnerable data flow. ### Technical Analysis Markdown table cells are written directly into a CSV file without neutralizing values that spreadsheet applications may interpret as formulas. Python's `csv.writer` correctly escapes CSV delimiters and quotes, but it does not protect against spreadsheet formula evaluation. A cell whose first significant character is `=`, `+`, `-`, or `@` may be evaluated when the resulting CSV is opened in spreadsheet software. Tab, carriage-return, and similar prefix characters can also be used to bypass simplistic checks in some spreadsheet environments. The input Markdown can contain requirement-derived or otherwise attacker-influenced content. The conversion script also accepts arbitrary input and output paths from command-line arguments, making the unsafe conversion behavior independently reachable whenever an attacker can influence the source Markdown. Formula effects depend on the spreadsheet product and its security configuration. Possible payloads include deceptive hype ...[truncated 1825 chars]
Remediation
View remediation
str: if value.startswith(DANGEROUS_PREFIXES): return "'" + value return value ``` Apply it to every cell: ```python cells = [ neutralize_csv_cell(c.strip()) for c in line.split("|")[1:-1] ] writer.writerow(cells) ``` 2. Consider treating leading spaces and control characters carefully so they cannot be used to conceal a dangerous formula prefix. 3. If strict preservation is required, offer a safe export mode that writes potentially dangerous cells as explicit text and document how the selected spreadsheet applications interpret the chosen escaping convention. 4. Add automated tests for cells beginning with: ```text = + - @ tab carriage return leading whitespace followed by a formula prefix ``` 5. Warn users that exported CSV files contain untrusted requirement-derived content and should be opened with external links, macros, and active content disabled. 6. Where practical, use a safer structured format or generate an `.xlsx` file with cells explicitly typed as text rather than relying on CSV interpretation. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个高层次的 COSMIC 工作量拆分/功能点分析工作流,其核心能力应包括解析需求文档、识别功能点、拆分子过程并输出结构化结果。给定代码并未执行任何 COSMIC 分析或拆解逻辑,只是把已存在的 Markdown 表格提取并保存为 CSV。虽然“生成 CSV 文件”与声明部分吻合,但这只是声明工作流中的辅助导出步骤,无法代表整体声明用途。因此描述与实际行为存在明显不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill instructs the agent to read and write local files across multiple workflow steps, but it does not declare any explicit tool scope such as allowed-tools or permissions. That creates an authorization ambiguity where the runtime may permit broader file access than users expect, increasing the risk of unintended reads, overwrites, or processing of attacker-supplied paths.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill tells the agent to run a local Python command that transforms a Markdown file into CSV and to generate or modify output files, but the skill description does not warn users that local command execution and filesystem modification will occur. This reduces informed consent and can surprise users with code execution in their environment, especially if paths or scripts are replaced, tampered with, or pointed at unexpected files.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Line L001 defines the agent role and all subsequent instructions are written as mandatory Chinese-language behavior, with no indication that the user may choose another language or locale. This is a natural-language policy concern because it imposes a specific language without opt-in or documented justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The prompt is written as a direct role instruction in Chinese and all required output examples and file names are Chinese, which effectively constrains the agent to a specific language. The file does not provide any user opt-in, language selection mechanism, or justification that this must be a China-specific or Chinese-only workflow.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The prompt directs the agent to execute Windows PowerShell commands against a user-influenced file path as a fallback for counting headings and checklist items. Even though the intended purpose is simple document statistics, introducing shell execution is unnecessary for this skill’s core text-analysis task and expands the attack surface to command execution, path-handling mistakes, and environment-specific abuse if paths or command construction are not strictly controlled.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The prompt is written as a direct instruction in Chinese and defines the agent role entirely in that locale, with no opt-in or alternative language handling. Under the policy criteria, forcing a specific language without user choice is a natural-language policy violation unless clearly justified as region-specific, which is not stated here.

Content

No source excerpt is available for this finding.