T05 · Unauthorized Access and Privilege Escalation
- Location
src/index.ts:38- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
{ if (!url || !/^https?:\/\//i.test(url)) { throw new Error('Invalid URL'); } const page = await fetchPage(url); ``` ### Technical Analysis All three registered tools allow callers to make HTTP or HTTPS requests from the runtime environment. The validation verifies only that the input begins with `http://` or `https://`; it does not restrict the destination host or resolved IP address. Consequently, callers can target: - Loopback addresses such as `127.0.0.1` and `::1`. - RFC1918 private networks. - Link-local addresses. - Cloud instance metadata services. - Internal DNS names and otherwise inaccessible administration services. - IPv4 addresses represented using alternate textual encodings, unless canonicalized and checked. The use of `redirect: 'follow'` further permits a public URL to redirect the request to an internal d ...[truncated 1973 chars]- Remediation
View remediation
