Back to skill

Security audit

代码所有权体检 Code Ownership Audit

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to do a local code audit, but its paid unlock path is under-scoped and has risky payment-tool installation and certification-integrity issues.

Review this before installing: the free audit path is local, but paid certification involves a remote payment service, an external Alipay wallet CLI, and real payment actions. Do not let an agent run the unpinned npx installer or wallet commands without explicit approval, and do not rely on certified output unless the receipt verification flaw is fixed.

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

T09 · Insecure Skill Coding Practices

Error
Location
paygate.py:252
Finding
Unsigned Payment Receipts Can Be Embedded as Valid Certifications<![CDATA[ ## Vulnerability Details **File Location**: `paygate.py:252-260` **Vulnerability Type**: Missing cryptographic verification before certification **Risk Level**: High ### Vulnerable Code ```python if args.cmd == "embed": report = json.loads(Path(args.report).read_text(encoding="utf-8")) data = json.loads(Path(args.receipt).read_text(encoding="utf-8")) receipt = data.get("receipt", data) sig = data.get("receipt_signature", "") certified = embed_certification(report, receipt, sig) Path(args.out).write_text(json.dumps(certified, ensure_ascii=False, indent=2), encoding="utf-8") print(f"已认证报告写 {args.out}") return 0 ``` The called function marks the report as paid without performing verification: ```python def embed_certification(report: dict, receipt: dict, signature_b64: str) -> dict: """把已验证的付款认证块并入审计报告(报告本体仍是 audit.py 离线产出)。""" certified = dict(report) certified["certification"] = { "paid": True, "oracle": receipt.get("oracle"), "out_trade_no": receipt.get("out_trade_no"), "trade_no": receipt.get("trade_no"), "amount": receipt.get("amount"), "goods_name": receipt.get("goods_name"), "fulfilled_at": receipt.get("fulfilled_at"), "receipt_signature": signature_b64, "verified_offline_with": "embedded_server_pubkey", } return certified ``` ### Technical Analysis The `embed` command treats the receipt file and signature as trusted input. It never calls `verify_receipt()` before passing the data to `embed_certification()`. That function unconditionally adds `"paid": True` and `"verified_offline_with": "embedded_server_pubkey"` to the output. Consequently, neither a valid RSA signature nor evidence of payment is required to create an apparently certified report. The presence of a separate `verify` command does not establish a security boundary because users can invoke `embed` directly, and there is no st ...[truncated 2498 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make receipt verification mandatory inside the `embed` command: ```python pub = load_pubkey() if not verify_receipt(receipt, sig, pub): print("error: invalid receipt signature", file=sys.stderr) return 1 certified = embed_certification(report, receipt, sig) ``` 2. Do not rely on a separately invoked `verify` command. Verification and embedding must be one atomic, fail-closed operation. 3. Validate all signed receipt semantics after signature verification: - Expected oracle identity. - Expected currency and exact amount. - Expected product or service identifier. - Nonempty transaction and order identifiers. - Fulfillment timestamp and acceptable validity period. 4. Bind the receipt to the specific report by including the report's SHA-256 digest in the server-signed receipt. Refuse certification unless that digest exactly matches the report being embedded. 5. Add replay protection by signing a unique audit identifier and recording whether the receipt has already been used, where reuse is not intended. 6. Set certification metadata only after all cryptographic and semantic checks pass. Do not state `"verified_offline_with"` based merely on the selected code path. 7. If full report contents are intended to remain paid, do not write plaintext `full.md` or `full.json` before authorization. Store only the preview, or encrypt the full output using a key released after successful receipt validation. 8. Add regression tests proving that missing, malformed, forged, mismatched, and replayed receipts cannot produce certified output. ]]>

T08 · Insecure Dependencies

Warning
Location
SKILL.md:121
Finding
Mutable Third-Party Package Is Downloaded and Executed Through npx<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:121` **Additional Locations**: `README.md:18`, `paygate.py:225`, `paygate.py:290` **Vulnerability Type**: Unpinned remote dependency execution **Risk Level**: Medium ### Vulnerable Code ```bash npx -y @alipay/agent-payment@latest install-experience ``` The same installation instruction is repeated in runtime guidance: ```python print(" npx -y @alipay/agent-payment@latest install-experience") ``` ### Technical Analysis The project instructs users and Agents to execute the mutable `latest` release of a third-party npm package. `npx` can download and execute package code, including package lifecycle or installation behavior, with the permissions of the invoking user. The `@latest` tag is mutable and does not identify the exact code reviewed by this project. The `-y` option suppresses the normal installation confirmation. No package version, lockfile, integrity hash, artifact signature, or verified local copy is supplied. Therefore, the effective installer payload can change after this Skill has been audited. A compromised publisher account, malicious upstream release, registry compromise, or unexpected future package update could cause arbitrary code to execute when users follow the documented workflow. ### Attack Path 1. An attacker compromises the npm publisher account, package release process, registry entry, or mutable `latest` tag for `@alipay/agent-payment`. 2. The attacker publishes a malicious version or moves `latest` to a compromised release. 3. A user or Agent follows the Skill's payment setup instructions. 4. `npx -y` downloads the current remote package without interactive confirmation. 5. The package executes with the permissions and environment of the user running the command. 6. Malicious package code can access files available to that user, inspect environment variables, alter local tooling, or install additional payloads. ### Impact Assessment Successful exploitation ...[truncated 755 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace `@latest` with an exact, reviewed version: ```bash npx @alipay/agent-payment@1.2.3 install-experience ``` 2. Publish and verify the expected npm integrity digest or signed provenance for the exact package artifact. 3. Remove `-y` so users receive an explicit prompt before remote package execution. 4. Require explicit user approval before installation, particularly in Agent-driven workflows. 5. Document the expected publisher identity, package version, release checksum, and verification procedure. 6. Prefer installation from a lockfile-controlled environment or a vetted local artifact rather than resolving a mutable registry tag at execution time. 7. Run the installer with least privilege in an isolated environment. Do not use an administrator or root shell. 8. Review upgrades before changing the pinned version, and update all duplicated installation instructions together. 9. Where practical, separate wallet tooling from the audit environment so compromise of the payment dependency cannot access audited source trees or report files. ]]>
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
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (20)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill is presented primarily as an offline code-ownership audit tool, but the documented behavior also includes remote payment-oracle interaction, payment proof handling, receipt verification, and embedding payment certification into outputs. This mismatch can mislead users and agent orchestrators about the true data flows and trust assumptions, increasing the risk of unintended network access or execution of payment-related commands.

Ae1

High
Category
analysis-evasion
Content
> 说明:完整报告由本机 `audit.py` 离线计算,`run` 已把它落为 `full.json`。
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Rp1

Medium
Category
MCP Rug Pull
Confidence
97% confidence
Finding
The README instructs users to execute `npx -y @alipay/agent-payment@latest install-experience`, which pulls and runs the latest package version at install time without pinning. This creates a supply-chain risk: if the package is compromised, unpublished/replaced, or a breaking update introduces unsafe behavior, users following the documented setup command may execute unreviewed code.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill documents capabilities that include local file access, shell execution, and outbound network/payment flows, but it does not declare any explicit tool scope such as permissions or allowed-tools. That makes the operational trust boundary unclear and can lead an agent platform to expose broader capabilities than users expect, especially because the skill also instructs installation and payment-related command execution.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The manifest description, display name, summary, and all user-facing instructions are written entirely in Chinese, and the skill does not offer any language or locale choice. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is clearly documented and justified.

Rp1

Medium
Category
MCP Rug Pull
Confidence
97% confidence
Finding
The skill instructs use of `npx -y @alipay/agent-payment@latest install-experience`, which pulls and executes unpinned code from the package registry at runtime. A compromised upstream package, malicious update, or dependency hijack could result in arbitrary code execution on the user's machine during installation of the payment tool.

Rp1

Medium
Category
MCP Rug Pull
Confidence
97% confidence
Finding
This is the same unpinned runtime package installation pattern repeated in the dependency section, again relying on `@latest`. Repetition increases the chance an agent will automatically execute the unsafe install path, exposing the environment to arbitrary code from future package versions or a compromised registry/dependency chain.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
This Python file contains multiple user-facing strings that force Chinese output, including warnings and remediation text, despite the tool otherwise using English CLI/help text. Because the skill does not provide user opt-in or a language-selection mechanism, it violates the language/locale policy for natural-language behavior.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The user-facing description and command description are written entirely in Chinese, with no indication that other languages are supported or that the skill is intended only for a Chinese-speaking audience. This creates a natural-language locale policy issue because the skill appears to impose a specific language without opt-in or documented regional justification.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The declared skill purpose is code-ownership auditing, but this file also implements payment-gating and remote interaction with a payment oracle. That mismatch is security-relevant because users or reviewers may grant the skill broader trust than intended, while the extra functionality introduces network and payment-related attack surface not disclosed by the manifest description.

Context-Inappropriate Capability

Medium
Confidence
94% confidence
Finding
Remote HTTP access to a payment oracle is not inherent to code ownership auditing, so introducing it materially enlarges the threat surface. Even though the code claims auditing stays local, the networking capability can expose metadata, create payment abuse opportunities, and condition users to trust an external service in a context that appears offline-first.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The CLI does more than analyze ownership: it generates preview/full artifacts, gates access to outputs behind payment, and unlocks certified reports after remote proof submission. This hidden expansion of behavior can mislead users and automated policy systems about what the skill actually does, increasing the chance that sensitive workflows permit unintended file generation and payment-related actions.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding
The code instructs users to run `npx -y @alipay/agent-payment@latest install-experience`, which fetches and executes a remote package at an unpinned version. This creates a supply-chain execution risk: if the package is compromised or a breaking/malicious update is published, users may execute attacker-controlled code on their machine.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding
This is a second occurrence of the same unsafe pattern: the skill tells the operator to install and run an unpinned external package from npm. In a security-sensitive workflow involving payments, executing unversioned third-party code increases the chance of supply-chain compromise and undermines trust in the toolchain.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def _run(*args):
    proc = subprocess.run([sys.executable, str(SCRIPT), *args],
                          capture_output=True, text=True, timeout=120)
    return proc
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
def _run(*args):
    return subprocess.run([sys.executable, str(SCRIPT), *args],
                          capture_output=True, text=True, timeout=180)
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Low
Confidence
87% confidence
Finding
The skill documentation is primarily written in Chinese, including core usage and pricing sections, while only a brief English subtitle is provided. Under the policy rule, forcing or assuming a specific language without opt-in can be a natural-language policy issue when no language choice or regional justification is stated.

Missing User Warnings

Low
Confidence
84% confidence
Finding
The preview path creates parent directories and writes a markdown file to the user-supplied destination, but there is no confirmation prompt, user-facing log/print, or local comment/docstring warning at the operation itself. For code files, file writes should have some visible disclosure unless already clearly warned elsewhere in the skill description.

Missing User Warnings

Low
Confidence
84% confidence
Finding
This branch performs directory creation and writes a markdown report file, but the code does not emit a confirmation or log message and lacks local explanatory comments about the side effect. Even though `--report` implies output, the rule asks for some form of disclosure for file writes when none is otherwise visible.

Natural-Language Policy Violations

Low
Confidence
85% confidence
Finding
The comment on L203 contains non-English text ('众测') as part of an explanatory note, which signals mixed-language content without offering a language or locale choice. Under the policy, language constraints or forced language usage in natural-language content can be a violation when not documented as optional or justified.

Static analysis

Detected: suspicious.dynamic_code_execution

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
paygate.py:166