T09 · Insecure Skill Coding Practices
- Location
src/browser.ts:46- Finding
OS Command Injection in Browser Automation Command Construction
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent web QA tool, but its implementation contains unsafe command execution paths that could let crafted test inputs run local system commands.
Review before installing. Only run this on trusted test suites and staging or test accounts until the shell command construction is fixed, because malicious URLs, YAML/JSON steps, report paths, or company names could execute local commands. Treat generated screenshots, console logs, and reports as sensitive, and avoid PDF output unless ai-pdf-builder is reviewed, declared, and pinned.
src/browser.ts:46OS Command Injection in Browser Automation Command Construction
src/reporter.ts:164OS Command Injection in PDF Report Generation
src/reporter.ts:173Runtime Execution of an Undeclared and Unpinned Package Through npx
The supplied code does not perform automated QA tasks such as smoke tests, accessibility checks, or visual regression analysis. Instead, it implements helper utilities for waiting, retrying, and determining page stability/loading state. While such utilities could support a QA system, this chunk’s actual behavior is materially narrower and different from the declared purpose. Therefore, the description does not accurately represent what this specific code chunk actually does.
The lockfile pins ws to 8.19.0, and the reported advisories describe memory disclosure and memory-exhaustion denial of service in the WebSocket library. Because this skill depends on agent-browser, which in turn uses ws for browser/automation connectivity, the vulnerable package is plausibly reachable during normal operation and could allow a malicious or malformed peer/server to crash the process or expose memory.
The plan includes capturing console logs, screenshots, and embedding them in reports without warning that these artifacts may contain sensitive application data, credentials, tokens, or personal information. In QA contexts, recorded artifacts are often shared or stored, which increases the chance of unintended data exposure.
The documented browser testing workflow describes clicks, typing, navigation, and interactive mode without warning that it may perform real state-changing actions on live sites. In this skill context, that can cause unintended form submissions, data modification, purchases, account actions, or test contamination if run against production systems.
The plan instructs users to invoke the tool via npx web-qa-bot without pinning a specific version. This allows execution of whatever package version is currently resolved from the registry, which can lead to unexpected or malicious code execution if a compromised or breaking release is published.
Using npx web-qa-bot without a pinned version creates a supply-chain risk because npx may fetch and execute the latest package version at runtime. If the package is hijacked, typo-squatted, or a malicious update is published, users could run attacker-controlled code on their systems.
The command example relies on an unpinned package resolution path, which undermines reproducibility and permits execution drift over time. In a security-sensitive automation tool that interacts with browsers and local files, a malicious update could abuse those permissions for code execution or data access.
An interactive command run via unpinned npx is especially risky because it typically grants broad local access and user trust during exploratory sessions. A compromised package version could exfiltrate credentials, inspect browser state, or alter local files under the guise of QA tooling.
The success criteria reinforce unpinned npx execution, normalizing insecure installation and runtime behavior across adopters. Because this is a browser automation skill, a malicious package update could quickly affect many users with local code execution and access to captured test artifacts.
The exec() helper constructs a shell command by concatenating untrusted arguments into a single string and passes it to execSync(), which invokes a shell. Inputs such as URL, ref, key, script, and screenshot path can contain shell metacharacters, enabling command injection and host-level arbitrary command execution if attacker-controlled data reaches these methods.
The manifest describes a web QA skill focused on automated testing activities, but this file also provides a general-purpose evaluate method that executes caller-supplied JavaScript in the page. While browser automation is expected for QA, arbitrary script execution materially expands the capability beyond the specifically stated testing functions and enables actions unrelated to those declared purposes.
The evaluate() method forwards arbitrary script content into the browser automation subprocess through the same string-built shell execution path. Because only double quotes are escaped, shell metacharacters like $(...), backticks, semicolons, or single quotes may still break out of the intended argument and achieve host command injection, making this more dangerous than mere page-context script evaluation.
The reporter writes assembled markdown output directly to the user-specified path, and that output includes URLs, test errors, console errors, and optional screenshot references. While the code comments describe report generation, there is no user-facing warning, confirmation, or disclosure that potentially sensitive QA data will be persisted to disk.
The code builds a shell command with interpolated mdPath, options.output, and company values and passes it to execSync, which invokes a shell. If any of those fields are attacker-controlled, shell metacharacters can break out of quoting and achieve arbitrary command execution; this is especially dangerous in an automation tool that may consume external input.
The PDF generation path invokes npx ai-pdf-builder without pinning a version, so execution depends on whatever package version is resolved at runtime. In a tool that processes user-controlled report content, this creates a real supply-chain risk and can lead to unexpected code execution if a malicious or compromised package version is installed or fetched.
The JSON report writer serializes the full this.results structure and writes it to disk, which may include detailed test metadata, URLs, console events, errors, and screenshot paths. There is no user-facing disclosure that this potentially sensitive execution data will be stored in a file.
This markdown file includes commands that generate report artifacts such as report.md and report.pdf, but it does not explicitly warn users that running these commands writes files to disk and may overwrite existing paths. For markdown files, SQP-2 applies when user-facing descriptions omit warnings about behaviors that can affect user data or system state.
The lockfile includes yaml 2.8.2, which is reported vulnerable to stack overflow from deeply nested YAML collections. Since this skill directly depends on yaml and likely consumes configuration or test definitions, untrusted or malformed YAML input could crash the process, though the impact is primarily denial of service rather than code execution.
This is a manifest file, so vague-trigger checks apply. The description says the skill is a "Drop-in for manual QA" and "Works with Cursor, Claude, ChatGPT, Copilot" but does not define any explicit trigger phrases, invocation boundaries, or exclusion conditions, which could make activation scope ambiguous in systems that infer routing from manifest text.
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.
"node": ">=18.0.0"
},
"dependencies": {
"yaml": "^2.3.4"
},
"devDependencies": {
"@types/node": "^20.10.0",
The package depends on yaml with a version range that may resolve to a release affected by a stack overflow denial-of-service issue in deeply nested YAML parsing. For an AI/automation skill that may ingest user-controlled configuration or test inputs, this can let an attacker crash the process or disrupt automated workflows if malicious YAML is supplied.
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.
"yaml": "^2.3.4"
},
"devDependencies": {
"@types/node": "^20.10.0",
"typescript": "^5.3.0"
},
"peerDependencies": {
Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.
},
"devDependencies": {
"@types/node": "^20.10.0",
"typescript": "^5.3.0"
},
"peerDependencies": {
"agent-browser": ">=0.7.0"
The screenshot method creates directories and writes screenshot files to disk, which affects the local filesystem. While the code comments describe the implementation, there is no user-visible prompt, log, or warning indicating that files will be created under the configured screenshot directory.
Detected: suspicious.dangerous_exec