T09 · Insecure Skill Coding Practices
- Location
scripts/save_test_script.py:57- Finding
Arbitrary Command Injection in Generated Replay Scripts
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This UI testing skill has a coherent purpose, but it needs review because it stores sensitive test evidence and generates executable scripts and HTML reports without enough safeguards.
Use this only with trusted test sessions in an isolated workspace. Avoid recording secrets or production accounts, inspect generated .sh and .bat files before running them, and do not share generated HTML reports until screenshots, URLs, typed values, and embedded files have been reviewed or redacted.
scripts/save_test_script.py:57Arbitrary Command Injection in Generated Replay Scripts
scripts/save_test_report.py:71Persistent HTML and Script Injection in Generated Test Reports
{url}')
if selector:
meta_parts.append(f'🎯 选择器: {selector}')
if inp_val:
meta_parts.append(f'⌨️ 输入值: {inp_val}')
```
```python
{desc}
```
```python
{cmd}{description}
``` The base URL is inserted into both an attribute and visible HTML: ```python {"" if not base_url else f'scripts/save_test_report.py:44Arbitrary Local File Disclosure Through Unrestricted Screenshot Paths
The description promises an end-to-end UI automation testing skill with browser execution, recording, screenshot capture, and final reporting. This code chunk is a narrower utility: it reads a previously recorded session and saves it as replayable shell/batch scripts and a JSON test description. That is related to the declared domain, but materially incomplete versus the stated primary purpose. There are no obvious undeclared malicious capabilities; the mismatch is that the implemented functionality is only the test-script export portion of the advertised workflow.
The skill instructs the agent to read and write local files such as session data, generated scripts, screenshots, and HTML reports, but it declares no explicit tool scope or permission boundaries. This creates an authorization gap where the agent may access or modify filesystem content beyond what users expect, increasing the risk of unintended data exposure or overwriting local files.
The skill is designed to capture screenshots, record detailed user actions, and embed evidence into a standalone HTML report, but it does not warn users that potentially sensitive on-screen data and interaction history will be stored. This can lead to inadvertent collection and persistence of credentials, personal data, internal URLs, or other confidential information.
The skill title and operational instructions are written as mandatory Chinese-language guidance, and the trigger list mixes languages but does not indicate that users may interact in their preferred language. This creates a natural-language locale constraint without opt-in or justification, which can violate language/locale policy requirements.
The file's module docstring and usage/help text force a specific language for user-facing instructions. Under the policy, language constraints should be opt-in or clearly justified as region-specific; neither is present here.
The script writes a full HTML report that includes embedded screenshots and step metadata such as URLs, selectors, input values, and error messages. Although the file write is logged after completion, there is no user-facing warning in the code documentation that the generated report may contain sensitive data copied from the session and screenshots.
The script serializes recorded session commands directly into runnable .sh and .bat files with no validation, escaping, or trust boundary enforcement. Because session steps come from recorded data and are emitted as raw shell lines, any injected or malformed command in the session file becomes executable when a user later runs the generated script, creating a command-injection and unsafe code-generation risk.
The HTML output hard-codes the document language to zh-CN, and the surrounding user-facing strings are also fixed in Chinese. This is a natural-language locale constraint with no opt-in or documented justification, which can violate organizational language-choice policies.
The module docstring, CLI description, argument help text, and user-facing status messages are all presented only in Chinese. This imposes a specific language on users without opt-in or an explanation that the tool is intentionally region-specific.