Back to skill

Security audit

Zhihu Publisher

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says, but it handles a live Zhihu account in ways that could expose credentials or publish unintended content.

Review this carefully before installing. Use it only with deliberate publishing requests, prefer manual login or an isolated browser profile, do not provide passwords through command-line text, and require a preview plus explicit confirmation before any live Zhihu publication. Avoid using it on article text copied from untrusted sources unless the insertion method is changed to treat content strictly as data.

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
SKILL.md:32
Finding
Zhihu Credentials Exposed Through Process Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 32-40 **Vulnerability Type**: Sensitive data exposure through command-line arguments **Risk Level**: Medium ### Vulnerable Code ```bash ### 3. 获取 ref 并填写凭据 ```bash node xb.cjs run --browser chrome -- batch --bail "wait --load networkidle" "snapshot -i" ``` 记录 textbox ref(通常账号 `@e39`、密码 `@e40`、登录按钮 `@e12`),然后: ```bash node xb.cjs run --browser chrome -- batch --bail "fill @e39 <账号>" "fill @e40 <密码>" "click @e12" ``` > ⚠️ 账号密码通过用户输入获取,**禁止写死到文件中**。 ``` ### Technical Analysis The documented workflow substitutes the user's Zhihu account name and plaintext password directly into the arguments of a `node xb.cjs` process. Although the instructions prohibit hardcoding credentials in files, passing a password as a command-line argument does not adequately protect it. Depending on the host operating system and execution environment, command arguments may be exposed through: - Process inspection utilities available to other local users or processes. - Parent-process telemetry and endpoint monitoring. - Automation framework logs. - Shell command history if the command is issued interactively. - Debugging, crash-reporting, or process-auditing facilities. - Error messages generated by the invoked browser automation tool. Quoting the password does not prevent disclosure because it remains part of the process argument vector. ### Attack Path 1. A user supplies valid Zhihu credentials to the agent. 2. The agent constructs the documented command with the plaintext password embedded in the `fill @e40` argument. 3. The operating system creates the `node xb.cjs` process with that argument available in its process metadata. 4. A local user, monitoring process, logging component, or compromised process captures the command arguments. 5. The exposed credentials are used to access the victim's Zhihu account. ### Impact Assessment Successful exploitation discloses the user's Zhihu login credentials. An ...[truncated 439 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Never place passwords or other secrets in command-line arguments. 2. Extend `xbrowser` or its wrapper to accept sensitive input through a protected standard-input channel or an equivalent secret-input API. 3. Prefer an interactive, masked password prompt whose value is passed directly to the browser automation process without being echoed or serialized. 4. If supported by the automation framework, obtain a browser element handle and supply the secret through an in-memory API rather than command construction. 5. Disable command echoing and ensure automation logs redact values entered into password fields. 6. Clear secret-bearing variables immediately after use and avoid retaining credentials in agent memory or transcripts. 7. Prefer reusing an authenticated browser profile after the initial manual login so the agent does not need to handle the password during later publication runs. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:60
Finding
Command and Page-Context Script Injection Through Unescaped Article Content<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 60-70 **Vulnerability Type**: Unsafe input interpolation into shell and JavaScript commands **Risk Level**: High ### Vulnerable Code ```bash ### 3. 填正文(长文本用 JS 逐段插入) > ❌ 直接 `fill` 长文本(>500字符)会被命令行截断;`fill` 中的 `\n` 会变成普通字符。 > > ✅ 用 `eval` + `document.execCommand('insertText')` 逐段插入,每段 <500 字符。 ```bash node xb.cjs run --browser chrome -- eval "document.querySelector('.DraftEditor-root [role=textbox]').focus()" node xb.cjs run --browser chrome -- eval "document.execCommand('insertText', false, '第1段内容...')" node xb.cjs run --browser chrome -- eval "document.execCommand('insertText', false, '\n\n## 标题\n\n第2段内容...')" # 继续分段... ``` ``` ### Technical Analysis The workflow instructs the agent to place article content directly inside a single-quoted JavaScript string, which is itself embedded inside a double-quoted shell argument passed to an `eval` operation. No escaping, serialization, or input validation is prescribed for the inserted content. This creates two interpretation boundaries: 1. **JavaScript boundary:** Content containing a single quote, backslash, line separator, or crafted JavaScript syntax can terminate the string and append attacker-controlled JavaScript. The resulting code is executed by the browser automation tool in the context of the authenticated Zhihu page. 2. **Shell boundary:** If the command is built as a shell string, content containing double quotes or shell-specific substitution syntax can escape or modify the argument. On shells that evaluate command substitutions or metacharacters, this can lead to local command execution. Splitting the content into segments shorter than 500 characters does not provide security. A functional injection payload can fit within that limit. ### Attack Path 1. An attacker provides or influences article content that the user asks the skill to publish. 2. The content includes quote-breaking JavaScript, such as a single quote follow ...[truncated 1299 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not concatenate article content into executable JavaScript or shell command strings. 2. Transfer article text through a structured data channel, temporary input stream, or direct automation API rather than through `eval`. 3. If JavaScript evaluation is unavoidable, serialize each text segment with a trusted JSON serializer. Pass the resulting JSON string as data rather than manually adding quotation marks. 4. Invoke the automation process through an argument-array API with shell interpretation disabled, such as a direct process-spawn interface that does not use `shell: true`. 5. Avoid `document.execCommand` and use the browser automation framework's native text-insertion or keyboard APIs where possible. 6. Validate that the target is the expected Zhihu editor before inserting content, and restrict evaluated scripts to a fixed, audited expression. 7. Treat externally supplied article text as untrusted, including generated text, copied web content, Markdown, and user-provided drafts. 8. Add tests covering single quotes, double quotes, backslashes, command substitutions, newlines, Unicode separators, and shell metacharacters to verify that content remains inert data. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill automates login and final publication to a live Zhihu account, but it does not require clear user consent checkpoints before sensitive actions, especially the irreversible publish step. In this context, accidental invocation or misinterpreted user intent could cause unauthorized account use, unintended content posting, reputational harm, or disclosure of sensitive material.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The trigger list includes broad phrases such as '知乎文章' and '发知乎文章', which can match ordinary requests about Zhihu articles rather than an explicit request to publish content. Because this skill performs account-affecting browser automation, ambiguous invocation increases the risk of unintended login, draft editing, or publication actions being launched from loosely related user prompts.

Natural-Language Policy Violations

Low
Confidence
87% confidence
Finding
The manifest description is written only in Chinese and provides no indication that other languages are supported or that the user can choose their preferred locale. This can violate a language/locale policy when skills are expected to avoid forcing a specific language without opt-in.

Static analysis

No suspicious patterns detected.