Back to skill

Security audit

dy-comments

Security checks for vulnerabilities and agentic risk

Overview

The skill largely does the Douyin comment collection it describes, but it handles login tokens and paid collection steps with unsafe transport and under-scoped credential behavior that users should review carefully.

Before installing, confirm you trust the backend service and account model, switch the base URL to HTTPS before login if available, avoid insecure TLS mode, watch for automatic import of older ~/.xhs-convert credentials, and approve each paid collection step explicitly because credits can be consumed by CLI calls.

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

T09 · Insecure Skill Coding Practices

Error
Location
src/config.js:19
Finding

Bearer Token Transmitted over Plaintext HTTP by Default

Content
View full analysis

Vulnerability Details

File Location: src/config.js:19; authenticated request flow in src/client.js:52-72
Vulnerability Type: Plaintext transmission of authentication credentials
Risk Level: High

Complete Code Snippet

javascript
// src/config.js:19
const DEFAULT_BASE_URL = 'http://st.aidata366.com';
javascript
// src/client.js:52-72
if (!_httpWarned && this.token && this.baseUrl.startsWith('http://')) {
  _httpWarned = true;
  process.stderr.write('[warn] 当前服务地址为明文 http,token 会明文传输,建议确认网络安全或切换 https\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,
    },

Technical Analysis

The built-in service URL uses unencrypted HTTP. For authenticated API calls, ApiClient.request() inserts the account bearer token into the Authorization header and sends the request to this default endpoint.

The stderr warning only informs the caller after the insecure configuration is selected; it does not block the request, remove the credential, or require explicit approval. Consequently, the default authenticated workflow exposes both the bearer token and API traffic to passive interception and active modification.

The affected flow includes authenticated operations such as quota, start, step, status, comments, sessions, finish, and export. The export implementation in cli.js:335-337 also sends the same bearer token to the configured base URL.

Attack Path

  1. A user registers or logs in, causing an account token to be saved locally.
  2. The user or agent invokes an authenticated command without overriding the default base URL.
  3. The client sends Authorization: Bearer <token> to `http://st.aidata3 ...[truncated 1380 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace the default endpoint with an HTTPS URL backed by a valid, correctly configured certificate.
  2. Reject authenticated requests to non-HTTPS origins before adding the Authorization header.
  3. If plaintext HTTP is required for local development, limit it to loopback addresses such as 127.0.0.1 and require explicit opt-in.
  4. Do not treat a warning as sufficient protection for credential transmission.
  5. Add URL validation that permits credentials only when the effective protocol is HTTPS.
  6. Ensure the export path applies the same transport policy as ApiClient.request().
  7. Remove or invalidate tokens that may previously have traversed untrusted plaintext networks after secure transport is deployed.

T09 · Insecure Skill Coding Practices

Warning
Location
cli.js:247
Finding

Paid Collection Operations Do Not Enforce Required User Confirmation

Content
View full analysis

Vulnerability Details

File Location: cli.js:247-282; required confirmation policy in SKILL.md:52-64
Vulnerability Type: Missing authorization enforcement for paid operations
Risk Level: Medium

Complete Code Snippet

javascript
// cli.js:247-282
async function cmdStep(opts) {
  const sessionId = requireSessionId(opts);
  const cfg = resolveConfig(opts);
  requireToken(cfg);
  const client = new ApiClient({ baseUrl: cfg.baseUrl, token: cfg.token });
  let data;
  if (opts.expand) {
    const root = opts.root;
    if (!root) throw new UsageError('step --expand 需要 --root <主评论cid>(取自上一步返回的 expandable 列表)');
    process.stderr.write(`展开回复: session=${sessionId} root=${root}(扣 1 点)...\n`);
    data = await client.stepDyCommentSession(sessionId, 'expand', root);
    if (data.no_more) {
      process.stderr.write('该主评论的回复已全部展开完(本次未扣费)。\n');
    } else {
      process.stderr.write(
        `本次展开 ${(data.comments || []).length} 条回复, 该主评论累计 ${data.subs_collected_for_root} 条, ` +
        `约剩 ${data.subs_remaining_estimate == null ? '?' : data.subs_remaining_estimate} 条, ` +
        `${data.sub_has_more ? '还有更多(继续展开需再扣 1 点, 请先询问用户)' : '已全部展开'}。\n`);
    }
  } else {
    process.stderr.write(`采集下一页主评论: session=${sessionId}(扣 1 点)...\n`);
    data = await client.stepDyCommentSession(sessionId, 'page');
    if (data.no_more) {
      process.stderr.write('主评论已全部采完(本次未扣费)。\n');
    } else {
      const ex = Array.isArray(data.expandable) ? data.expandable : [];
      process.stderr.write(
        `第 ${data.page_no} 页: ${(data.comments || []).length} 条主评论 ` +
        `(累计 ${data.mains_collected} 主 + ${data.subs_collected} 子), ` +
        `${data.has_more_main ? '还有下一页' : '已是最后一页'}。\n` +
        (ex.length
          ? `本页有 ${ex.length} 条主评论含可展开回复: ` +
            ex.map((e) => `${e.root_cid}(共${e.sub_count}条,已采${e.subs_collected})`).join(', ') +
            ' — 是否展开请询问用户(每次展开 1 点)。\n'
          : '本页主评论均无可展开回复。\n'));
    }
  }
  printOk(data);
}

The go ...[truncated 2444 chars]

Remediation
View remediation

Remediation Suggestions

  1. Enforce approval in the executable or server-side request path rather than relying only on Skill prose.
  2. After presenting the price, issue a short-lived confirmation token bound to:
    • The authenticated account.
    • The collection session.
    • The exact operation type (page or expand).
    • The target root comment when applicable.
    • The stated price.
    • A single use and short expiration time.
  3. Require that confirmation token for every paid step and reject missing, expired, reused, or mismatched approvals.
  4. Preserve one-step-at-a-time semantics by invalidating approval immediately after one successful operation.
  5. Return the operation price and approval requirements from the server so clients cannot silently omit them.
  6. For interactive CLI use, add a confirmation prompt unless a valid server-issued approval artifact is supplied.
  7. Record consent and billing events in an audit log without storing bearer tokens or sensitive comment contents unnecessarily.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared purpose is comment collection, but the skill also manages persistent credentials, base URLs, and local config migration, including communication with a remote service over default plaintext HTTP. That behavioral expansion is security-relevant because it introduces credential handling and exfiltration risk not clearly conveyed by the headline purpose, making it easier to trick users or agents into sending tokens to an unsafe endpoint.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill invokes shell/network capabilities and handles local configuration/token state, but it does not declare an explicit permission or allowed-tools scope. That increases the blast radius if the skill is executed by an agent runtime, because the runtime may grant broader access than users or reviewers expect. In this file, the risk is heightened by explicit use of external network access and credential-bearing config files.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The activation description says to use the skill when the user mentions phrases like "评论分析" or "评论区舆情", alongside a broad need statement. These phrases are not tightly constrained to Douyin comment collection, so they may overlap with general analysis requests and cause unintended invocation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The document instructs the agent to send fixed Chinese guidance text to users and to reuse it verbatim, but does not provide an opt-in or alternative language path. This forces a specific language for user-facing interaction, which is a natural-language policy concern unless the locale restriction is explicitly justified and chosen by the user.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
97% confidence
Finding

The function disables TLS certificate verification globally by setting NODE_TLS_REJECT_UNAUTHORIZED='0', which allows HTTPS connections to proceed without authenticating the server. This enables man-in-the-middle attacks, credential/token theft, and tampering with API responses across the entire process, not just this client. In this skill, the client sends Bearer tokens and interacts with backend session/comment export APIs, so the exposure is especially sensitive.

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

The module is explicitly designed as a shared configuration layer across unrelated skills and includes legacy credential migration from a different tool namespace. For a Douyin comment collection skill, importing or depending on another skill's credential store violates least-privilege boundaries and can cause unintended credential reuse across products or services.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code reads a legacy configuration from another skill directory and automatically imports token, base_url, and even insecure settings into the current skill. This creates an unjustified capability to access credentials outside the stated scope of the tool, and may silently connect this skill to a different backend using inherited trust settings, increasing the risk of credential misuse or interception.

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 natural-language comments and all user-facing error/help strings are written in Chinese, and the header explicitly describes the output convention in Chinese without offering a language choice. This can violate a language/locale policy when the skill is expected to be usable in the user’s chosen language or locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The package description is written entirely in Chinese, which indicates a language-specific user experience without any visible opt-in, fallback, or explanation that the skill is intended only for a Chinese-speaking or region-specific context. The policy requires either user choice or a clearly documented justification for a locale constraint.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The doc comment says this is '_shared/output.js — 输出规约 (对齐转链 skill)', implying generic/shared behavior aligned to another skill. However, the implementation embeds behavior and user guidance specific to this skill family, such as login relink instructions and task polling/status handling, so the documentation is misleading about the code's actual intent and scope.

Content

No source excerpt is available for this finding.