Back to skill

Security audit

Patchright Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real browser automation tool, but it exposes a persistent, unauthenticated browser-control service with broad navigation and JavaScript execution beyond its local-testing purpose.

Review before installing. Only run this in a trusted local environment, stop the server when finished, avoid using it with sensitive logged-in sessions, choose screenshot paths carefully, and pin/review the Patchright dependency. The skill should be tightened with authentication, URL allowlists, safer screenshot output handling, and clearer disclosure of public-web scraping and JavaScript execution.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (3)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/server.py:104
Finding

Unauthenticated Local Browser-Control Service Exposes Arbitrary Navigation and JavaScript Execution

Content
View full analysis

Vulnerability Details

File Location: scripts/server.py:104-124, scripts/server.py:127-164, scripts/server.py:174-181
Vulnerability Type: Missing authentication and authorization on a privileged browser-control interface
Risk Level: High

Vulnerable Code

python
async def evaluate(self, script):
    if not self.page:
        return {"status": "error", "message": "No page open"}
    result = await self.page.evaluate(script)
    return {"status": "success", "result": result}

async def handle_call(self, data):
    tool = data.get("tool")
    args = data.get("args", {})

    handlers = {
        "launch": lambda: self.start_browser(args.get("headless", False)),
        "close": self.close_browser,
        "navigate": lambda: self.navigate(args["url"]),
        "screenshot": lambda: self.screenshot(args.get("path", "screenshot.png"), args.get("full_page", False)),
        "click": lambda: self.click(args["selector"]),
        "type": lambda: self.type_text(args["selector"], args["text"]),
        "get_text": lambda: self.get_text(args["selector"]),
        "get_url": self.get_url,
        "get_title": self.get_title,
        "evaluate": lambda: self.evaluate(args["script"]),
    }

    if tool not in handlers:
        return {"status": "error", "message": f"Unknown tool: {tool}"}
