read_pdf url source: SSRF and file:// local-file read bypass path confinement
Description
The read_pdf tool accepted URL sources with no SSRF or scheme validation. In affected versions, the URL branch passed source.url directly to PDF.js, which could fetch internal HTTP endpoints (SSRF), follow redirects to private hosts, and read arbitrary local PDFs via file:// URLs — bypassing the path confinement applied to the path source.
Impact
An attacker who can influence the source URL (for example via LLM tool calls or prompt injection) could probe internal services and cloud metadata endpoints, and read PDF files anywhere on disk via file://, despite path-based confinement.
Fix
Fixed in #280 (shipped in v2.4.1 and later):
- URL sources are fetched via application-controlled
fetch()with manual redirect re-validation - Non-
http(s)schemes (includingfile://) are rejected - Private/loopback/link-local/metadata IPs are blocked before any network call
- PDF.js receives the body as
data, not a remote URL
Upgrade to @sylphx/pdf-reader-mcp >= 2.4.1 (recommended: latest 3.x).
Credits
Reported by @geo-chen via private advisory on 2026-06-05.