Back to skill

Security audit

cjpkg

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly about Cangjie packages, but it asks agents to make broad local changes including shell profile edits, project mutation, builds, and arbitrary TOML writes.

Install only if you specifically want an agent to manage Cangjie packages and you are prepared to review every proposed shell command, project edit, download, and build. Do not allow it to edit shell startup files or run unquoted path-substitution commands without manual review.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:109
Finding

Shell Command Injection Through Unquoted User-Controlled Paths

Content
View full analysis
> .zshrc & source .zshrc # Windows CMD: setx PATH=%PATH%;SDK_PATH\envsetup.bat # Windows PowerShell: $env:Path += ";SDK_PATH\envsetup.bat" ``` ```bash # Lines 125–140 cjpm init --path cangjie_project_path python3 ./scripts/main.py -e cangjie_project_path/cjpm.toml dependencies.package_name package_version python3 ./scripts/main.py -e cangjie_project_path/cjpm.toml dependencies.organization::package_name package_version cd cangjie_project_path & cjpm build ``` ```bash # Lines 148–151 cjpm init --path cangjie_project_path --type=dynamic ``` ### Technical Analysis The Skill instructs the Agent to replace `SDK_PATH` and `cangjie_project_path` with values supplied by the user and then execute the resulting commands through a shell. These values are not quoted, validated, or passed as isolated process arguments. A path containing shell metacharacters, command substitution, redirection, environment expansion, or command separators can alter the structure of the command. Quoting only part of a command is also insufficient if the path is inserted before the shell parses it. The SDK setup command creates an additional persistent side effect by appending content to `.zshrc`. A maliciously constructed SDK path could cause attacker-controlled shell syntax to be stored in the shell configuration and evaluated when the configuration is sourced or when a later interactive shell starts. The command: ```bash cd cangjie_project_path & cjpm build ``` uses a single `&`, which backgrounds the `cd` operation rather than safely sequencing the directory change and build. Consequently, `cjpm build` may execute from the ...[truncated 1570 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.py:193
Finding

Predictable Download Destination Allows File Overwrite and Symbolic-Link Attacks