python
async def handle_client(self, reader, writer):
    try:
        data = await reader.read(65536)
        request = json.loads(data.decode())

        if request.get("cmd") == "stop":
            self.running = False
            response = {"status": "success", "message": "Server stopping"}
        elif request.get("cmd") == "status":
            response = {"status": "success", "browser": self.browser is not None, "page": self.page is not None}
        else:
            response = await self.handle_call(request)

        writer.write(json.dumps(response).encode())
        await writer.drain()
    except Exception as e:
        writer.write(js
...[truncated 3444 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace the TCP listener with a Unix-domain socket stored in a directory accessible only to the owning user, and set restrictive filesystem permissions.
  2. If TCP must be used, generate a cryptographically random token for each server launch and require constant-time token validation on every request.
  3. Do not place authentication secrets in command-line arguments; use a permission-controlled file descriptor, environment mechanism, or protected token file.
  4. Restrict navigation to explicitly approved schemes, hosts, address ranges, and ports. Resolve hostnames and validate all resulting addresses to prevent DNS-based allowlist bypasses.
  5. Deny link-local metadata endpoints and other sensitive internal targets unless specifically required.
  6. Remove evaluate from the default command set. If it is required, place it behind an explicit high-risk opt-in and an additional authorization check.
  7. Use isolated browser contexts for separate authorized clients rather than sharing one persistent page and session.
  8. Add request-size limits, read timeouts, schema validation, rate limiting, and structured security logging.
  9. Ensure the primary documentation clearly discloses the evaluate capability and its security implications.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/server.py:65
Finding

Caller-Controlled Screenshot Paths Permit Arbitrary Overwrite of User-Writable Files

Content
View full analysis

Vulnerability Details

File Location: scripts/server.py:65-70; equivalent behavior in scripts/executor.py:78-94
Vulnerability Type: Unrestricted file path and unsafe file overwrite
Risk Level: Medium

Vulnerable Code

python
async def screenshot(self, path="screenshot.png", full_page=False):
    if not self.page:
        return {"status": "error", "message": "No page open"}
    path = str(Path(path).absolute())
    await self.page.screenshot(path=path, full_page=full_page)
    return {"status": "success", "path": path}

The one-shot executor contains the same unsafe path behavior:

python
async def screenshot(path: str = None, full_page: bool = False):
    """Take screenshot and save to file."""
    global _page

    if not _page:
        return {"status": "error", "message": "No page open. Navigate first."}

    if not path:
        path = f"screenshot_{int(asyncio.get_event_loop().time())}.png"

    await _page.screenshot(path=path, full_page=full_page)
    return {
        "status": "success",
        "path": str(Path(path).absolute()),
        "url": _page.url
    }

Technical Analysis

The screenshot destination is supplied directly by the caller. Calling Path(path).absolute() converts the value to an absolute path but does not restrict it to a safe directory, reject path traversal, prevent symbolic-link traversal, or prevent replacement of an existing file.

In server mode, this issue combines with the unauthenticated control interface: any local process that can access port 9222 can select a destination path. In one-shot mode, exploitation requires influence over the command arguments.

The resulting file contains image bytes rather than freely selected attacker content, which limits direct code-injection opportunities. Nevertheless, overwriting an existing user-writable file can destroy data or disrupt programs that depend on the targeted file.

Attack Path

  1. The persistent browser server is r ...[truncated 1218 chars]
Remediation
View remediation

Remediation Suggestions

  1. Create a dedicated screenshot output directory with permissions limited to the skill owner.
  2. Accept only generated filenames or simple basename components rather than arbitrary paths.
  3. Resolve the candidate destination with Path.resolve() and verify that it remains beneath the approved output directory.
  4. Reject absolute paths, .. components, device paths, and destinations involving symbolic links.
  5. Use exclusive file creation and refuse to overwrite existing files unless the user explicitly authorizes replacement.
  6. Apply file-count and file-size quotas to reduce disk-exhaustion risk.
  7. Return the generated safe path to the caller instead of allowing the caller to select an unrestricted destination.

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Open-Ended Patchright Dependency Allows Installation of Unreviewed Future Releases

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1
Vulnerability Type: Unpinned third-party dependency and non-reproducible installation
Risk Level: Medium

Vulnerable Code

text
patchright>=0.0.1

Technical Analysis

The requirement specifies only a very low minimum version and no upper bound, exact version, lock file, or package hash. A fresh installation can therefore resolve to any future Patchright release published under the same package name.

Because Python packages may execute code during installation and are imported with the privileges of the skill process at runtime, accepting unreviewed future releases increases supply-chain exposure. It also makes builds non-reproducible: two installations performed at different times may receive materially different code.

The audit did not identify evidence that the current Patchright package is malicious. The confirmed issue is the unsafe dependency policy, not a confirmed compromise of the dependency.

Attack Path

  1. An attacker compromises the upstream package publication account or otherwise causes a malicious future Patchright version to become available from the configured package index.
  2. A user installs the project with pip install -r requirements.txt.
  3. The resolver accepts the malicious release because it satisfies patchright>=0.0.1.
  4. Package installation hooks or imported runtime code execute with the installing or running user's privileges.
  5. The malicious release can access data and resources available to that user and browser automation environment.

Impact Assessment

A compromised dependency could execute Python code with the privileges of the user installing or running the skill. The potential scope includes:

  • Reading or modifying user-accessible files.
  • Accessing browser data and automation inputs.
  • Initiating network connections.
  • Altering browser behavior or captured results.
  • Compromising the integrity and reprod ...[truncated 143 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin Patchright to an exact version that has been reviewed and tested.
  2. Generate a lock file containing all transitive dependencies and exact versions.
  3. Require cryptographic hashes during installation, such as with pip's --require-hashes mode.
  4. Perform dependency updates through a controlled review process rather than accepting them automatically.
  5. Run vulnerability and provenance checks on the pinned package and its transitive dependencies.
  6. Install dependencies in an isolated, least-privileged environment.
  7. Where feasible, use a trusted internal package mirror and retain reviewed artifacts for reproducible builds.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (21)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description emphasizes local browser automation for QA, frontend debugging, E2E testing, screenshots, and interaction with private-network or localhost applications. The supplied code instead performs a specific content-extraction task on a Google search results page, using DOM scraping to collect search result metadata. While browser evaluation is a supporting mechanism consistent with automation tooling, the actual purpose and target resource are materially different from the declared focus on local/dev environments. This is therefore a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description emphasizes browser automation for local web applications, localhost/dev servers, private networks, QA testing, and UI debugging. The supplied code instead has a specific primary purpose: searching Google on the public web and scraping result data into JSON. While both involve browser automation, the actual behavior targets an external website and data extraction workflow that is materially different from the declared local-testing use case. This is not merely an implementation detail; it is a different operational purpose and resource scope.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill exposes browser automation that can read local content, write files such as screenshots, and access network resources, but it declares no explicit tool scope or permission boundaries. That makes it easier for the skill to be invoked with broader effective capabilities than users or orchestrators may expect, increasing the chance of unintended file writes or access to internal web services.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Broad trigger phrases like 'test the app', 'check the site', or 'open localhost' can cause the skill to activate on routine requests that were not intended to authorize browser automation. In this skill, unintended invocation is more dangerous because it launches a persistent browser service and can interact with local/private network applications.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Generic interaction triggers such as 'click', 'type', 'login', or 'sign up' are highly ambiguous and overlap with ordinary conversation. Because the skill can perform real UI actions against localhost and private IP services, accidental invocation could submit forms, modify application state, or use stored session context without the user meaning to authorize those operations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Visual-verification phrases like 'how does it look?' and 'is it working?' are too ambiguous to safely map to a browser-automation skill. In context, this can lead to unprompted navigation, screenshot capture, and inspection of local or private web applications, which may expose sensitive internal data or perform unintended page loads.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The usage examples instruct the skill to save screenshots to disk, but the skill description does not warn users that files will be written locally. This matters because screenshots of localhost/private applications can capture credentials, tokens, internal dashboards, or proprietary data and leave persistent artifacts on disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The examples include clicking buttons, typing credentials, and submitting forms, but the description does not warn that these actions may change application state. In a localhost/private-network context, that can create accounts, alter data, trigger workflows, or authenticate into sensitive internal systems, especially given the persistent browser session design.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The reference documentation materially expands the skill's use from local/private-network QA automation to public-internet Google searching and scraping. That scope drift increases the chance the skill is used for broader browsing, data collection, and bot-evasion activity beyond the stated trust boundary, which is dangerous because operators may rely on the narrower manifest description when approving or sandboxing the skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The documented addition of an evaluate tool enables arbitrary JavaScript execution in whatever page the browser is visiting. In a browser automation skill with access to localhost, private-network apps, and authenticated sessions, this can be used to read or manipulate page state, trigger sensitive actions, and exfiltrate accessible data from internal or local web interfaces far beyond simple QA interactions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The browser is launched with stealth and bot-detection bypass flags/channel choices that are not constrained to the stated local/private QA use case. This makes the capability suitable for interacting with third-party sites while attempting to evade detection, increasing abuse potential and making the skill materially riskier than ordinary browser automation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The navigate tool accepts arbitrary URLs and performs browser automation against them, even though the skill is described as intended for localhost and private-network testing. In an agent setting, this broadens the trust boundary and can enable browsing to external attacker-controlled sites, which may facilitate data exfiltration, phishing-style interaction automation, or misuse of internal network access from the host running the skill.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

This code writes screenshots to disk via _page.screenshot(path=path, ...), which can persist page contents and potentially sensitive data locally. While there is a short docstring and tool description, there is no explicit warning, confirmation, or visible disclosure that the operation saves browser content to a file path on the user's system.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script is explicitly designed to inspect and debug Google search pages, which falls outside the declared scope of local/private web-application automation. In an agent skill with browser-control capabilities, this scope drift is dangerous because it enables interaction with public websites and weakens trust boundaries, increasing the chance of unintended scraping, policy bypass, or misuse beyond localhost/private QA tasks.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This script adds broad public-internet browsing and scraping capability by constructing a Google search URL and automating navigation and extraction of results. That exceeds the declared skill scope of local/private web automation, which increases the risk of policy bypass, unintended external data access, and misuse of the browser automation channel for general reconnaissance or data collection.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code specifically automates Google search result retrieval and scraping, which is not justified by the stated purpose of QA/testing for local development environments and private networks. In context, this mismatch is dangerous because an operator may trust the skill as local-only while it actually enables external reconnaissance and collection from public websites.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The server exposes an evaluate tool that accepts arbitrary JavaScript and executes it in the active browser page context with no restriction on origin, capability, or allowed operations. In a skill designed for browser automation on localhost, private networks, and authenticated web apps, this materially expands scope from UI automation into arbitrary script execution against sensitive pages, enabling DOM exfiltration, token theft, state-changing actions, and bypass of higher-level safety controls.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The screenshot guidance writes page contents directly to a local file path without warning about sensitive data handling. Screenshots of local apps, private-network systems, or authenticated sessions can capture credentials, personal data, or internal information and leave recoverable artifacts on disk.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency is only lower-bounded (patchright>=0.0.1), which allows installation of any future version, including breaking or compromised releases. In a browser automation skill that explicitly advertises bot-detection bypass and interaction with local/private web apps, a malicious or vulnerable upstream package could gain powerful access to local services, credentials, screenshots, and browser session data.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
patchright>=0.0.1

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This markdown file describes the screenshot tool as saving output to a user-supplied path, which can affect local files and filesystem state. The surrounding documentation provides usage examples but does not include any warning or caution about file creation, overwriting, or choosing a safe destination path.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The script extracts and prints part of document.body.innerHTML and takes a screenshot of the live page, which can capture third-party content, account state, or other sensitive page data. Although limited to debugging, collecting and emitting page content from a public site is not justified by the stated local/private QA purpose and creates unnecessary data exposure risk in logs and local artifacts.

Content

No source excerpt is available for this finding.