Back to skill

Security audit

guaikei·小红书博主笔记采集

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it says, but it handles an API credential and saves fetched data in ways users should review before installing.

Install only if you are comfortable sending Xiaohongshu keywords, links, and public-content results to guaikei.com using a GUAIKEI_API_TOKEN. Treat the token as sensitive, consider rotating it if URLs are logged by infrastructure, and delete or protect the local logs directory because successful runs save full returned data automatically.

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

API Token Exposed in URL Query Strings

Content
View full analysis

Vulnerability Details

File Location: src/api/search.js:23-26, 52-59; src/api/detail.js:20-23, 46-50; src/api/comment.js:20-23, 46-50; src/api/post.js:20-23, 46-50; src/utils/request.js:87-92, 110-115
Vulnerability Type: Sensitive credential exposure through URL query parameters
Risk Level: Medium

Vulnerable Code

The API modules add the token to the request parameter object:

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

The shared request utility then serializes all parameters, including the token, into the URL:

js
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),
  },
};
js
params._ = Date.now();

const fullPath = `${path}?${querystring.stringify(params)}`;
const options = {
  host: constants.BASE_URL,
  path: fullPath,
  method: "GET",
  headers: {
    "Content-Type": "application/json",
  },
};

Technical Analysis

The GUAIKEI_API_TOKEN is an authentication credential, but every API method places it in a URL query string. HTTPS encrypts the request while it is in transit; however, it does not prevent the complete URL from being recorded after TLS termination.

Request URLs are routinely captured by reverse-proxy access logs, API gateways, web-server logs, observability platforms, tracing systems, security appliances, and server-side error reports. Query parameters may also be ret ...[truncated 1307 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove the token from all query-parameter objects in src/api/search.js, src/api/detail.js, src/api/comment.js, and src/api/post.js.
  2. Pass the credential through a dedicated authorization header, preferably:
    js
    headers: {
      "Authorization": `Bearer ${token}`,
      "Content-Type": "application/json"
    }
    
  3. Refactor getJson and postJson to accept authentication separately from ordinary request parameters so credentials cannot be accidentally serialized into URLs.
  4. Ensure authorization headers are redacted from application logs, traces, exception reports, and debugging output.
  5. Review proxy, API gateway, server, and observability logs for previously recorded tokens. Restrict access to those logs and shorten their retention where appropriate.
  6. Rotate any token that may already have appeared in URL logs.
  7. Add automated tests asserting that generated request paths never contain token, api_key, or other secret-bearing parameters.

T09 · Insecure Skill Coding Practices

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

Successful API Results Are Automatically Persisted Without Explicit Per-Run Consent

Content
View full analysis

Vulnerability Details

File Location: src/utils/log.js:24-34; src/xiaohongshu/search-cli.js:208-211; src/xiaohongshu/detail-cli.js:158-161; src/xiaohongshu/comment-cli.js:158-161; src/xiaohongshu/post-cli.js:160-163
Vulnerability Type: Insecure retention of potentially sensitive request and response data
Risk Level: Low

Vulnerable Code

The logging utility creates a persistent directory and writes the supplied content to disk:

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);
  utils.printSuccess(`  → 已保存到 ${outputFilename}`);
} catch (error) {
  utils.printError(`日志写入失败: ${error.message}`);
}

Each successful command automatically supplies the complete output object to this utility. For example, the detail command writes both the request metadata and the returned results:

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

The same persistence behavior is present in the search, comment, and post commands:

js
await log.taskWrite(
  `${startTime}_${keyword}_${type}_${sort}_${limit}_search.json`,
  JSON.stringify(finalOutput, null, 2),
);
js
await log.taskWrite(
  `${startTime}_${validator.url2Name(url)}_comment.json`,
  JSON.stringify(finalOutput, null, 2),
);
js
await log.taskWrite(
  `${startTime}_${validator.url2Name(url)}_post.json`,
  JSON.stringify(finalOutput, null, 2),
);

