Back to skill

Security audit

China Express Query

Security checks for vulnerabilities and agentic risk

Overview

The skill is a courier-tracking tool, but it can present fabricated tracking data as a normal result when real provider queries fail.

Review this skill before installing if you need reliable shipment status. It sends tracking numbers to listed third-party lookup services and may save output only when you request it, but its current failure handling can show made-up tracking activity as if it were real. Treat results as unverified unless the skill is fixed to clearly report provider failures and sanitize terminal output.

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/query.mjs:145
Finding

Terminal Escape-Sequence Injection Through Unsanitized Output

Content
View full analysis

Vulnerability Details

File Location: scripts/query.mjs:145-155, with terminal output sinks at scripts/query.mjs:177-178 and scripts/query.mjs:193
Vulnerability Type: Terminal escape-sequence injection
Risk Level: Medium

Vulnerable Code

js
if (data.data && data.data.length > 0) {
  data.data.forEach((item, index) => {
    const time = item.time || '未知时间';
    const context = item.context || '无信息';
    const location = item.location ? ` [${item.location}]` : '';
    output += `${index + 1}. [${time}]${location} ${context}\n`;
  });
} else {
  output += `暂无物流信息,请稍后查询。\n`;
}

The tracking number is also emitted directly:

js
console.log(`快递单号: ${trackingNumber}`);
console.log(`快递公司: ${companyInfo.name}${companyInfo.code === 'unknown' ? ' (请使用 --company 指定)' : ''}\n`);

The assembled output containing remote API values is subsequently printed:

js
} else {
  console.log(output);
}

Technical Analysis

The script incorporates untrusted values into terminal output without validating or neutralizing terminal control characters. The affected inputs include:

  • The tracking number supplied through the command line.
  • The time, context, and location fields returned by the external tracking services.
  • Other response-derived status text processed by the output formatter.

Terminal emulators interpret ANSI, CSI, and OSC escape sequences rather than displaying them as ordinary text. Consequently, a tracking number containing control sequences, or a malicious or compromised API response, can alter how the terminal renders the program's output.

This issue is terminal injection rather than shell command injection: the strings are not passed to a shell or command-execution API. The practical effects depend on the terminal emulator and its configuration.

Attack Path

  1. An attacker supplies a crafted tracking number containing terminal esc ...[truncated 1388 chars]
Remediation
View remediation

Remediation Suggestions

  1. Validate tracking numbers against strict carrier-specific allowlists before making requests or displaying them. Reject control characters and unexpected punctuation rather than merely removing them.
  2. Sanitize every untrusted string received from command-line arguments or remote services before writing it to an interactive terminal.
  3. Remove C0 and C1 control characters, ANSI/CSI sequences, and OSC sequences. Prefer a maintained terminal-string sanitization library where dependencies are permitted.
  4. Apply sanitization independently to trackingNumber, data.message, item.time, item.location, and item.context.
  5. Keep terminal-safe output separate from raw machine-readable data. If raw provider responses are needed, require an explicit option and write them using a structured format such as JSON.
  6. Add tests containing ESC, BEL, CSI, OSC 8 hyperlink, and OSC 52 clipboard sequences to verify that no control sequence reaches console.log().

A defense-in-depth helper can reject or remove control characters before formatting:

js
function sanitizeTerminal(value) {
  return String(value)
    .replace(/\x1B\][^\x07]*(?:\x07|\x1B\\)/g, '')
    .replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, '')
    .replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/g, '');
}

This should supplement, not replace, strict validation of tracking-number syntax.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (13)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 48)May include surrounding context.

md
node scripts/query.mjs "SF1234567890"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 51)May include surrounding context.

md
node scripts/query.mjs "SF1234567890"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 54)May include surrounding context.

md
node scripts/query.mjs "SF1234567890"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 61)May include surrounding context.

md
node scripts/query.mjs "SF1234567890"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 66)May include surrounding context.

md
node scripts/query.mjs "SF1234567890"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 71)May include surrounding context.

md
node scripts/query.mjs "SF1234567890"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises and relies on external courier-query services, which implies network access, but it does not declare any tool scope such as permissions or allowed-tools. This creates an avoidable trust gap: users and hosting platforms cannot clearly see that shipment identifiers may be transmitted off-box, increasing the chance of unintended data exposure or overly broad execution privileges.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill sends package tracking numbers to third-party services such as 快递100 and possibly a backup provider, but the description does not warn users that their tracking data leaves the local environment. Tracking numbers can be sensitive because they may reveal purchase activity, delivery status, and sometimes linkable personal logistics information, so omitting this notice undermines informed consent and privacy expectations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's comments, help text, prompts, and output are entirely in Chinese, and it does not offer any language or locale selection. This can violate language/locale policy when a skill forces a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The function is presented as performing express-query lookups, but its control flow ultimately substitutes simulated results while preserving a normal-looking success structure. This mismatch between stated behavior and actual behavior is dangerous because callers and users cannot distinguish real courier data from invented fallback content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script sends tracking numbers to external services (kuaidi100 and a Baidu endpoint) without any user-facing notice, consent, or privacy disclosure. Tracking numbers can reveal shipment activity and may be sensitive business or personal metadata, so undisclosed third-party transmission creates a privacy and data-governance risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

When both upstream courier queries fail, the script silently returns fabricated success-shaped tracking data instead of reporting an error. This can mislead users into believing a shipment has valid tracking activity, causing bad decisions and undermining trust in the tool's output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The natural-language description and usage guidance force a specific language experience for users, and the file does not indicate that Chinese is optional or that the skill is intentionally limited to a Chinese-speaking or China-only context. Under the language/locale policy, a forced language without user opt-in is a policy concern.

Content

No source excerpt is available for this finding.