Back to skill

Security audit

guaikei·小红书笔记·评论·博主

Security checks for vulnerabilities and agentic risk

Overview

This skill appears purpose-built for Xiaohongshu research, but it handles API tokens and tokenized URLs in ways users should review before installing.

Install only if you are comfortable sending Xiaohongshu research inputs and your Guaikei API token to the Guaikei service. Treat the workspace logs as sensitive: they may contain keywords, retrieved content, and tokenized Xiaohongshu links, so delete or protect logs after use and avoid committing them to source control. Prefer a version that moves API credentials out of query strings and redacts token-like URL parameters before saving results.

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

Warning
Location
src/utils/request.js:76
Finding

API Credential Transmitted in URL Query Strings

Content
View full analysis

Vulnerability Details

File Location: src/utils/request.js:76-98, with credential-bearing parameters supplied by src/api/search.js:20-28, src/api/detail.js:17-25, src/api/comment.js:17-25, and src/api/post.js:17-25
Vulnerability Type: API credential exposure through URL query parameters
Risk Level: Medium

Vulnerable Code

src/utils/request.js:76-98:

js
async function postJson(path, params, data) {
  if (!path || typeof path !== "string") {
    throw new Error("path must be a non-empty string");
  }
  if (!params || typeof params !== "object") {
    throw new Error("params must be an object");
  }
  if (!data || typeof data !== "object") {
    throw new Error("data must be an object");
  }
  params.skill_name = skillName();
  const fullPath = `${path}?${querystring.stringify(params)}`;
  const jsonData = JSON.stringify(data);
  const options = {
    host: constants.BASE_URL,
    path: fullPath,
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Content-Length": Buffer.byteLength(jsonData),
    },
  };
  return await request(options, jsonData);
}

src/api/search.js:20-28 demonstrates how the token enters those parameters:

