Back to skill

Security audit

小红书笔记作品数据获取

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to retrieve public Xiaohongshu data as advertised, but it automatically saves complete results to a predictable temporary log directory without clear privacy, retention, or opt-out controls.

Review this before installing on shared machines or when researching sensitive topics. Expect your Xiaohongshu queries, target URLs, comments, profile data, and returned links to be saved locally after successful runs, and clean or protect the temp log directory if that history should not remain accessible.

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

Warning
Location
src/utils/log.js:38
Finding
Automatic Storage of Sensitive Results in an Unsafe Shared Temporary Directory<![CDATA[ ## Vulnerability Details **File Location**: `src/utils/log.js:38-48` **Additional Call Sites**: `src/xiaohongshu/search-cli.js:207-209`, `src/xiaohongshu/detail-cli.js:146-148`, `src/xiaohongshu/post-cli.js:165-167`, `src/xiaohongshu/comment-cli.js:185-187` **Vulnerability Type**: Unsafe temporary-file handling and sensitive-data exposure **Risk Level**: Medium ### Vulnerable Code ```js const outputDir = path.join( os.tmpdir(), "xiaohongshu-guaikei", "logs", dayDir, ); const outputFilename = path.join(outputDir, safeFilename); try { await fs.promises.mkdir(outputDir, { recursive: true }); await fs.promises.writeFile(outputFilename, content); ``` All four successful command workflows pass the complete serialized result to this function. For example: ```js await log.taskWrite( `${startTime}_${validator.url2Name(url)}_comment.json`, JSON.stringify(finalOutput, null, 2), ); ``` Equivalent persistence calls are present in the search, detail, and post commands. ### Technical Analysis The Skill automatically archives complete API results beneath the predictable shared path: ```text SYSTEM_TEMP/xiaohongshu-guaikei/logs/YYYY-MM-DD/ ``` The code does not explicitly create the directory with owner-only permissions, does not create files with an explicit `0600` mode, and does not prevent symbolic-link traversal. The resulting access controls therefore depend on the operating system and the invoking process's umask. On a typical multi-user Unix system with a permissive umask, result files may be readable by other local users. The archived JSON includes the submitted keyword or URL and the complete API response. Search and detail responses may contain generated Xiaohongshu URLs carrying `xsec_token` query values. These values are distinct from `GUAIKEI_API_TOKEN`, which is not written to the log, but they may still be sensitive access-bearing link parameters. Because `mkdir` accepts an already existing path and `writeFile` follows symb ...[truncated 2383 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Store archived results in a user-private application data directory rather than a globally shared temporary directory. 2. If temporary storage is required, create a randomized private directory: ```js const privateDir = await fs.promises.mkdtemp( path.join(os.tmpdir(), "xiaohongshu-guaikei-"), ); await fs.promises.chmod(privateDir, 0o700); ``` 3. Enforce restrictive permissions on every directory and result file: ```js await fs.promises.mkdir(outputDir, { recursive: true, mode: 0o700, }); await fs.promises.writeFile(outputFilename, content, { mode: 0o600, flag: "wx", }); ``` 4. Use exclusive creation so existing files are not silently overwritten. Where the platform supports it, open files with protections equivalent to `O_CREAT`, `O_EXCL`, and `O_NOFOLLOW` to reject symbolic links. 5. Do not rely only on `lstat` followed by `writeFile`, because that introduces a time-of-check/time-of-use race. Use atomic file-opening flags when available. 6. Make result archival opt-in through an explicit CLI option such as `--save`. Clearly disclose the destination and retention behavior before writing. 7. Redact access-bearing query parameters before persistence, particularly `xsec_token`. Preserve only the minimum fields needed for the documented archival purpose. 8. Add retention controls and automatic cleanup for old result files. 9. Add automated tests that verify: - Directories are owner-accessible only. - Files are created with mode `0600`. - Existing files are not overwritten. - Symbolic-link destinations are rejected. - Sensitive URL parameters are removed from archived output. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (72)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill advertises external data retrieval but also states that execution results are automatically archived to local logs, while the top-level description does not prominently disclose local filesystem writes. Undeclared local persistence can create privacy and data-retention risk because searched keywords, URLs, comments, or profile data may be stored on disk without explicit user expectation.

Ae1

High
Category
analysis-evasion
Content
- "这条小红书笔记评论区在吐槽什么 → node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 200"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "这条小红书笔记评论区在吐槽什么 → node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 200"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "这条小红书笔记评论区在吐槽什么 → node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 200"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "这条小红书笔记评论区在吐槽什么 → node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 200"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "这条小红书笔记评论区在吐槽什么 → node src/xiaohongshu/comment-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy' --limit 200"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "看这个小红书博主最近 30 条作品发什么 → node src/xiaohongshu/post-cli.js --url 'https://www.xiaohongshu.com/user/profile/xxx?xsec_token=yyy' --limit 30"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "看这个小红书博主最近 30 条作品发什么 → node src/xiaohongshu/post-cli.js --url 'https://www.xiaohongshu.com/user/profile/xxx?xsec_token=yyy' --limit 30"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "看这个小红书博主最近 30 条作品发什么 → node src/xiaohongshu/post-cli.js --url 'https://www.xiaohongshu.com/user/profile/xxx?xsec_token=yyy' --limit 30"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "看这个小红书博主最近 30 条作品发什么 → node src/xiaohongshu/post-cli.js --url 'https://www.xiaohongshu.com/user/profile/xxx?xsec_token=yyy' --limit 30"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "分析这篇小红书爆款笔记为什么火 → node src/xiaohongshu/detail-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy'"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "分析这篇小红书爆款笔记为什么火 → node src/xiaohongshu/detail-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy'"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "分析这篇小红书爆款笔记为什么火 → node src/xiaohongshu/detail-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy'"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
- "分析这篇小红书爆款笔记为什么火 → node src/xiaohongshu/detail-cli.js --url 'https://www.xiaohongshu.com/explore/xxx?xsec_token=yyy'"
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
SKILL.md:16