T09 · Insecure Skill Coding Practices
- Location
scripts/postinstall.js:29- Finding
Post-install Script Destructively Replaces Existing Agent Skill State
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is openly a Xiaohongshu automation tool, but it needs Review because it handles live browser login cookies, alters agent skill state during install, and includes anti-detection automation guidance.
Install only if you are comfortable letting this tool use your active Xiaohongshu browser session and perform account actions such as posting, commenting, collecting, and batch replies. Avoid pasting cookies into chats or shell history, review any batch-reply or posting action manually, and be aware that installation can overwrite an existing redbook Claude skill path.
scripts/postinstall.js:29Post-install Script Destructively Replaces Existing Agent Skill State
src/lib/render.ts:531Untrusted Markdown Is Rendered as Active HTML in an Unsandboxed Browser
The documentation explicitly describes extracting browser cookies from Chrome profiles and funneling them into an API client for authentication. Even though this may be intended as account automation rather than credential theft, browser-cookie harvesting is highly sensitive because session cookies can grant direct account access without passwords and can expose unrelated browser data if mishandled.
Manual trigger via `workflow_dispatch` is also available.
## Build & Test
- `npm run build` — TypeScript compile + chmod
- No test suite yet — verify manually with `redbook whoami`
## Project Structure
- `src/cli.ts` — CLI entry point, 15 commands, `getClient()` is the single cookie→client funnel
- `src/lib/client.ts` — XHS API client (`postComment`, `replyComment`, etc.)
- `src/lib/cookies.ts` — Cookie extraction with Chrome profile auto-discovery
- `src/lib/signing.ts` — Request signing
- `src/lib/analyze.ts` — Viral note analysis and question detection
- `src/lib/reply-strategy.ts` — Batch reply filtering, templating, rate-limited execution
- `src/lib/template.ts` — Viral content template extraction
- `src/lib/render.ts` — Card rendering (markdown → PNG via puppeteer-core, optional dep)
- `SKILL.md` — Skill documentation (serves both Claude Code and OpenClaw/ClawHub)
- `.github/workflows/npm-publish.yml` — CI: build, npm publish, ClawHub publish
## R
The quick-start explicitly tells users to give an AI agent responsibility for installation, connection verification, and cookie-related troubleshooting. That encourages delegated handling of authentication material by an autonomous system, which can lead to session token exposure through prompts, logs, tool outputs, or copied browser data. In an agent skill, this is especially dangerous because the README frames credential access as a normal part of agent operation.
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
|
| `render <文件>` | Markdown 渲染为小红书图文卡片 PNG(需可选依赖) |
### 通用选项
| 选项 | 说明 | 默认值 |
|------|------|--------|
| `--cookie-source <浏览器>` | Cookie 来源浏览器(chrome, safari, firefox) | `chrome` |
| `--chrome-profile <名称>` | Chrome 配置文件目录名(如 "Profile 1"),默认自动检测 | 自动 |
| `--cookie-string <cookies>` | 手动传入 Cookie 字符串:`"a1=值; web_session=值"`(从 Chrome DevTools 复制) | 无 |
| `--json` | JSON 格式输出 | `false` |
### 搜索选项
| 选项 | 说明 | 默认值 |
|------|------|--------|
| `--sort <类型>` | `general`(综合)、`popular`(热门)、`latest`(最新) | `general` |
| `--type <类型>` | `all`(全部)、`video`(视频)、`image`(图文) | `all` |
| `--page <页码>` | 页码 | `1` |
### 分析选项(analyze-viral / viral-template)
| 选项 | 说明 | 默认值 |
|------|------|--------|
| `--comment-pages <n
These instructions tell users to manually copy live session cookie values from DevTools and supply them to the CLI in plain text. Plain-text bearer tokens are highly sensitive and may leak via terminal history, process inspection, clipboard managers, remote shells, and AI assistant transcripts, enabling unauthorized account access. Because the skill is designed for automation, the likelihood of accidental disclosure is higher than in a purely local manual workflow.
The English quick-start repeats the unsafe pattern of delegating browser-cookie authentication troubleshooting to an AI agent. This materially increases the chance that users will expose session credentials to an agent or allow the agent to access the local browser profile on their behalf. The skill context makes this more dangerous because the setup path explicitly targets coding agents as the primary operator.
The troubleshooting section instructs users to copy active session cookie values from Chrome DevTools and pass them directly to the command. Those cookies can be replayed as bearer credentials, so any leakage through shell history, telemetry, screenshots, or agent logs can immediately compromise the user's Xiaohongshu account. The danger is amplified in this skill because agent-assisted setup is promoted elsewhere in the README.
The documented anti-bot context, device fingerprint discussion, and references to protected API access suggest the tool may facilitate access patterns beyond a neutral analytics CLI. If the implementation generates signing headers or synthetic fingerprint telemetry, that would materially increase operational and policy risk by helping automate around platform protections.
The documented anti-bot context, device fingerprint discussion, and references to protected API access suggest the tool may facilitate access patterns beyond a neutral analytics CLI. If the implementation generates signing headers or synthetic fingerprint telemetry, that would materially increase operational and policy risk by helping automate around platform protections.
The documented anti-bot context, device fingerprint discussion, and references to protected API access suggest the tool may facilitate access patterns beyond a neutral analytics CLI. If the implementation generates signing headers or synthetic fingerprint telemetry, that would materially increase operational and policy risk by helping automate around platform protections.
The documented anti-bot context, device fingerprint discussion, and references to protected API access suggest the tool may facilitate access patterns beyond a neutral analytics CLI. If the implementation generates signing headers or synthetic fingerprint telemetry, that would materially increase operational and policy risk by helping automate around platform protections.
The documented anti-bot context, device fingerprint discussion, and references to protected API access suggest the tool may facilitate access patterns beyond a neutral analytics CLI. If the implementation generates signing headers or synthetic fingerprint telemetry, that would materially increase operational and policy risk by helping automate around platform protections.
The documented anti-bot context, device fingerprint discussion, and references to protected API access suggest the tool may facilitate access patterns beyond a neutral analytics CLI. If the implementation generates signing headers or synthetic fingerprint telemetry, that would materially increase operational and policy risk by helping automate around platform protections.
The documented anti-bot context, device fingerprint discussion, and references to protected API access suggest the tool may facilitate access patterns beyond a neutral analytics CLI. If the implementation generates signing headers or synthetic fingerprint telemetry, that would materially increase operational and policy risk by helping automate around platform protections.
This section gives concrete anti-detection instructions for automating platform interactions, such as using timing jitter and avoiding patterns that trigger bot detection. That is dangerous because it directly enables users or agents to evade platform safeguards while performing automated actions on an authenticated account.
The best-practices section instructs users how to space and vary automated actions to reduce detection, which is functionally an evasion playbook. In context, this supports stealthy automated engagement and increases the likelihood of account abuse, policy violations, or large-scale spam automation.
The sample code loads cookies from Chrome and uses them to instantiate an authenticated client. While that can be legitimate for session reuse, it matches information-stealer patterns because it programmatically harvests browser session material, which is highly sensitive and transferable if mishandled.
intersections) 4. Audience Persona (demographics, intent, preferences) 5. Competitive Landscape (creator profiles, strategy patterns) 6. Content Opportunities (tiered recommendations with data backing) 7. Content Ideas (specific hooks, angles, targets)
import { XhsClient } from "@lucasygu/redbook";
import { loadCookies } from "@lucasygu/redbook/cookies";
const cookies = await loadCookies("chrome");
const client = new XhsClient(cookies);
const results = await client.searchNotes("AI编程", 1, 20, "popular");
const topics = await client.searchTopics("Claude Code");
--cookie-source)puppeteer-core and marked (npm install -g puppeteer-core marked). Uses your existing Chrome — no additional browser download.The requirement that cookie extraction uses native keychain access indicates the skill accesses sensitive local credential material to authenticate against Xiaohongshu. In an agent context, accessing browser cookies and keychain-protected secrets materially raises the risk of credential theft, account compromise, and unintended cross-account access.
- Node.js >= 22
- Logged into xiaohongshu.com in Chrome (or Safari/Firefox with `--cookie-source`)
- macOS (cookie extraction uses native keychain access)
- **For card rendering only:** `puppeteer-core` and `marked` (`npm install -g puppeteer-core marked`). Uses your existing Chrome — no additional browser download.
Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
2. **Add persona-based reply** — extend `batch-reply` with `--persona <file>` option
3. **Add Gemini cover generation** — new `generate-cover` command with optional `@google/genai` dep
4. **Add Module L** to SKILL.md — AI Cover Generation analysis module
5. **Update SKILL.md metadata** — add `requires.env` for `GEMINI_API_KEY` (optional)
6. **Add `redbook monitor`** — simple comment monitoring loop with configurable interval
---
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
extract-zip 2.0.1 is present as a transitive dev dependency of @puppeteer/browsers and is used for archive extraction, a high-risk operation when handling downloaded browser packages. Symlink/path traversal bugs in archive extraction can lead to arbitrary file overwrite during install or browser-download workflows if a malicious archive or compromised upstream source is processed.
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
}
/**
* Patch @steipete/sweet-cookie keychain timeout bug.
*
* Published v0.1.0 hardcodes `timeoutMs: 3_000` in chromeSqliteMac.js,
* ignoring the caller's value. The macOS `security` CLI often needs >3s
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
}
/**
* Patch @steipete/sweet-cookie keychain timeout bug.
*
* Published v0.1.0 hardcodes `timeoutMs: 3_000` in chromeSqliteMac.js,
* ignoring the caller's value. The macOS `security` CLI often needs >3s
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
}
/**
* Patch @steipete/sweet-cookie keychain timeout bug.
*
* Published v0.1.0 hardcodes `timeoutMs: 3_000` in chromeSqliteMac.js,
* ignoring the caller's value. The macOS `security` CLI often needs >3s
Detected: suspicious.dangerous_exec