Back to skill

Security audit

Cli Builder

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly matches a CLI code-generator purpose, but it has under-disclosed local logging and unsafe template output that users should review before installing.

Review this skill before installing. Use only trusted inputs when generating code, inspect generated snippets before running them, and be aware that one bundled script can create a local history file containing command arguments.

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
scripts/cli-builder.sh:165
Finding

Executable Code Injection Through Unsanitized Template Parameters

Content
View full analysis

Vulnerability Details

File Location: scripts/cli-builder.sh, lines 165-170
Vulnerability Type: Code injection in generated source code
Risk Level: Medium

The command generator embeds caller-controlled command names and descriptions directly into Python source code without validating identifiers or escaping string literals.

python
print('sub = subparsers.add_parser("{}", help="{}")'.format(cmd, desc))
print('sub.add_argument("--flag", type=str, help="Flag description")')
print('sub.set_defaults(func=handle_{})'.format(cmd.replace("-", "_")))
print("")
print("def handle_{}(args):".format(cmd.replace("-", "_")))
print('    """{}"""'.format(desc))

Technical Analysis

The cmd and desc variables originate from command-line arguments and are transferred through environment variables before being interpolated into executable source templates. Replacing hyphens in cmd does not make it a valid or safe Python identifier, while desc receives no escaping at all.

An attacker can close the generated string literal and append arbitrary Python statements. For example, a description resembling:

text
"); __import__("os").system("id"); #

causes the generator to emit code equivalent to:

python
sub = subparsers.add_parser("serve", help=""); __import__("os").system("id"); #")

The injected statement executes when the generated Python program reaches that line. Similar unsafe interpolation patterns also occur elsewhere in the same script for generated JavaScript, Bash, Go, argument definitions, and interactive prompts.

The generator only prints templates and does not automatically execute the generated payload. Exploitation therefore depends on a user copying, saving, or otherwise using the generated output as executable source code. This remains significant because SKILL.md explicitly describes the output as “copy-paste ready.”

Attack Path

  1. An attacker supplies a c ...[truncated 1161 chars]
Remediation
View remediation

Remediation Suggestions

  1. Validate command names and generated identifiers using strict, language-specific allowlists. For Python identifiers, require a pattern such as ^[A-Za-z_][A-Za-z0-9_]*$ after intentional normalization.
  2. Serialize user-controlled string literals rather than placing them between manually constructed quotes. For Python output, use repr() or another trusted literal encoder.
  3. Use an appropriate serializer for each target language, such as json.dumps() for JavaScript string values. Do not reuse one language's escaping rules for another language.
  4. For Bash output, strictly validate names used as variables or case patterns and safely quote all data values. Reject shell metacharacters rather than attempting incomplete substitutions.
  5. Keep identifiers and textual literals as separate template types. Identifiers should be validated; literals should be encoded.
  6. Reject embedded line breaks, control characters, braces, quotes, command substitutions, and statement separators where they are not explicitly supported.
  7. Add regression tests with adversarial values containing quotes, backslashes, newlines, semicolons, shell substitutions, comment markers, and invalid identifiers.
  8. Do not characterize generated output as “copy-paste ready” until every supported language path applies correct validation and escaping.
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared purpose is a CLI generator, but the analyzed behavior reportedly includes persistent local logging of command invocations and arguments and unrelated developer workflow actions, while failing to implement the promised scaffolding features. This mismatch is dangerous because it can mislead users into granting trust to a skill that performs undisclosed data collection or unintended actions, including recording potentially sensitive arguments such as tokens, paths, or internal commands.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill advertises code-generation and scaffolding behavior but does not declare any explicit tool scope or permissions despite static analysis detecting capabilities consistent with environment access and file read/write. In an agent setting, undeclared side effects increase the risk of unauthorized filesystem interaction or access to sensitive local data because consumers cannot accurately constrain or review what the skill may do.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The script emits example code that creates configuration directories and writes config files under the user's home directory, but there is no warning, confirmation, or user-facing disclosure accompanying this behavior in the generated snippet or surrounding shell script. Because this is a code file and the operation performs file writes, it meets the missing-warning criterion.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest describes a CLI tool generator with scaffolding, argument parsing, help docs, config handling, publish checklist, and interactive prompts. In contrast, this script presents itself as a generic 'Developer workflow automation tool' and mainly echoes status messages while logging command usage to a history file, without implementing CLI generation or scaffolding behavior.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Commands such as init, check, build, test, docs, and clean suggest real project scaffolding or automation consistent with the manifest, but each handler only prints a message and writes a log entry. This is a semantic mismatch between the skill's described capabilities and the code's actual no-op behavior.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.