Content
View full analysis
None: req = urllib.request.Request(url) with urllib.request.urlopen(req, timeout=120) as resp: data = resp.read() with open(dest_path, "wb") as f: f.write(data) ``` ```python def _download_pkg(pkg_name: str, version: str, organization: str | None) -> int: os.makedirs(DOWNLOAD_DIR, exist_ok=True) safe_file = f"{pkg_name}-{version}.pkg".replace("/", "_").replace("\\", "_") dest = os.path.join(DOWNLOAD_DIR, safe_file) dl_url = build_download_url(pkg_name, version, organization) try: download_to_file(dl_url, dest) ``` ### Technical Analysis The destination name is deterministically derived from the package name and version and is placed in the fixed `~/Downloads` directory. The code then opens the destination using `"wb"`. This mode truncates an existing regular file without warning and follows a pre-existing symbolic link. The program does not verify whether the destination already exists, whether it is a symbolic link, or whether the resolved destination remains an ordinary file in the intended directory. Replacing forward and backward slashes reduces straightforward path traversal through those two separators, but it does not address pre-existing files, symbolic links, atomicity, or concurrent replacement of the destination between validation and creation. The complete HTTP response is also read into memory before it is written. Although not central to the link vulnerability, the absence of a maximum response size could cause excessive memory use if the registry or network response is unexpectedly large. ### Attack Path 1. An attacker who can write ...[truncated 1249 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:188
Finding

Unpinned Third-Party Package Execution Through npx

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • 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
Findings (18)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The manifest presents the skill as package discovery, but the body instructs the agent to download packages, modify project files, alter shell startup configuration, initialize projects, and build code. That mismatch undermines informed consent and can cause an agent to perform materially riskier actions than the user would expect from the description.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The skill's operational scope expands far beyond discovery into SDK installation, shell profile changes, project initialization, manifest editing, building, and publishing. This broad action surface materially increases the risk of unintended system changes, supply-chain exposure, and destructive modification under the guise of a simple lookup skill.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The activation guidance is so broad that it can match ordinary development questions, causing the skill to trigger in contexts where package discovery is not actually requested. Because the skill also contains mutating and execution steps, overbroad activation increases the chance of unsafe actions being proposed or taken unexpectedly.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The 'When to Use' section includes vague triggers like 'how do I do X' and 'can you do X', which overlap with many benign requests. In the context of a skill that can lead to downloads, file changes, and builds, ambiguous activation materially raises the risk of inappropriate escalation from advice to action.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs editing .zshrc and environment configuration, including sourcing shell scripts from a user-provided SDK path. Shell profile modification persists across sessions and can introduce long-lived compromise or instability if paths are wrong, malicious, or later replaced.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill directs the agent to initialize projects, edit cjpm.toml, and build in user-specified directories. These are write and execution actions that can overwrite existing state, alter dependencies, and run build hooks or untrusted package code, which is disproportionate to the declared discovery purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

This skill is described as a package discovery and retrieval utility, but it also includes general-purpose TOML read and write functionality for arbitrary local files. That materially expands the skill’s authority beyond its stated purpose and can be abused to inspect or modify local configuration or project metadata files, enabling persistence, dependency tampering, or workflow manipulation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The --set path allows modification of any local TOML file path supplied by the caller, then rewrites the file in place with no trust boundary enforcement. In a skill context, this enables arbitrary tampering with project manifests, tool configs, editor settings, or other TOML-based files unrelated to package search, which is especially dangerous because it appears unjustified by the skill’s stated purpose.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill documents network access, package download, and local file modification, but declares no explicit tool scope or permission boundaries. That increases the chance an agent may invoke filesystem or network actions without clear user-visible authorization or least-privilege constraints.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The instructions propose modifying shell startup files and PATH-like configuration without a prominent warning about persistence, rollback, or trust of sourced files. Users may not understand that this affects future shells and can break environments or introduce persistent execution of untrusted scripts.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill instructs initializing projects and editing dependency manifests without a warning that these actions can overwrite state or alter builds. Absent a caution and confirmation boundary, an agent may make irreversible or confusing changes in the wrong directory.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The package-development and publishing guidance broadens the skill into code authoring and release operations unrelated to package discovery. Publishing workflows can leak proprietary code or push unintended artifacts if invoked in the wrong context.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Earlier sections consistently describe searching the Cangjie Central Repository for packages via cjpm/scripts, but L182-L198 switches to talking about 'skills', searching for skills, and creating a new skill with 'npx skills init'. That documentation does not match the stated Cangjie package repository behavior and appears copied from a different intent domain.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
76% confidence
Finding

Referencing npx skills without a pinned version can cause execution of unexpected code if the upstream package changes or is compromised. Even in example text, this normalizes unsafe supply-chain practices and may lead users or agents to fetch mutable remote code.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
76% confidence
Finding

This second unpinned npx skills reference has the same supply-chain risk: it allows mutable remote package resolution at execution time. An attacker controlling or compromising the package or dependency chain could achieve arbitrary code execution in the user's environment.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring states the tool searches or downloads packages, but the implementation also reads and writes TOML files. This mismatch is dangerous because it conceals additional file-system capabilities from reviewers and users, increasing the chance that a higher-risk feature is invoked without proper scrutiny or informed consent.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The TOML set operation writes directly back to the target file with no confirmation prompt, dry-run mode, backup, or warning at execution time. Because the path is user-controlled and the file is overwritten in place, mistakes or abuse can silently corrupt important configuration files and make recovery difficult.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The function creates a directory and saves downloaded content to disk, which affects the user's filesystem. The command help says 'Download directly,' but it does not clearly warn where files will be written or that the operation will create local artifacts.

Content

No source excerpt is available for this finding.