Back to skill

Security audit

Playwright Browser Automation

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a Playwright browser-automation guide, but it includes persistent passwordless root sudoers rules for broad npx commands that users should review before installing.

Review this skill before installing. Avoid copying the sudoers setup, do not grant passwordless root access to npx commands, and prefer pinned Playwright versions with one-time administrator-managed dependency installation. Treat browser artifacts such as screenshots, videos, traces, downloads, cookies, localStorage, and auth.json as potentially sensitive, especially when automating logged-in accounts.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (1)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:294
Finding
Passwordless Root Execution Through Broad npx Sudoers Rules## Vulnerability Details **File Location**: `SKILL.md`, lines 294-301 **Vulnerability Type**: Excessive privileges through persistent passwordless sudo authorization **Risk Level**: High **Vulnerable Code**: ```bash ## Sudoers Setup For Playwright browser installation: # /etc/sudoers.d/playwright username ALL=(root) NOPASSWD: /usr/bin/npx playwright install-deps * username ALL=(root) NOPASSWD: /usr/bin/npx playwright install * ``` ### Technical Analysis The documented sudoers configuration grants an unprivileged account persistent, passwordless permission to run broadly parameterized `npx playwright install` and `install-deps` commands as root. The wildcard suffix permits uncontrolled additional arguments, while `npx` introduces package resolution and package-managed execution into a privileged trust boundary. Elsewhere, the installation guidance uses `npm install -g playwright` without pinning or verifying a specific package version. If package resolution, the npm environment, the installed Playwright package, or its installer behavior is compromised, the authorized command can execute that behavior with root privileges. This violates least privilege because browser dependency installation does not require an ongoing passwordless root capability after setup. ### Attack Path 1. A user follows the documentation and creates `/etc/sudoers.d/playwright` with the supplied rules. 2. The designated unprivileged account gains persistent permission to invoke the allowed `npx playwright` installation commands as root without authentication. 3. An attacker who controls that account, its npm configuration or resolution environment, or a package component reached by the authorized command prepares compromised package or installer behavior. 4. The attacker invokes an authorized command with `sudo`, including any permitted wildcard arguments. 5. The package-managed installation logic executes in the root security context. 6. T ...[truncated 817 chars]
Remediation
## Remediation Suggestions 1. Remove the proposed persistent `NOPASSWD` sudoers rules. 2. Install required operating-system dependencies once through an administrator-controlled provisioning process rather than granting the automation account ongoing elevation. 3. Pin Playwright to an explicitly reviewed version and use a lockfile or other integrity controls where applicable. 4. Avoid running `npx` as root because it combines package resolution and execution in a privileged context. 5. If elevation is operationally unavoidable, create a root-owned, non-writable wrapper that invokes a trusted absolute executable with a fixed package version and fixed arguments. 6. Authorize only that wrapper in sudoers, without wildcard arguments, arbitrary environment preservation, or user-controlled paths. 7. Validate the sudoers policy with `visudo`, restrict the entry to the minimum required account and host, and remove it immediately after provisioning. 8. Perform browser installation in an isolated container or prebuilt image where possible, limiting any compromise to a disposable environment.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (12)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
There is a clear description-behavior mismatch. The declared purpose says this skill performs browser automation directly through the Playwright API, but the supplied code does not import or use Playwright at all. Instead, it constructs JSON-RPC-style requests for MCP tools like browser_navigate and browser_click and merely prints them as conceptual examples. The file docstring and comments explicitly state it is an example for using a Playwright MCP server and that it only shows the conceptual flow. The code also lacks implementation of several advertised capabilities such as screenshots, PDFs, and video recording. The primary purpose of the code is documentation/demo of MCP calls, not direct Playwright browser automation.

Lp3

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding
The skill clearly includes shell-based installation and privileged setup steps, but it does not declare any explicit tool scope or permission boundaries. In an agent ecosystem, missing capability declarations can cause users or orchestrators to underestimate the skill's ability to execute system-level actions, increasing the chance of unsafe invocation.

Rp1

Medium
Category
MCP Rug Pull
Confidence
88% confidence
Finding
Using `npx playwright` without pinning a version makes execution dependent on whatever version is current at runtime, which harms reproducibility and can introduce unexpected or malicious upstream changes. This creates a supply-chain risk if the package or resolved dependency changes after the skill is published.

Rp1

Medium
Category
MCP Rug Pull
Confidence
88% confidence
Finding
The browser installation command relies on an unpinned `npx playwright` resolution, which may fetch a different package version over time. For an automation skill, that can change behavior, introduce incompatible binaries, or expose consumers to supply-chain compromise.

Rp1

Medium
Category
MCP Rug Pull
Confidence
88% confidence
Finding
This optional install command also uses unpinned `npx playwright`, carrying the same supply-chain and reproducibility risks as the primary install path. Because it downloads browser components, the blast radius includes additional executable artifacts on the system.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
npx playwright install webkit

# For system dependencies on Ubuntu/Debian:
sudo npx playwright install-deps chromium
```

## Quick Start
Confidence
95% confidence
Finding
The documentation instructs users to run a Playwright dependency installation command with `sudo`, which encourages privileged execution of network/package operations. In this skill's context, that is more dangerous because later sections also propose sudoers rules, normalizing persistent elevated access for browser tooling.

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding
Running `sudo npx playwright install-deps chromium` combines two risks: privileged execution and unpinned package resolution. If the resolved package or dependency chain is compromised, the command may execute with root privileges, substantially increasing impact.

Missing User Warnings

Medium
Confidence
86% confidence
Finding
The examples encourage creation of screenshots, PDFs, videos, traces, and downloaded files without warning that these artifacts may capture sensitive page contents, credentials, personal data, or proprietary information. Because browser automation often operates on authenticated sessions, artifact generation materially increases privacy and data-retention risk.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The authentication examples include hardcoded credentials, cookie injection, local storage token handling, and persisted auth state without warning about credential leakage or reuse risks. In an agent skill, users may copy these patterns directly and accidentally persist secrets to disk or expose them in logs and artifacts.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The configuration example sets locale, timezone, geolocation, permissions, and a custom user agent without any opt-in guidance. While useful for testing, these settings can spoof identity or location and may produce deceptive interactions or privacy issues if reused blindly in real browsing workflows.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding
The sudoers entry authorizes privileged execution of an unpinned `npx playwright install-deps *` command. This can grant persistent root-capable execution tied to a mutable package resolution path, creating a serious privilege-escalation and supply-chain risk.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding
This sudoers rule similarly permits `npx playwright install *` as root without version pinning or strong command restriction. A mutable package execution path inside sudoers is dangerous because it can turn upstream changes into privileged code execution.

Static analysis

No suspicious patterns detected.