Back to skill

Security audit

小红书长链转短链

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Xiaohongshu URL-shortening CLI, but it should be reviewed because it stores account tokens and sends authenticated requests to a plaintext HTTP service by default.

Review before installing or using with a real account. The main risk is that the default service address uses plaintext HTTP while sending bearer tokens, which could expose the account token and paid quota on an untrusted network. Use only if you trust the service and network, prefer a valid HTTPS base URL, avoid enabling insecure TLS, and delete or rotate the saved token if it may have been exposed.

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
src/config.js:23
Finding

Bearer Token Transmitted over Plaintext HTTP by Default

Content
View full analysis

Vulnerability Details

File Location: src/config.js:23; src/client.js:47-71
Vulnerability Type: Plaintext transmission of authentication credentials
Risk Level: High

Vulnerable Code

js
// src/config.js:23
const DEFAULT_BASE_URL = 'http://st.aidata366.com';
js
// src/client.js:47-71
async request(method, apiPath, opts = {}) {
  const { body, headers = {}, timeoutMs = REQUEST_TIMEOUT_MS } = opts;
  // Plaintext HTTP with a token only produces a warning.
  if (!_httpWarned && this.token && this.baseUrl.startsWith('http://')) {
    _httpWarned = true;
    process.stderr.write('[warn] Current service address uses plaintext HTTP; token will be transmitted in plaintext\n');
  }

  const ctrl = new AbortController();
  const timer = setTimeout(() => ctrl.abort(), timeoutMs);
  let res;
  let payload = null;
  try {
    res = await fetch(this.baseUrl + '/api/v1' + apiPath, {
      method,
      headers: {
        ...(body ? { 'Content-Type': 'application/json' } : {}),
        ...(this.token ? { Authorization: `Bearer ${this.token}` } : {}),
        ...headers,
      },
      body: body ? JSON.stringify(body) : undefined,
      signal: ctrl.signal,
    });

Technical Analysis

The built-in service endpoint uses HTTP rather than HTTPS. Authenticated API requests add the locally stored bearer token to the Authorization header and send it to that endpoint.

The implementation detects this condition but only writes a warning to stderr. It does not stop the request, require explicit approval, or remove the credential. Consequently, ordinary authenticated operations—including submit, query, export, quota, and logout—transmit the bearer token without transport encryption or server authentication.

This crosses the trust boundary between the local credential store and the remote API over a network channel that can be observed or modified. The warning is not an effective security control, particularly because the Skill direc ...[truncated 1724 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace the default endpoint with an HTTPS URL backed by a valid, correctly matched certificate.
  2. Reject authenticated requests to http:// endpoints instead of merely warning:
js
if (this.token && new URL(this.baseUrl).protocol !== 'https:') {
  throw new NetworkError(
    'Refusing to transmit an authentication token over plaintext HTTP'
  );
}
  1. If HTTP support is necessary for isolated local development, restrict it to loopback addresses and require an explicit per-invocation development-only opt-in. Do not persist that exception for production credentials.
  2. Keep TLS certificate verification enabled. Do not use NODE_TLS_REJECT_UNAUTHORIZED=0 in production.
  3. After deploying HTTPS enforcement, revoke or rotate tokens that may previously have crossed plaintext networks.
  4. Add automated tests confirming that authenticated requests fail closed for HTTP endpoints and proceed only through certificate-validated HTTPS.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The documented purpose is a narrow long-URL-to-short-URL conversion service, but the behavior described by analysis includes broader account/session management and unrelated platform capabilities such as profile access, generic task submission, and comment-session endpoints. This mismatch is dangerous because it undermines user consent and review assumptions: a user or platform may authorize a seemingly simple utility while it can exercise materially broader actions and data access.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest describes a skill for batch-converting Xiaohongshu note long URLs into xhslink.com short links, with polling and export for that conversion workflow. This client also exposes a separate comments-session feature set for creating, stepping through, finishing, and listing comment-collection sessions, which is a materially different capability from URL shortening.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill explicitly instructs the agent to run shell commands, access networked APIs, and use locally stored credentials, but it declares no tool/permission scope. That creates an over-privileged integration surface where an agent may invoke shell, network, or environment access beyond what users reasonably expect, increasing the blast radius if the skill is misused or compromised.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The invocation guidance says to use the skill when the user mentions phrases like '小红书短链', '长链转短链', or '生成短链'. In particular, '生成短链' is broad and the line does not provide exclusion conditions or negative examples, so an agent could invoke this skill for generic short-link requests outside the intended Xiaohongshu long-link context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill stores access tokens persistently in ~/.xhs-platform/config.json and emphasizes reuse across multiple skills, but it does not provide an explicit warning about credential retention, local exposure, or cross-skill sharing implications. Persistent shared tokens increase the risk of unintended account reuse, credential theft from the local filesystem, and surprise privilege sharing across separate skills.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This code embeds its primary description and operational help text entirely in Chinese, and later user-facing usage/error guidance is also presented in Chinese. That creates a language/locale policy issue because the skill forces a specific language without offering the user any choice or documenting a justified locale restriction.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
98% confidence
Finding

The allowInsecureTls function globally sets NODE_TLS_REJECT_UNAUTHORIZED=0, disabling TLS certificate validation for the entire Node.js process. That permits man-in-the-middle interception of HTTPS traffic, exposing bearer tokens and API data to impersonation or tampering, and the risk is heightened in this skill because it handles authenticated backend requests for a paid service.

Content

Scanner excerpt · src/client.js (reported line 17)May include surrounding context.

js
/** 忽略 HTTPS 证书校验 (服务端自签/域名不匹配证书时由 insecure 配置开启)。进程级。 */
function allowInsecureTls() {
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
}

/** 业务错误: code 为后端错误码 (1001/1002/3001/...) */

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest frames the skill as a dedicated long-link-to-short-link converter, but the code includes generic '/platform/tasks' submission using a caller-supplied 'capability' value. That design supports broader platform task execution than the specific shortening workflow promised by the manifest.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains natural-language comments and stderr messages in Chinese, including user-visible migration warnings at L075-L076. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file’s documented output contract and multiple user-facing strings are written in Chinese, indicating the skill is designed to communicate in a single language by default. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless a locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The natural-language description is written entirely in Chinese, which can impose a language-specific usage expectation without any opt-in or alternative locale noted. The policy allows locale constraints when they are explicitly justified, but this line does not state that the skill is intentionally limited to Chinese-speaking users or a China-specific compliance context.

Content

No source excerpt is available for this finding.