Back to skill

Security audit

Ai Workflow Red Team Lite

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a defensive AI workflow review tool, but it needs human review because its documented command and script can mishandle user-controlled paths and overwrite writable local files.

Install only if you are comfortable with a local Python helper that reads paths you provide and may write report files. Use dry-run/stdout or a dedicated output directory, avoid passing untrusted filenames through a shell command, and do not let it run with access to sensitive workspace or home-directory files until path handling is tightened.

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
SKILL.md:33
Finding
Shell Command Injection Through Unquoted User-Controlled Path Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:33-34` **Vulnerability Type**: Shell command injection through unsafe command construction **Risk Level**: High ### Vulnerable Code ```markdown 5. If the runtime permits shell or exec, use: - `python3 "{baseDir}/scripts/run.py" --input <input-file> --output <output-file>` ``` The input and output placeholders above are rendered in English while preserving the command structure found in the source. ### Technical Analysis The Skill instructs an agent to construct and execute a shell command using input and output paths without quoting or validating those arguments. If either placeholder is derived from untrusted user input, shell metacharacters, command substitutions, redirection operators, or whitespace can alter the intended command. The Python script itself does not invoke a shell. The vulnerability arises when an agent follows the Skill instruction by interpolating user-controlled values into a command string and passing that string to a shell. Quoting only `{baseDir}` does not protect the two unquoted path arguments. Exploitability depends on the hosting agent exposing a shell-style execution tool and inserting requested paths directly into the documented command. ### Attack Path 1. An attacker invokes the Skill and supplies an input or output filename containing shell syntax. 2. The agent follows `SKILL.md:33-34` and substitutes that value into the unquoted command template. 3. The agent submits the resulting string to a shell or shell-compatible execution tool. 4. The shell interprets the embedded syntax rather than treating the entire value as one filename. 5. The injected command executes with the operating-system privileges and environment access of the agent process. ### Impact Assessment Successful exploitation permits arbitrary command execution under the account running the agent. The resulting scope can include: - Reading files accessible to the agent account. - Modifying ...[truncated 401 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require invocation through an argument-array API that does not use a shell, for example the equivalent of: ```python subprocess.run( ["python3", str(script_path), "--input", input_path, "--output", output_path], shell=False, check=True, ) ``` 2. Update `SKILL.md` to explicitly prohibit direct string interpolation into shell commands. 3. If a shell cannot be avoided, apply platform-appropriate shell escaping to every dynamic argument rather than relying on visual quotation. 4. Validate input and output paths before execution. Reject control characters, line breaks, null bytes, and unexpected path formats. 5. Prefer a dedicated execution tool with separately encoded arguments over a free-form shell tool. 6. Add automated tests using filenames containing spaces, quotes, command substitutions, separators, and redirection characters to verify that they are handled strictly as filenames. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/run.py:275
Finding
Unrestricted Arbitrary File Write Through the Output Argument<![CDATA[ ## Vulnerability Details **File Location**: `scripts/run.py:275-277` **Vulnerability Type**: Unrestricted file creation and overwrite **Risk Level**: Medium ### Vulnerable Code ```python output_path = Path(args.output).expanduser() output_path.parent.mkdir(parents=True, exist_ok=True) output_path.write_text(rendered, encoding="utf-8") ``` ### Technical Analysis The `--output` argument is converted directly into a filesystem path and written without enforcing an approved output directory. Absolute paths, parent-directory traversal, and home-directory expansion are accepted. Parent directories are created automatically, and existing files are overwritten without confirmation. The implementation also performs no explicit symlink protection. If the process can access a path through an attacker-controlled symlink, the final write may affect the symlink target. The actual files that can be changed remain limited by the operating-system permissions of the account running the script. Although the generated content is a report rather than arbitrary attacker-supplied bytes, portions of the input are reproduced in the report. An attacker can therefore influence the written content and target a writable file whose format can tolerate or interpret that content. ### Attack Path 1. An attacker requests report generation and supplies a sensitive writable location as `--output`, using an absolute path, traversal sequence, home-relative path, or an attacker-prepared symlink. 2. The agent invokes `scripts/run.py` with the requested output path. 3. The script expands the path and creates missing parent directories. 4. `Path.write_text()` creates or truncates the target file and writes the generated report. 5. The affected application or user later consumes the replaced file, potentially causing configuration corruption or behavior changes. ### Impact Assessment Successful exploitation can create or overwrite any file writable by the agent account. Potential cons ...[truncated 513 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Define a dedicated output directory and require every resolved output path to remain inside it: ```python output_root = (BASE_DIR / "output").resolve() output_path = (output_root / args.output).resolve() if output_path != output_root and output_root not in output_path.parents: return fail("Output path must remain inside the approved output directory.") ``` 2. Reject absolute output paths and path components containing `..`. 3. Refuse to write through symlinks. Validate each relevant path component and open the final file using platform-appropriate no-follow protections where available. 4. Do not overwrite existing files by default. Use exclusive creation or require an explicit `--overwrite` option. 5. Avoid automatically creating arbitrary parent-directory trees. Create only directories under the approved output root. 6. Apply least-privilege execution so the script account cannot modify application configuration, credentials, startup files, or unrelated projects. 7. Add tests covering absolute paths, traversal attempts, home expansion, existing files, and symlink targets. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Vague Triggers

Medium
Confidence
93% confidence
Finding
The trigger phrases are generic enough to overlap with normal user requests, which can cause the skill to activate in situations broader than intended. In a security-oriented skill, ambiguous activation increases the chance of unsolicited red-team style analysis on ordinary content, potentially exposing sensitive workflow details or bypassing user expectations about when this capability should engage.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The entire self-check document is written in Chinese and presents the skill assessment only in that language, with no indication that users may choose another language or that the locale restriction is required for a region-specific purpose. Under the policy, a language constraint without opt-in or clear justification is a natural-language policy violation.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill advertises executable capability via `python3` and references local files/templates, but it does not explicitly declare tool scope such as shell, file read, or file write permissions. This creates a trust and review gap: a host may expose broader capabilities than users or policy expect, increasing the chance of unintended command execution or filesystem access in a security-sensitive red-team context.

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
The skill description and primary instructions are written entirely in Chinese, which effectively constrains the interaction language without stating that users may choose another language. Under the policy, language or locale restrictions should either be optional or explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The file is entirely written as a Chinese-only skill example and provides no indication that language choice is optional or user-configurable. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless clearly justified as region-specific.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
This markdown file presents all user-facing content in Chinese and does not indicate that the language is optional, user-selected, or required for a justified region-specific purpose. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The title explicitly defines the template in Chinese, indicating the skill output is expected in a specific language. There is no accompanying note offering a language choice or explaining that Chinese is required for a justified region-specific use case.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
The generated report text is hard-coded in Chinese throughout the reporting functions, which imposes a specific language on users regardless of their preferences. This is a natural-language policy concern because the script does not offer a locale option or document that it is intentionally limited to a Chinese-only context.

Context-Inappropriate Capability

Medium
Confidence
87% confidence
Finding
The `skill_audit` path validates repository file presence and SKILL.md frontmatter structure for a skill package. That capability is about packaging/compliance validation, not about exercising misuse paths, boundary failures, or data leakage risks in AI workflows.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The manifest describes a skill for lightweight red-team exercises on AI automation workflows, emphasizing misuse paths, boundary failures, and data leakage risk. However, the dispatcher supports broad modes including generic structured summarization, directory inventory, CSV profiling, and skill packaging checks, which are general-purpose reporting/audit functions rather than AI-workflow-specific red teaming.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
All user-facing instructions and examples in the file are presented in Chinese, and the document does not state that the skill is China-region-specific or provide an opt-in language choice. This can violate a language/locale policy when users are expected to be able to interact without being forced into a specific language.

Context-Inappropriate Capability

Low
Confidence
80% confidence
Finding
`directory_report` and `csv_report` generate broad inventory-style reports such as extension distributions, markdown headings, and field uniqueness summaries. These are useful general audit utilities, but the manifest positions the skill as a lightweight AI workflow red-team tool focused on misuse and leakage risk, not as a general filesystem or dataset profiler.

Natural-Language Policy Violations

Low
Confidence
84% confidence
Finding
The heading uses a Chinese-only title for the smoke test, which suggests a language-specific presentation without any nearby indication that users can choose another language or that the locale restriction is required. Under the policy, forced language or locale without opt-in can be a natural-language policy violation.

Static analysis

No suspicious patterns detected.