T09 · Insecure Skill Coding Practices
- Location
amazon-search/amazon-search.js:64- Finding
Shell Command Injection Through the HOME Environment Variable
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is mostly a browser automation helper, but it bundles an under-disclosed Amazon authenticated scraping workflow and gives broad session, cookie, tracing, and package-install guidance without enough guardrails.
Install only if you are comfortable giving the agent broad browser-control capabilities and handling saved browser sessions as credentials. Avoid using real shopping, payment, or production accounts; protect or delete storage-state files; prefer pinned local dependencies over global npm installs; and review the Amazon helper before running it because it uses saved Amazon login state and writes untrusted product data into CSV files.
amazon-search/amazon-search.js:64Shell Command Injection Through the HOME Environment Variable
amazon-search/amazon-search.sh:90Predictable Temporary File Allows Symbolic-Link Overwrite
amazon-search/amazon-search.js:107Spreadsheet Formula Injection in Generated Product CSV Files
amazon-search/README.md:24Inconsistent Unscoped Global Package Installation Creates Supply-Chain Risk
The declared description suggests a general-purpose browser automation and Playwright testing skill. The code instead implements a specific Amazon scraping workflow: it loads an Amazon auth state file, visits Amazon search results, extracts product metadata, and saves structured output to disk. That is materially more specific than web-page testing and includes undeclared data extraction and file-generation behavior. While browser automation via Playwright is consistent at a high level, the primary purpose is not test automation but authenticated e-commerce scraping and CSV export, so this is a description-behavior mismatch.
The declared description is broad and framed around browser automation and Playwright testing, but the code is not primarily a generic testing utility. It is a task-specific Amazon product search scraper that uses Playwright to access Amazon, extract structured product metadata, and save it as a CSV. It also loads a stored authentication state file (~/amazon-auth.json), which is a meaningful capability/resource access not reflected in the description. While browser automation via Playwright is technically involved, the actual behavior is materially more specific and includes scraping and local data export, so the description does not accurately represent the code's behavior.
The skill uses 'env' capability that is not listed in its permissions. This may indicate deceptive intent or missing permission declarations.
The login example saves browser storageState to auth.json without warning that the file may contain authentication cookies, local storage, and reusable session material. In a skill centered on arbitrary Playwright code execution, this is especially dangerous because it provides a ready-made pattern for persisting sensitive session state to disk where it could be leaked, reused, or committed to source control.
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.
- Never commit storage state files containing auth tokens
- Add `*.auth-state.json` to `.gitignore`
- Delete state files after automation completes
- Use environment variables for sensitive data
- By default, sessions run in-memory mode which is safer for sensitive operations
The example records a checkout flow while filling payment card fields, even though the document already explains that traces preserve screenshots, DOM state, and network bodies. This encourages users to create artifacts containing highly sensitive payment data, increasing the risk of PCI violations, accidental disclosure, and long-term retention of cardholder information in trace files.
The documentation explicitly teaches access to cookies, localStorage, sessionStorage, and even raw token extraction via TOKEN=$(playwright-cli --raw cookie-get session_id) without any caution about secrets handling or user consent. In an agent setting, this normalizes credential harvesting patterns and raises the likelihood of accidental exposure, exfiltration, or misuse of authenticated session data.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
playwright-cli route "**/*.jpg" --status=404
playwright-cli route "https://api.example.com/**" --body='{"mock": true}'
playwright-cli route-list
playwright-cli unroute "**/*.jpg"
playwright-cli unroute
The skill documents persistent profiles, snapshots, tracing, video recording, and deletion of browser data but does not warn that these features can store sensitive user content, credentials, browsing history, or remove important local data. In practice, recorded artifacts and persistent profiles often contain secrets and personal data, making this omission risky.
The documentation instructs use of npx playwright-cli without a pinned package version, which allows execution of whatever version is currently resolved from the registry at runtime. In an agent skill context, this increases supply-chain risk and can lead to unexpected or malicious code execution if the package is updated, compromised, or typo-resolved.
The installation guidance uses npm install -g @playwright/cli@latest, and the surrounding text then relies on npx playwright-cli as a command path, both of which leave the executed version floating. In a tool-executing agent environment, unpinned global installation creates a clear supply-chain exposure and undermines reproducibility and reviewability.
The skill documentation is written as a direct Chinese-only user instruction ('一键搜索亚马逊商品并生成 CSV 报告!') while the skill targets amazon.com and does not state that it is intended only for Chinese-speaking users. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.
The skill's operational instructions and warnings are presented entirely in Chinese, which effectively forces a language choice on users. There is no indication that the skill is region-specific or that users can opt into this locale.
The skill instructs the user to load a persisted Amazon authentication state file from the home directory without any warning that the file contains active session material equivalent to account access. In a browser automation context, reuse of saved auth state can expose shopping account data, order history, payment-adjacent flows, or enable unintended authenticated actions if the file is mishandled or used on a shared system.
This code file contains user-facing console output in Chinese, including the primary error and usage guidance, with no indication that the skill is intended only for Chinese-speaking users or that another language is available. That creates a natural-language locale policy issue because the skill implicitly enforces a specific language without user opt-in.
The script automatically loads a persisted authenticated browser state from ~/amazon-auth.json and proceeds to access Amazon without any explicit notice, confirmation, or scope limitation. This can cause users to unknowingly run the automation with their logged-in account, exposing personal account context, enabling unintended authenticated actions, and increasing privacy and session-handling risk if the state file is stale, shared, or compromised.
The documentation instructs users to run npx playwright test, which can resolve and execute a package version that is not explicitly pinned in the command context. If the local environment or package resolution is compromised, this can lead to execution of an unintended or malicious Playwright package version. In a skill that automates browser activity and debugging, that risk is more meaningful because users are being encouraged to run the command directly on their systems.
This example uses npx playwright test without showing any version pinning, so users may run whatever Playwright version resolves in their environment. While this is often normal developer documentation, it still creates a supply-chain exposure if package resolution is influenced by a malicious registry response, typo-squatting, or an unexpected dependency state. The adjacent npm run example is safer when backed by a lockfile, which makes the unpinned npx path comparatively weaker.
The debug workflow tells users to run npx playwright test --debug=cli, again relying on unpinned package execution. Because this command launches an interactive debugging session and encourages attachment to a live browser session, compromise of the executed package could expose local data, credentials, or browser-controlled workflows. The skill context increases the danger slightly because the command is presented as a hands-on operational step, not merely background reference text.
The documentation explicitly demonstrates downloading a file and saving it to a local path using arbitrary Playwright code, but provides no warning that this modifies the local filesystem. In the context of a skill that advertises arbitrary browser automation via run-code, this can normalize behavior that writes files to disk and may lead users or downstream agents to save untrusted content without scrutiny.
The example shows granting clipboard-read and reading clipboard contents without warning that the clipboard may contain sensitive secrets such as passwords, tokens, or personal data. Because this skill enables arbitrary Playwright code execution, documenting clipboard access without guardrails increases the risk of credential or data exposure during automation.
The markdown documents delete-data commands that remove browser session profile data, but it does not warn that cookies, storage, history, and other persisted state may be permanently lost. Because this operation affects user data and is irreversible, the skill description should include an explicit caution before presenting the command examples.
The documentation explicitly demonstrates saving browser session state, including cookies and localStorage, to a file and restoring it later. While this is a legitimate Playwright capability, it can persist authentication material and session tokens to disk, creating a credential exposure risk if the file is stolen, committed to source control, or reused improperly. The skill context makes this somewhat less suspicious because storage-state management is the stated purpose, but it is still security-sensitive due to the handling of authenticated sessions.
playwright-cli open https://example.com
playwright-cli eval "() => { document.cookie = 'session=abc123'; localStorage.setItem('user', 'john'); }"
# Save state to file
playwright-cli state-save my-session.json
# ... later, in a new session ...
The documentation includes generated test code with hardcoded credentials, including a plaintext password, and does not warn users against copying this pattern into real test suites. In a browser automation/test-generation skill, examples are likely to be reused directly, which can normalize insecure handling of secrets and lead to accidental credential exposure in source control, logs, or CI artifacts.
The tracing documentation explicitly states that traces capture full DOM snapshots, screenshots, network headers and bodies, and console output, but it provides no privacy or data-handling warning. In a browser automation skill, this is dangerous because traces can silently retain credentials, session tokens, personal data, and other secrets that may later be shared, stored, or exfiltrated.
Detected: suspicious.dangerous_exec