Technical Analysis

Every successful operation creates a durable JSON file under the project-level logs directory. The saved finalOutput includes the normalized request, runtime metadata, and full API response.

Depending on the command, these ...[truncated 1736 chars]

Remediation
View remediation

Remediation Suggestions

  1. Make persistence opt-in through an explicit option such as --output <path> or --save.
  2. If automatic persistence is operationally required, clearly disclose it in the Skill documentation before execution and provide a configuration option to disable it.
  3. Create saved files with restrictive permissions:
    js
    await fs.promises.writeFile(outputFilename, content, { mode: 0o600 });
    
  4. Create the containing directory with restrictive permissions such as 0o700.
  5. Redact xsec_token and any other authentication or tracking parameters from saved request URLs.
  6. Minimize stored content by retaining only fields required for the user's stated purpose rather than the complete API response.
  7. Implement a documented retention period and an automatic cleanup mechanism.
  8. Ensure the logs directory is excluded from version control, build artifacts, support bundles, and shared backups unless explicitly required.
  9. Consider using a user-selected secure output directory rather than writing into the installed project tree.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (59)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents a broader analytics skill for measuring a Xiaohongshu creator's true engagement using likes, comments, and favorites across public works or a single note. However, the code chunk only exposes two functions for creating and polling a comment-retrieval task for a note URL. This is a materially narrower and different behavior than the declared purpose. While comment retrieval could support the broader goal, the supplied code does not implement the full stated capability set, especially likes/favorites retrieval or engagement-quality assessment.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

这段代码的核心功能是调用两个小红书相关API:一个创建单篇笔记详情及评论抓取任务,另一个轮询/获取该任务结果,并对结果中的笔记与用户补充可访问URL。它确实与“小红书单篇笔记详情/评论数据获取”部分相关,但明显不足以支撑描述中的更高层能力,例如博主公开作品级别的数据收集、互动质量评估、判断数据是否注水、为合作决策提供分析依据。若描述仅说“获取单篇笔记详情与评论数据”会较准确;当前描述把数据分析与博主级能力表述得更宽更深,因此存在实质性描述-行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The declared description centers on evaluating a specific Xiaohongshu blogger's real engagement quality by obtaining public works and per-note likes/comments/favorites. However, this code chunk does not analyze blogger interaction quality or target a blogger's corpus directly. Instead, it creates and queries a general keyword note-search task, then enriches results with note and user profile URLs. While search results may include notes with engagement-related fields elsewhere, this chunk's primary behavior is search infrastructure, not KOL authenticity or engagement assessment. Therefore the code behavior is materially different from the declared purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个面向小红书 KOL 数据评估的业务技能,而提供的代码片段只是通用参数解析工具函数(parseArgs、readValueAfterFlag、buildHelp)。它处理命令行选项、校验参数、生成帮助信息,不访问小红书、不处理博主或笔记数据,也不进行任何互动指标分析。这不是单纯的底层支撑细节,而是与声明的核心功能完全不同的实际行为,因此构成明显不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

There is a clear mismatch between the declared purpose and the supplied code chunk. The description claims functionality for obtaining and evaluating Xiaohongshu public engagement data, but the code shown is limited to token format validation and status/error messaging. While authentication can be a supporting detail, this chunk contains none of the core behavior needed for the declared purpose and instead introduces an undeclared operational behavior: directing the user to contact a specific WeChat account for a private token. Therefore the actual behavior represented by this code does not accurately match the declared description.

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

