Back to skill

Security audit

小红书互动数采集

Security checks for vulnerabilities and agentic risk

Overview

This skill mostly matches its advertised Xiaohongshu metrics purpose, but it sends tokens over plaintext HTTP by default and silently imports credentials from another local skill config.

Review before installing. This skill requires account login, stores a reusable token locally, sends note URLs containing xsec_token values to a remote backend, and charges quota for successful collection. Do not use it on untrusted networks unless you can switch the base URL to HTTPS with normal certificate validation. Be aware it may import credentials from an existing ~/.xhs-convert config automatically on first use.

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:16
Finding

Bearer Credentials and Sensitive Request Data Transmitted over Plaintext HTTP

Content
View full analysis

Vulnerability Details

File Location: src/config.js:16-20, with credential-bearing requests at src/client.js:66-74 and cli.js:312-313
Vulnerability Type: Cleartext transmission of sensitive information
Risk Level: High

Complete Code Snippets

src/config.js:16-20:

javascript
// Security note: the server's HTTPS certificate is not yet properly configured.
// The built-in endpoint therefore remains HTTP.
const DEFAULT_BASE_URL = 'http://st.aidata366.com';

src/client.js:66-74:

javascript
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,
});

cli.js:312-313:

javascript
const res = await fetch(`${cfg.baseUrl}/api/v1/platform/exports/${encodeURIComponent(info.export_id)}/file`,
  { headers: { Authorization: `Bearer ${cfg.token}` }, signal: dlCtrl.signal });

Technical Analysis

The built-in service endpoint uses unencrypted HTTP. ApiClient.request() sends the configured bearer token in the Authorization header and serializes request bodies to that endpoint. The export download path likewise sends the bearer token over the configured base URL.

With the default configuration, authenticated commands—including submit, query, quota, export, and logout—therefore expose their traffic to passive interception and active modification. Login and registration session operations also use the same default endpoint. Submitted note URLs may contain xsec_token query parameters, which are included in request bodies during task submission.

The runtime warning and the documentation accurately disclose this condition, but disclosure does not provide a technical security boundary and does not prevent sensitive traffic from being sent in cleartext.

Attack Path

...[truncated 1568 chars]

Remediation
View remediation

Remediation Suggestions

  1. Configure a valid TLS certificate for the service and change the built-in endpoint to an https:// URL.
  2. Reject authenticated requests to plaintext HTTP endpoints rather than merely printing a warning.
  3. If HTTP is required for local development, restrict it to loopback addresses such as 127.0.0.1 and require an explicit, clearly named opt-in.
  4. Apply the HTTPS requirement consistently to authentication-session creation and checking, API requests, task submission, and export downloads.
  5. Keep TLS certificate verification enabled. Remove or tightly constrain the process-wide NODE_TLS_REJECT_UNAUTHORIZED=0 mode because it defeats HTTPS server authentication.
  6. After deploying HTTPS, revoke or rotate tokens that may previously have traversed untrusted networks over HTTP.
  7. Add automated tests verifying that credential-bearing requests fail when the effective base URL uses HTTP or when certificate validation fails.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill description frames the capability as a narrow engagement-metrics collector, but the content exposes additional account/session operations and more generic task flows than the declared purpose suggests. Description-behavior mismatch is dangerous because users and orchestration systems may authorize the skill under a narrower trust model, while the actual behavior handles authentication tokens, persistent sessions, exports, and potentially adjacent scraping workflows that carry additional privacy and abuse risk.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill declares no explicit tool/permission boundaries while its documented behavior requires shell execution, network access, and use of local configuration/environment state. Without an allowlist, an agent platform may grant broader execution than users expect, increasing the risk of arbitrary outbound requests, token exposure, or misuse of local credentials stored in ~/.xhs-platform/config.json. The risk is elevated here because the skill itself documents plaintext HTTP as the default transport, so missing scope controls combine with insecure transport and credential handling.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad enough that normal discussion of Xiaohongshu analytics or data collection could invoke the skill unintentionally. In this skill, accidental invocation is more serious than usual because it can lead to login/registration prompts, consumption of paid quota, transmission of user-supplied links and tokens to a remote service, and storage/use of long-lived account tokens.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file’s header and usage/help text are entirely in Chinese, and user-facing stderr messages throughout the CLI are also hard-coded in Chinese. This imposes a specific language on all users without any opt-in, language selection mechanism, or documented justification that the tool is only for a Chinese-speaking or region-specific audience.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
98% confidence
Finding

The allowInsecureTls() helper disables TLS certificate validation process-wide by setting NODE_TLS_REJECT_UNAUTHORIZED=0, which enables man-in-the-middle interception of all subsequent HTTPS requests in the process. In this client, requests may carry bearer tokens and potentially sensitive task/session data, so an attacker on the network could capture credentials or tamper with API responses.

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
90% confidence
Finding

The manifest describes a tool for collecting Xiaohongshu note interaction metrics such as likes, favorites, comments count, and shares, with batch export of results. This client also exposes a separate '/comments/sessions' workflow for stepwise comment-session creation, stepping, finishing, listing sessions, and retrieving collected comments, which is a broader comment-content collection capability not described in the manifest.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file’s user-facing descriptive comments are written in Chinese, and there is no indication that language choice is optional or user-selectable. Under the stated policy, forcing a specific language or locale without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code automatically reads credentials from a different skill's config directory and copies them into this skill's config without an explicit user consent step. Even if intended as convenience migration, this expands the skill's access beyond its declared note-metrics collection purpose and creates an unexpected trust boundary crossing between separate skills/services.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code reuses a token, base URL, and insecure transport flag from another skill's configuration, which may silently grant this skill access using credentials the user supplied for a different tool. That behavior can cause confused-deputy issues, accidental account linkage, and propagation of unsafe transport settings across service boundaries.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file-level comment specifies output behavior in Chinese, and multiple user-facing messages throughout the file are written only in Chinese. This indicates the skill is effectively locked to a specific language/locale without user opt-in, which matches the natural-language policy violation criteria.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The comment documents timeout behavior in terms of throwing a BizError, and the implementation indeed attempts to construct one. However, this file does not define or import BizError, so the actual runtime behavior would be a ReferenceError instead of the documented BizError with attached status data.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

This manifest describes the skill's purpose but provides no explicit invocation phrases, scope boundaries, or exclusion conditions. In manifest files, absent or overly broad activation guidance can contribute to unintended invocation because the trigger context is left unspecified.

Content

No source excerpt is available for this finding.