Back to skill

Security audit

Exec Reducer

Security checks for vulnerabilities and agentic risk

Overview

This skill is a simple file utility, but it can read and overwrite arbitrary accessible files without clear scope limits or overwrite safeguards.

Install only if you are comfortable with an agent using this helper on local files. Avoid using it on sensitive directories, credentials, configuration files, or important files unless you have reviewed the exact path and content to be written.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
exec-reducer.py:22
Finding

Unrestricted Filesystem Read and Overwrite Through User-Controlled Paths

Content
View full analysis

Vulnerability Details

File Location: exec-reducer.py, lines 22-27
Vulnerability Type: Arbitrary file read and overwrite
Risk Level: Medium

Vulnerable Code

python
if cmd == "read" and len(sys.argv) > 2:
    with open(sys.argv[2], 'r', encoding='utf-8') as f:
        print(f.read())
elif cmd == "write" and len(sys.argv) > 3:
    with open(sys.argv[2], 'w', encoding='utf-8') as f:
        f.write(sys.argv[3])

Technical Analysis

The file path passed in sys.argv[2] is used directly by open() without path normalization, workspace containment checks, symlink validation, an allowlist, or overwrite confirmation. Absolute paths and path-traversal sequences can therefore reference files outside the intended project directory.

The read operation prints the complete contents of any UTF-8 text file accessible to the process. The write operation opens the target in w mode, immediately truncating an existing file before writing attacker-controlled content. Security depends entirely on the operating-system privileges of the Agent process rather than on restrictions imposed by the Skill.

Attack Path

  1. An attacker supplies malicious instructions or otherwise influences the path passed to the Skill.
  2. The Agent invokes the script with read and an absolute or traversal-based path to a sensitive file, or with write and a path to a security-relevant file.
  3. The script passes the path directly to open().
  4. For read, accessible file contents are printed into Agent output and may be disclosed.
  5. For write, the target file is truncated and replaced with attacker-controlled content.
  6. The attacker obtains access to data or causes modifications within the full filesystem scope available to the Agent's operating-system account.

Impact Assessment

Successful exploitation can disclose readable text files such as source code, configuration files, local credentials, t ...[truncated 593 chars]

Remediation
View remediation

Remediation Suggestions

  1. Define an explicit workspace root and permit access only to files beneath that directory.
  2. Normalize and resolve every supplied path before access, then verify containment using pathlib.Path.resolve() and Path.relative_to().
  3. Reject absolute paths, traversal outside the workspace, device files, and other sensitive filesystem locations.
  4. Detect and reject symbolic links, or securely verify that both the requested path and final resolved target remain within the allowed root.
  5. Require explicit confirmation before overwriting an existing file. Prefer exclusive creation mode (x) when replacement is unnecessary.
  6. Apply separate permissions for reading and writing, with narrower writable directories.
  7. Run the Skill under a dedicated, least-privileged operating-system account.
  8. Avoid printing sensitive file contents into logs or persistent Agent transcripts.
  9. Where possible, replace arbitrary paths with opaque workspace-relative file identifiers selected from an allowlist.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (5)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger condition says to use the skill whenever bulk file processing, searching, or writing is needed, but it provides no limiting criteria, approval requirements, or safety boundaries. In an agent setting, this can cause the skill to be invoked for sensitive filesystem operations too broadly, increasing the chance of unintended modification or access to user data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill exposes a write capability that can modify files, but the documentation gives no warning that it changes user data, no mention of confirmation, and no restrictions on target locations. This makes accidental overwrites, tampering, or misuse by an agent more likely, especially because the skill is framed as a convenience wrapper for reducing direct exec calls.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script performs a file overwrite via the write command, but there is no confirmation prompt, warning message after invocation, or inline comment/docstring disclosing that this operation modifies user data. The brief usage text lists the command, but it does not warn that the action overwrites existing file contents and may be destructive.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The top-level docstring describes the skill entirely in Chinese, indicating a fixed language choice without offering a user language or locale option. This can violate language/locale policy when the skill is not clearly documented as region-specific or opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The usage/help text says the skill supports append <file> <content> - 追加写入, but the command dispatch implements read, write, list, and search only. This is an active contradiction between the documented interface and actual behavior, which can mislead users about the skill's capabilities.

Content

No source excerpt is available for this finding.