other
- Location
plugin/dist/index.js:185- Finding
DNS validation is not bound to the browser connection, permitting private-network policy bypass ## Remediation Suggestions 1. **Enforce destination policy at the connection boundary.** Use a mandatory filtering proxy or equivalent egress control that resolves destinations, validates every resulting address, and connects only to an approved address. 2. **Prevent direct browser egress.** Ensure Chrome cannot bypass that enforcement through direct connections, alternative proxy settings, or other browser transports. 3. **Fail closed on resolution errors.** Reject requests when destination safety cannot be established. If a proxy resolves destinations, enforce the policy at that proxy. 4. **Do not treat cached DNS approval as connection authorization.** Caching may improve performance but must not replace validation of the destination actually used. 5. **Preserve hostname semantics safely.** A filtering connection layer should retain appropriate HTTP Host and TLS server-name verification while binding the connection to an approved address. 6. **Add regression tests** for changing DNS answers, inconsistent Node/browser/proxy resolution, failed local resolution followed by successful proxy resolution, and cached public answers followed by private connection destinations.
- Content
View full analysis
Vulnerability Details
File Location:
plugin/dist/index.js:166–180, 185–215, 367–388
Vulnerability Type: Server-Side Request Forgery / DNS Rebinding — CWE-918, CWE-367
Risk Level: HighVulnerable Code
DNS validation results are cached independently of Chrome's connection resolution:
javascript const DNS_TTL_MS = 30_000; const dnsCache = new Map(); function resolveHost(host) { const hit = dnsCache.get(host); if (hit && Date.now() - hit.at < DNS_TTL_MS) return hit.addresses; const addresses = lookup(host, { all: true, verbatim: true }).then((list) => list.map((a) => a.address)); const entry = { at: Date.now(), addresses }; dnsCache.set(host, entry); if (dnsCache.size > 1000) dnsCache.delete(dnsCache.keys().next().value); addresses.catch(() => { if (dnsCache.get(host) === entry) dnsCache.delete(host); }); return addresses; }The URL validator permits requests when DNS resolution fails:
javascript export async function checkRemoteUrl(raw, net) { let u; try { u = new URL(raw); } catch { return "not a valid URL"; } if (u.protocol !== "http:" && u.protocol !== "https:") return `${u.protocol} URLs are not allowed`; if (net.allowPrivate) return null; const hostname = u.hostname.toLowerCase().replace(/\.$/, ""); const port = u.port || (u.protocol === "https:" ? "443" : "80"); if (net.allowHosts.includes(hostname) || net.allowHosts.includes(`${hostname}:${port}`)) return null; if (hostname === "localhost" || hostname.endsWith(".localhost")) return `${hostname} is a loopback host`; const bare = hostname.replace(/^\[|\]$/g, ""); if (isIP(bare.split("%")[0])) return isBlockedAddress(bare) ? `${bare} is a local or private address` : null; let addresses; try { addresses = await resolveHost(bare); } catch { return null; // unresolvable ...[truncated 3926 chars]
