Unauthenticated SSRF via missing host allowlist in craigslist details endpoint
Description
The /craigslist/details endpoint of @profullstack/mcp-server drives a headless-Chrome navigation (page.goto) — or a plain fetch — to an entirely attacker-chosen URL with only a presence check on the input. Unlike the sibling /craigslist/search path, which constrains requests to a craigslist city/host allowlist, the details path applies no host validation, allowing an unauthenticated attacker to coerce server-side requests to arbitrary internal hosts (SSRF).
Root Cause
The details path is meant to fetch a craigslist posting URL. The search path applies a city/host allowlist (index.js:57 citiesToSearch.filter(city => cities.includes(city))), but the details path forgot it: params.url passes a presence-only check if (!params.url) (index.js:112) and flows into craigslistAPI.getPostingDetails(params.url) (index.js:117 -> api-refactored.js:68 -> search.js:365), then into fetchWithPuppeteer -> page.goto(url) (lib/http.js:281) with no scheme/host filtering.
Impact
Semi-blind SSRF / internal reachability oracle with limited reflection. parsePostingDetails (parsing.js:315-472) extracts only craigslist-shaped fields (#postingbody, .price, .attrgroup, #titletextonly) and throws on empty/error pages — so against a non-craigslist internal target the response is near-empty or an error rather than full HTML. The attacker still learns internal reachability/timing and can amplify headless-browser resource use.
Proof of Concept
POST /craigslist/details
Content-Type: application/json
{"url":"http://METADATA_IP/latest/meta-data/"}(replace METADATA_IP with the cloud metadata address). The server navigates headless Chrome to the attacker-supplied URL server-side.
Attack Chain
- Entry:
POST /craigslist/details(index.js:107) with an internal-hosturl. Guard: none (no auth middleware). Bypass proof:src/core/middleware.jshas no authentication layer. - Check:
if (!params.url)presence-only (index.js:112). Guard: presence only. Bypass proof: any non-empty string passes; no scheme/host allowlist applied on the details path (contrast search path city filter atindex.js:57). - Sink:
getPostingDetails(url)(search.js:365) -> defaultusePuppeteer=true->fetchWithPuppeteer->page.goto(url)in headless Chrome (lib/http.js:281), GET. Guard: none. Bypass proof:urlused verbatim; no IP/scheme filtering. - Impact:
parsePostingDetails(html,url)returned asdetails— semi-blind reachability oracle with limited craigslist-selector reflection.
Bypass Evidence
search.js:365-379 shows the details path takes postingUrl with no validation; the only host constraint in the module is the search path's city filter (index.js:57). parsePostingDetails (parsing.js:316,333-338) throws on empty/error pages, bounding reflection to craigslist-shaped fields.
Affected Versions
<= 1.4.12 (code present on HEAD; package.json = 1.4.12, no tags beyond).
Suggested Fix
Apply the same host allowlist used by the search path to the details path: restrict params.url to craigslist hostnames, reject loopback/link-local/private ranges after DNS resolution, and restrict the scheme to http:/https:.
--- Reported by zx (Jace) — GitHub: @manus-use