The declared description promises a Xiaohongshu analytics capability focused on collecting real engagement data and evaluating creator quality. The supplied code does none of that; it merely reads package.json from the local filesystem and returns the package name. This is a materially different purpose and resource usage, so the description does not accurately represent the code chunk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个面向小红书KOL分析的数据能力技能,但提供的代码片段只是通用日志/横幅工具模块,不访问小红书资源、不处理博主或笔记数据,也不做任何分析判断。这不是单纯的辅助细节差异,而是当前代码所体现的实际功能与声明的核心目的明显不一致,因此应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个面向小红书KOL分析的技能,核心能力应包括访问博主公开作品、读取单篇笔记互动指标,并据此评估真实互动水平。但提供的代码片段只处理输入验证与格式化:检查关键词长度、特殊字符、http 链接,清洗关键词字符集,以及校正搜索参数范围。这属于通用的搜索前置校验逻辑,既不包含对小红书资源的访问,也不包含任何互动数据处理、统计分析或真实性判断功能。因此,这段代码的实际行为与声明的主要目的存在明显不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This code chunk does not implement the declared core functionality of fetching or evaluating Xiaohongshu engagement data. Instead, it performs a narrow utility role: normalizing URLs, checking whether a URL matches note/profile patterns, and converting a URL into a simple name string. While such URL handling could be a supporting helper within a larger skill, the supplied chunk by itself materially differs from the declared purpose because it contains none of the data acquisition or analytics behavior described.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明的核心能力是面向“博主/KOL评估”的互动数据获取与质量判断,且明确包括点赞、评论、收藏等真实数据。该代码块的实际功能仅限于:校验单篇笔记链接、创建评论抓取任务、获取指定数量的评论结果、输出JSON并记录日志。没有看到获取博主作品列表、汇总博主层面数据、提取点赞/收藏数、或进行任何互动质量评估的逻辑。虽然“单篇笔记评论”与声明主题有部分相关性,但其主功能明显比声明窄且不同,因此构成描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的核心能力是评估某个小红书博主或笔记的真实互动水平,重点在点赞/评论/收藏真实性与KOL筛选决策支持。而该代码片段的实际功能是通用关键词搜索CLI:解析搜索参数、创建并查询搜索任务、返回结果并记录日志。虽然搜索结果可能间接包含相关内容,但从代码可见的主目的不是博主互动质量评估,也没有任何针对博主、单篇笔记真实互动数据、异常注水判断或评分分析的实现。因此代码行为与声明用途存在实质性不一致。

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 39)May include surrounding context.

md
- "分析这条小红书笔记评论区的主要观点和负面反馈: node src/xiaohongshu/detail-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 105)May include surrounding context.

md
- "分析这条小红书笔记评论区的主要观点和负面反馈: node src/xiaohongshu/detail-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 40)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 130)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 136)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 41)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 118)May include surrounding context.

md
- "拉这条笔记的评论做观点聚类: node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 100"

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest limits the skill to retrieving a Xiaohongshu creator's public works and real like/comment/save data for a creator or single note. This CLI instead defines a generic search interface over arbitrary keywords, creates a search task, fetches search results, and returns matched content without any creator-targeted or note-metric-specific logic.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill requires access to the GUAIKEI_API_TOKEN environment variable but does not declare an explicit tool/permission scope limiting what runtime capabilities are allowed. In an agent setting, missing scope boundaries can cause the skill to run with broader-than-necessary ambient authority, increasing the risk of secret exposure or unintended tool use.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The description says the skill should be used even when the user did not mention KOLs, as long as they want to understand a creator's interaction level. That broad activation language can cause over-triggering on ordinary Xiaohongshu-related requests, increasing unintended third-party data sharing, unnecessary token use, and execution of a capability the user did not explicitly request.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The package description and keywords claim capabilities such as mining viral posts, monitoring competitors, market research, trend monitoring, and driving account growth/precision marketing. The provided skill manifest, however, limits the skill to collecting public creator/note engagement metrics to assess authentic interaction quality for KOL screening and collaboration decisions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README advertises capabilities well beyond the skill’s declared purpose of collecting creator notes and real engagement metrics, including trend prediction, competitor monitoring, and broad data mining. This scope mismatch can mislead users and host systems about what the skill is intended to do, increasing the risk of unauthorized or overbroad data collection and use.

Content

No source excerpt is available for this finding.