Back to skill

Security audit

guaikei·小红书数据采集工具

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent Xiaohongshu public-data collection tool, but users should understand that it sends queries to a third-party API and saves results locally.

Install only if you are comfortable using a third-party Guaikei API token and sending Xiaohongshu query targets to that service. Keep the workspace private, avoid committing the logs directory, and rotate the API token if you believe URL logs 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 (2)

T09 · Insecure Skill Coding Practices

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

API Credential Exposed in URL Query Strings

Content
View full analysis

Vulnerability Details

File Location: src/utils/request.js:85-89, 108-113; credential parameters originate from src/api/search.js:23-26, 52-59, src/api/detail.js:20-24, 46-52, and src/api/comment.js:20-24, 46-51
Vulnerability Type: Credential exposure through URL query parameters
Risk Level: Medium

Vulnerable Code

js
// src/utils/request.js:85-89
params.skill_name = skillName();
const fullPath = `${path}?${querystring.stringify(params)}`;
const jsonData = JSON.stringify(data);
const options = {
  host: constants.BASE_URL,
js
// src/utils/request.js:108-113
params._ = Date.now();

const fullPath = `${path}?${querystring.stringify(params)}`;
const options = {
  host: constants.BASE_URL,
  path: fullPath,

The API modules supply the secret token as part of the parameter object:

js
// src/api/search.js:23-26
return await postJson(
  "/api/xiaohongshu/note-search/keyword",
  { _: Date.now(), token: token },
  { keyword, type, sort, time, limit },
);
js
// src/api/search.js:52-59
const res = await getJson("/api/xiaohongshu/note-search/info", {
  _: Date.now(),
  token: token,
  keyword,
  type,
  sort,
  time,
  limit,
});

Technical Analysis

GUAIKEI_API_TOKEN is passed to postJson and getJson in the params object. Both functions serialize that object into the HTTP request target using querystring.stringify, producing URLs such as:

text
/api/xiaohongshu/note-search/info?token=REDACTED&keyword=example

HTTPS protects the request from passive interception in transit, but it does not prevent the request target from being recorded by the destination server, reverse proxies, load balancers, web application firewalls, monitoring systems, or diagnostic tooling. The polling implementation can place the same credential into many request records.

Authentication credentials should not be transmitted ...[truncated 1192 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove token from every query-parameter object.

  2. Transmit the credential using an authorization header, for example:

    js
    const options = {
      host: constants.BASE_URL,
      path: fullPath,
      method: "GET",
      headers: {
        "Content-Type": "application/json",
        Authorization: `Bearer ${token}`,
      },
    };
    
  3. Refactor postJson and getJson so authentication is accepted separately from ordinary request parameters.

  4. Configure the server, proxy, monitoring, and error-reporting layers to redact authorization headers and sensitive query keys.

  5. Rotate API tokens that have already been transmitted in URLs.

  6. Add automated tests that fail if token, secret, or authorization values appear in a generated request path.

  7. Avoid documentation commands that print the token directly. Replace echo $GUAIKEI_API_TOKEN with a non-disclosing presence and format check.

T09 · Insecure Skill Coding Practices

Note
Location
src/utils/log.js:25
Finding

Signed URLs and Collected Data Automatically Persisted in Plaintext

Content
View full analysis

Vulnerability Details

File Location: src/xiaohongshu/detail-cli.js:146-160, src/xiaohongshu/search-cli.js:180-210, and src/utils/log.js:25-34
Vulnerability Type: Plaintext storage of potentially sensitive query history, signed URLs, and collected records
Risk Level: Low

Vulnerable Code

The detail output retains the complete source URL, including any xsec_token query parameter:

js
// src/xiaohongshu/detail-cli.js:146-154
request: {
  command: "detail",
  url: url,
  limit: limit,
},
skill_metadata: {
  skill_version: constants.VERSION,
  runtime_version: process.versions.node,
  execution_time: Date.now() - startTime,
},

The complete output is then written to a local file:

js
// src/xiaohongshu/detail-cli.js:158-160
await log.taskWrite(
  `${startTime}_${validator.url2Name(url)}_detail.json`,
  JSON.stringify(finalOutput, null, 2),
);

The logging utility creates the directory and writes the content without setting an explicit restrictive file mode:

js
// src/utils/log.js:25-34
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);

Generated result URLs can also contain signed tokens:

js
// src/api/detail.js:55-60
if (res.data.id && res.data.xsec_token) {
  res.data.url =
    "https://www.xiaohongshu.com/explore/" +
    res.data.id +
    "?xsec_token=" +
    res.data.xsec_token;
}

Technical Analysis

Successful CLI executions are automatically archived under the project-level logs/ directory. The archived JSON includes the request URL and complete API results. Input and generated Xiaohongshu URLs may include xsec_token values.

fs.promises.writeFile is used without an explicit mode, so ...[truncated 1658 chars]

Remediation
View remediation

Remediation Suggestions

  1. Make local result persistence opt-in through an explicit CLI option such as --save.

  2. Redact sensitive URL parameters before output or storage, especially xsec_token.

  3. Create directories and files with restrictive permissions:

    js
    await fs.promises.mkdir(path.dirname(outputFilename), {
      recursive: true,
      mode: 0o700,
    });
    
    await fs.promises.writeFile(outputFilename, content, {
      mode: 0o600,
      flag: "w",
    });
    
  4. Add a configurable output directory rather than always writing inside the project.

  5. Establish a retention period and delete expired result files automatically.

  6. Add logs/ to .gitignore and exclude it from CI artifacts and backups unless explicitly required.

  7. Store a redacted request summary instead of the complete source URL.

  8. Document that saved result files may contain query history, collected content, and signed URLs.

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

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

该代码片段的实际功能范围明显窄于声明描述。它通过两个API端点创建并查询“小红书评论”任务,输入是token、笔记url和评论数量limit,输出是评论结果数据。没有任何关于点赞数、收藏数、博主作品列表、博主整体画像、互动质量评分、异常检测或注水判断的逻辑。因此,虽然“获取评论数据”与声明中的一部分相关,但声明的主要用途和能力明显超出了当前代码所实现的内容,属于描述与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

描述将该技能定位为一个用于评估小红书博主真实互动水平的分析工具,涵盖博主公开作品、单篇笔记数据、KOL筛选和注水判断等较高层能力。但提供的代码只是一个底层API封装:创建单篇笔记详情/评论采集任务并轮询结果,返回笔记和用户链接。它没有展示对“博主公开作品”的遍历汇总,也没有任何针对互动质量、真实性、注水、合作决策的分析逻辑。因此,代码实际行为比声明更窄且重点不同,属于描述与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明的核心用途是评估某个小红书博主或单篇笔记的真实互动水平,用于KOL筛选和判断数据是否注水;而提供的代码块仅涉及“笔记搜索模块”,调用的是 note-search 接口,按关键词创建/获取搜索任务,并处理结果格式与URL拼接。这与声明中的主要能力存在明显偏差:代码没有展示获取博主公开作品列表、汇总博主层面的互动数据、计算真实互动质量、识别注水,甚至也没有明确提取点赞/评论/收藏字段本身,只是通用搜索结果读取。因此该代码块的实际行为与声明目的不一致,属于实质性能力不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个面向小红书博主互动数据分析的技能,应当包含对小红书内容或作者数据的访问、提取、统计或评估逻辑。但给出的代码片段只包含通用参数解析与帮助文本生成,不涉及网络请求、平台访问、数据抓取、数据分析、KOL筛选或互动质量判断。该代码的主要用途与声明的技能用途明显不一致,因此应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个用于分析小红书博主真实互动数据的技能,但提供的代码片段只负责TOKEN有效性校验和错误提示,属于认证/配置辅助模块。该代码本身没有访问小红书、抓取公开作品数据、解析单篇笔记、统计点赞评论收藏或评估互动质量的行为。因此,就该代码片段所展现的实际行为而言,与声明的核心用途存在明显不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个面向小红书数据获取与互动分析的技能,但给出的代码仅实现了本地日志写入功能,没有任何与小红书、博主作品、点赞/评论/收藏数据抓取、解析、计算或评估相关的逻辑。虽然日志功能可能是配套实现的一部分,但就该代码片段本身而言,其实际行为与声明的核心用途明显不一致,并且涉及未声明的本地文件系统写入能力。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose is a Xiaohongshu analytics capability focused on retrieving and evaluating public engagement metrics for creators/posts. The actual code chunk contains only a helper that reads package.json from the local filesystem and returns the package name. This is materially different from the stated purpose and shows no implementation related to network access, Xiaohongshu data retrieval, or engagement analysis. While a utility helper can be part of a larger skill, based on this supplied code chunk alone, the behavior does not match the declared description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个面向小红书博主互动数据分析的技能,但提供的代码片段只实现了通用日志打印和横幅输出,没有任何网络请求、数据抓取、解析、计算或分析相关行为。该代码的实际作用与声明的核心用途明显不一致,因此应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared purpose describes a Xiaohongshu analytics capability focused on obtaining real interaction metrics and evaluating influencer engagement quality. However, this code chunk is limited to helper functions for validating and cleaning search keywords and normalizing search options. While such validation could be a supporting detail in a larger search workflow, the actual behavior shown here does not implement the described core functionality at all. Therefore, the description does not accurately represent what this supplied code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents this skill as an analytics/data-retrieval capability for Xiaohongshu creator engagement metrics. However, the supplied code chunk contains only helper functions for URL normalization, URL type detection, and URL-to-name conversion. There is no network access, scraping, API usage, metric extraction, or engagement analysis in this code. While URL validation could be a supporting detail in a larger skill, this chunk by itself does not actually implement the declared primary purpose, so the behavior shown materially differs from the description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description promises a capability centered on evaluating a Xiaohongshu blogger’s true engagement by obtaining public-work and single-note metrics such as likes, comments, and favorites. The actual code chunk does not implement that primary purpose. Instead, it runs a comment retrieval task for one note URL, with a configurable comment count limit, and returns the fetched comment results. There is no evidence in this chunk of collecting likes, favorites, or aggregating public works for a blogger. While comments are related to engagement, the implemented behavior is materially narrower and different from the declared main function, so this is a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The description emphasizes obtaining true like/comment/favorite data for public works and individual notes, then assessing engagement quality for KOL vetting. This code chunk only orchestrates a profile-based 'post' retrieval task: it takes a creator profile URL, a limit, calls external API functions to create/get a post task, and returns raw results. There is no visible code here for single-note input, no explicit extraction or validation of likes/comments/favorites, and no analysis step to assess whether data is inflated or engagement quality is good. While the external API may return such data, based on the supplied code chunk the represented behavior is broader-vague task fetching and narrower than the declared analysis purpose. Therefore the description does not accurately represent what this code chunk itself actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明的核心能力是“获取博主/笔记真实互动数据并评估互动质量”,但这段代码的实际核心功能是“根据关键词创建并查询搜索任务,返回搜索结果”。代码接收 keyword、type、sort、time、limit 参数,校验后调用 search.createSearchTask 和 search.getSearchTask,再输出 JSON 结果并写日志。整个流程没有显示任何博主级别定位、单篇笔记互动指标抽取、真实性校验、互动质量评分或注水判断逻辑。因此其主要目的与声明明显不一致,属于实质性描述-行为不匹配。

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

The skill declares access to an environment variable (GUAIKEI_API_TOKEN) but does not define an explicit tool/permission scope. That weakens least-privilege controls and makes it harder for a host platform to reason about what sensitive resources the skill is allowed to access. In a skill that also sends data to a third-party API, undeclared secret usage increases review and containment risk.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.