Back to skill

Security audit

System Commander

Security checks for vulnerabilities and agentic risk

Overview

This skill is a Linux command helper, but it can produce unsafe copy-paste commands that modify files or allow command injection if generated output is executed.

Review generated commands manually before running them, especially when prompts or filenames may come from someone else. Do not feed this skill's output directly into an executor, and require dry runs, backups, constrained paths, and explicit confirmation before file writes, batch renames, recursive edits, or package installs.

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

Error
Location
scripts/translate.py:111
Finding
Command and Python Code Injection Through Unsanitized Path Interpolation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/translate.py:14-19`, `scripts/translate.py:111-118`, and `scripts/translate.py:137-138` **Vulnerability Type**: Command injection and generated Python code injection **Risk Level**: High ### Vulnerable Code Command templates directly embed path parameters into executable Bash and Python strings: ```python r"list|show|find.*files?|ls": { "cmd": "ls -la {path}", "python": "import os; print('\\n'.join(os.listdir('{path}')))" }, # File content viewing r"cat|view|show.*content|read.*file": { "cmd": "cat {file}", "python": "with open('{file}') as f: print(f.read())" }, ``` The path extractor accepts arbitrary non-whitespace characters in an absolute path: ```python # Extract file paths file_matches = re.findall(r'[\w\-./]+\.[\w]+|[\w\-./]+/|/[^\s]+', text) if file_matches: for m in file_matches: if '.' in m or m.endswith('/'): params["file"] = m params["path"] = m break ``` The extracted values are then inserted into command and source-code templates without context-aware escaping: ```python cmd = commands["cmd"].format(**params) py_cmd = commands["python"].format(**params) ``` ### Technical Analysis The regular-expression branch `/[^\s]+` accepts every non-whitespace character after an initial slash. This includes shell metacharacters such as semicolons, command substitutions, backticks, redirection operators, and quote characters. The resulting attacker-controlled string is passed directly to `str.format()` and inserted into Bash command templates. The path is not quoted consistently and is never escaped with a shell-aware mechanism such as `shlex.quote()`. Consequently, a path can terminate the intended command argument and introduce another shell operation. The same data is embedded between quotes in generated Python source. An attacker can include quote characters that terminate the intended string literal and introduce arbitr ...[truncated 2002 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Avoid generating shell source from untrusted input.** Represent commands as structured argument arrays, for example: ```python ["cat", user_path] ``` Downstream execution should use `subprocess.run(arguments, shell=False, check=True)`. 2. **Apply context-aware escaping when textual Bash output is unavoidable.** Quote each untrusted argument with `shlex.quote()`: ```python import shlex safe_file = shlex.quote(params["file"]) ``` Escaping must occur after parsing and immediately before insertion into a shell command. 3. **Do not insert input into generated Python string literals.** Use `repr()` or structured serialization: ```python safe_file_literal = repr(params["file"]) py_cmd = f"with open({safe_file_literal}) as f: print(f.read())" ``` Prefer passing the path as an external argument rather than generating Python source. 4. **Validate path inputs.** Reject control characters, newlines, NUL bytes, and malformed paths. If the intended use permits access only within a specific directory, resolve the path with `pathlib.Path.resolve()` and verify that it remains under the authorized root. 5. **Handle option-like filenames safely.** Use the `--` end-of-options marker where supported, such as `cat -- "$file"`. 6. **Separate destructive operations from ordinary translation.** Commands such as `sed -i` should require explicit confirmation and should provide a non-destructive preview or backup option first. 7. **Add security regression tests.** Include paths containing semicolons, `$()`, backticks, single and double quotes, redirection operators, spaces, newlines, and leading hyphens. Verify that each value remains one literal argument and cannot alter command structure. 8. **Warn users about execution boundaries.** Clearly state that generated output must be reviewed before execution, particularly when input may originate from an untrusted party. ]]>
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 (11)

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger patterns are broad enough to activate on many ordinary user requests, which can cause this skill to be selected in contexts where direct system-command generation is unsafe or inappropriate. In an agentic environment, overbroad activation increases the chance of producing shell commands for ambiguous tasks, including commands that touch files or system state without sufficient safety review.

Vague Triggers

Medium
Confidence
91% confidence
Finding
The activation guidance uses vague criteria like 'system first' and 'minimize AI inference,' which favor command generation before safety or contextual validation. That ambiguity can cause the skill to activate for tasks that involve sensitive files, privileged operations, or security-relevant changes where human confirmation should come first.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill recommends in-place text replacement (`sed -i`) as a normal solution without a safety warning, backup advice, or confirmation step. That is dangerous because a copied command can irreversibly modify files, and in an automated or semi-automated agent setting this can lead to unintended data corruption at scale.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The batch rename examples include executable rename commands that can affect many files and are not easily reversible if naming collisions or pattern mistakes occur. Although a dry run is shown in one example, the skill lacks a broader safety rule requiring confirmation, backup strategy, or collision checks before bulk renames.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The multi-file in-place replacement examples combine file selection with `sed -i`, enabling bulk destructive edits across many matching files without explicit warnings. In context, this skill is designed to optimize system-level actions, so omission of safeguards is more dangerous because users may trust and paste commands that silently alter large sets of files.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill emits destructive commands that modify files in place without any user-facing warning, dry-run behavior, or confirmation requirement. In the context of an agent skill that converts natural language to commands, this increases the chance that a user or downstream automation will execute a harmful modification believing it to be a routine text-processing action.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The skill generates destructive file-modification commands such as `sed -i` and Python code that overwrites the target file in place, but it presents itself as a general task-to-command translator without safety gating. In an agent setting, this can cause unintended data loss or unauthorized modification if natural-language input is translated and later executed without explicit confirmation.

Missing User Warnings

Low
Confidence
80% confidence
Finding
The package installation examples modify system state and may require elevated privileges, but they are presented as routine prerequisites without warning. This is lower severity than file-destruction cases, yet it can still lead users to change environments unexpectedly, especially in production, containers, or restricted hosts.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The module docstring states it translates natural language to optimal Linux/Python commands, which imposes a specific platform choice in natural-language behavior. The file does not offer user opt-in, alternative locales/platforms, or a documented reason for this constraint.

Context-Inappropriate Capability

Low
Confidence
83% confidence
Finding
For file type detection, the skill's Python output uses `subprocess.run(['file', '{file}'])` instead of a direct Python-only implementation. Given the stated purpose is to translate tasks into optimal Linux/Python commands for file and text processing, embedding subprocess orchestration inside the Python variant is an unjustified extra capability rather than a direct requirement.

Static analysis

No suspicious patterns detected.