Executive brief
url-to-png is a utility that captures screenshots of web pages using Playwright. An attacker can exploit the screenshot feature to read arbitrary files from the server by supplying specially crafted file:// URLs, bypassing intended protocol restrictions. This could expose sensitive configuration files, application secrets, or other confidential data stored on the system.
Technical details
The vulnerability is a path traversal / arbitrary file read flaw (CWE-22) in the screenshot feature that accepts file:// protocol URLs. The vulnerable component fails to validate or restrict the URL protocol before passing it to Playwright's screenshot function, allowing an attacker to read any file accessible to the application process. No authentication or user interaction is required; exploitation is triggered by supplying a malicious URL to the application. The attack is network-reachable and exploitable with no privileges required. A fix was released in v2.0.3, which restricts accepted URLs to http and https protocols only.
Affected products
- jasonraimondi @jmondi/url-to-png < 2.0.3
Timeline
- 2024-06-05: disclosed: Security advisory published
- 2024-06-05: patched: Version 2.0.3 released with fix restricting URLs to http/https protocols