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. ]]>