js
async function createSearchTask(token, keyword, type, sort, time, limit) {
  return await withRetry(
    async () => {
      return await postJson(
        "/api/xiaohongshu/note-search/keyword",
        { _: Date.now(), token: token },
        { keyword, type, sort, time, limit },
      );
    },

The same credential-passing pattern is used by the detail, comment, and creator-post APIs. Polling GET requests also put the token into the query object before getJson constructs the request URL.

Technical Analysis

GUAIKEI_API_TOKEN is inserted into the query string of every task-creation and task-polling request. HTTPS protects the request while it is in transit, but ...[truncated 1702 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove token from all query-parameter objects.

  2. Send the credential in an authorization header, for example:

    js
    headers: {
      "Authorization": `Bearer ${token}`,
      "Content-Type": "application/json",
      "Content-Length": Buffer.byteLength(jsonData),
    }
    
  3. Refactor postJson and getJson to accept the token separately from ordinary request parameters so callers cannot accidentally serialize it into the URL.

  4. Ensure client, proxy, gateway, server, and monitoring logs redact authorization data.

  5. Rotate existing tokens because historical infrastructure logs may already contain them.

  6. Apply short token lifetimes, revocation support, rate limits, and least-privilege scopes where supported by the service.

  7. Add automated tests that assert generated request paths never contain token=, API keys, or authorization secrets.

T09 · Insecure Skill Coding Practices

Warning
Location
src/xiaohongshu/detail-cli.js:137
Finding

Automatic Plaintext Persistence of Sensitive Query Data and Tokenized URLs

Content
View full analysis

Vulnerability Details

File Location: src/xiaohongshu/detail-cli.js:137-163 and src/utils/log.js:27-34
Vulnerability Type: Insecure local storage of sensitive data
Risk Level: Medium

Vulnerable Code

src/xiaohongshu/detail-cli.js:137-163:

js
const finalOutput = {
  status: "success",
  error_code: "OK",
  message: "Detail task completed",
  timestamp: new Date().toLocaleString(),
  request: {
    command: "detail",
    url: url,
    limit: limit,
  },
  skill_metadata: {
    skill_version: constants.VERSION,
    runtime_version: process.versions.node,
    execution_time: Date.now() - startTime,
  },
  results: detailTask,
};
console.log(JSON.stringify(finalOutput, null, 2));
utils.printSuccess(`Detail task completed and results returned`);

await log.taskWrite(
  `${startTime}_${validator.url2Name(url)}_detail.json`,
  JSON.stringify(finalOutput, null, 2),
);

src/utils/log.js:27-34:

js
const outputFilename = path.join(
  path.dirname(__filename),
  "..",
  "..",
  "logs",
  safeFilename,
);

try {
  await fs.promises.mkdir(path.dirname(outputFilename), { recursive: true });
  await fs.promises.writeFile(outputFilename, content);

The original source uses localized status messages, but the security-relevant behavior is the construction of finalOutput and its unconditional persistence. Equivalent result logging occurs in the other successful CLI flows.

Technical Analysis

Successful command output is automatically written to predictable JSON files under the project-level logs/ directory. The persisted object contains the complete request and returned results.

For detail, comment, and creator-post operations, the request URL can contain Xiaohongshu xsec_token query parameters. API result processing can also construct tokenized note or profile URLs. These values are written without redaction.

fs.promises.writeFile ...[truncated 1893 chars]

Remediation
View remediation

Remediation Suggestions

  1. Make result persistence opt-in rather than automatic, such as through an explicit --output or --save option.

  2. Recursively redact sensitive URL parameters before output or persistence, including xsec_token, token, API keys, and authorization values.

  3. Store only the minimum fields required for the user's task instead of the complete API response.

  4. Create log directories and files with restrictive permissions:

    js
    await fs.promises.mkdir(logDirectory, {
      recursive: true,
      mode: 0o700,
    });
    
    await fs.promises.writeFile(outputFilename, redactedContent, {
      mode: 0o600,
      flag: "wx",
    });
    
  5. Add logs/ to .gitignore and exclude it from CI artifacts and unattended backups unless explicitly required.

  6. Define and enforce a retention period, with secure deletion or rotation of old files.

  7. For data that must be retained, use an access-controlled storage location and encryption appropriate to the deployment environment.

  8. Warn users clearly before saving URLs or response data that may contain platform access tokens or personal data.

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

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A second mismatch report reinforces that the skill advertises public-content retrieval but apparently performs unrelated local filesystem access such as reading package.json. Undeclared local access, even if limited, violates least surprise and can be used to conceal behavior not justified by the skill's stated purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

A second mismatch report reinforces that the skill advertises public-content retrieval but apparently performs unrelated local filesystem access such as reading package.json. Undeclared local access, even if limited, violates least surprise and can be used to conceal behavior not justified by the skill's stated purpose.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- "分析这条小红书笔记评论区的主要观点和负面反馈: node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 100"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- "分析这条小红书笔记评论区的主要观点和负面反馈: node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 100"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- "分析这条小红书笔记评论区的主要观点和负面反馈: node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 100"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- "分析这条小红书笔记评论区的主要观点和负面反馈: node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 100"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- "看这个小红书博主最近 20 条作品都在发什么: node src/xiaohongshu/post-cli.js --url 'https://www.xiaohongshu.com/user/profile/xxx?xsec_token=yyy' --limit 20"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- "看这个小红书博主最近 20 条作品都在发什么: node src/xiaohongshu/post-cli.js --url 'https://www.xiaohongshu.com/user/profile/xxx?xsec_token=yyy' --limit 20"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- "看这个小红书博主最近 20 条作品都在发什么: node src/xiaohongshu/post-cli.js --url 'https://www.xiaohongshu.com/user/profile/xxx?xsec_token=yyy' --limit 20"

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- "看这个小红书博主最近 20 条作品都在发什么: node src/xiaohongshu/post-cli.js --url 'https://www.xiaohongshu.com/user/profile/xxx?xsec_token=yyy' --limit 20"

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
| 看某篇笔记的详情+评论 | `src/xiaohongshu/detail-cli.js` | 笔记 URL | `explore/` 或短链 |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| 看某篇笔记的详情+评论 | `src/xiaohongshu/detail-cli.js` | 笔记 URL | `explore/` 或短链 |

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| 看某篇笔记的详情+评论 | `src/xiaohongshu/detail-cli.js` | 笔记 URL | `explore/` 或短链 |

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill declares use of an environment secret (GUAIKEI_API_TOKEN) but does not define any explicit tool scope or permission boundary. That increases the chance the runtime exposes credentials more broadly than necessary and makes review of secret access harder, especially for third-party integration skills.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The natural-language instructions and user-facing description are entirely presented in Chinese and frame the skill as operating in that language, with no opt-in or alternative locale guidance. Under the policy for natural-language violations, a skill should not effectively force a specific language unless the restriction is explicitly justified or the user is given a choice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The README explicitly states that all task results are automatically saved to the logs/ directory, but it does not warn users that searched keywords, queried links, note details, comments, or downstream analysis outputs may be retained on disk. Because this skill handles potentially sensitive marketing research and public-profile intelligence, silent persistence increases the risk of unintended disclosure to other local users, backups, or log collection systems.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The file title and all user-facing invocation examples and instructions are written exclusively in Chinese, with no indication that other languages are supported or that Chinese is an optional locale. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code sends a token plus the target note URL to a remote API via postJson, which is a privacy- and credential-relevant network operation. Although the function has technical docstrings, there is no user-facing warning, confirmation, or disclosure in this file that these values are transmitted off-system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The getCommentTask function performs an HTTP request that transmits the API token, note URL, and limit values to a remote endpoint. This is a safety-relevant network action involving credentials and user data, but the file contains no visible disclosure, confirmation, or warning for the user.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code sends a user-provided token and note URL in a POST request, which is a safety-relevant network transmission of user/system data. Although the function has developer-facing docstrings and retry logging, there is no user-facing disclosure, confirmation, or warning in this file about transmitting the token and URL to a remote API.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The GET request includes the API token and target URL as request parameters, which constitutes transmission of potentially sensitive or identifying data to a remote service. The code contains developer-oriented comments and retry error logging, but no visible user disclosure or confirmation about this data transmission.

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 contains natural-language strings in Chinese, including the module description and retry log messages, but there is no indication that the skill is region-specific or that users can opt into this locale. Under the language/locale policy, forcing a specific language without opt-in is a policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This JavaScript file contains natural-language comments and emitted status/error messages exclusively in Chinese, including the retry/error text. Under the policy provided, forcing a specific language without opt-in is a locale-policy violation, and there is no indication this skill is region-specific or that users can choose another language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The user-facing strings are entirely in Chinese and instruct the user how to recover functionality, but there is no indication that the skill is China-specific or that users can choose another language. This creates a locale-policy issue because the skill imposes a specific language on all users without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Multiple error strings are presented only in Chinese, including validation and API-token guidance text, which forces a specific language for users encountering errors. The policy allows locale constraints only when explicitly justified or when the user is offered a language/locale choice, neither of which is present here.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.