Skip to content

[New Advisory] Path Traversal in Screenshot/PDF Save Path in mcp-playwright #7258

@hacnho

Description

@hacnho

Advisory Details

Package: @anthropic-ai/mcp-playwright (npm) / executeautomation/mcp-playwright
Repository: https://github.com/executeautomation/mcp-playwright
CWE: CWE-22 (Path Traversal)
Severity: Medium

Summary

The screenshot and PDF save functionality accepts user-supplied file paths without validation. An attacker can use path traversal sequences to write screenshots or PDFs to arbitrary locations on the filesystem.

Details

When saving screenshots or PDFs, the tool accepts a file path parameter that is used directly to write the output file. There is no path validation, canonicalization, or restriction to a specific output directory. Path traversal sequences like ../../ can be used to write files outside the intended directory.

PoC

  1. Use the screenshot tool with save path set to ../../tmp/screenshot.png
  2. The screenshot is saved to /tmp/ instead of the expected output directory
  3. Can overwrite sensitive files if the process has write permission

Impact

Arbitrary file write via path traversal. An attacker can overwrite configuration files, scripts, or other sensitive files on the host filesystem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions