T09 · Insecure Skill Coding Practices
- Location
scripts/enrich-leads.js:28- Finding
Unvalidated Domains Enable Server-Side Request Forgery
- Content
View full analysis
0) return emails[0]; } } catch (e) { /* skip */ } } return null; } ``` The domain is derived from CLI or CSV input without network-target validation: ```javascript const cleanDomain = domain.replace(/^https?:\/\//, '').replace(/^www\./, '').replace(/\/.*/, ''); const email = await findEmail(cleanDomain); ``` ### Technical Analysis The `domain` value used to construct outbound HTTPS URLs is controlled by the user through either the `--domain` argument or fields in an input CSV. The sanitization removes URL schemes, a leading `www.`, and paths, but it does not establish that the value is a legitimate public Internet hostname. There are no controls to reject: - Loopback hosts such as `localhost` or `127.0.0.1` - Private IPv4 ranges - IPv6 loopback, unique-local, or link-local addresses - Link-local metadata endpoints - Internal DNS names - Hostnames that resolve or re-resolve to private addresses - Explicit attacker-selected ports The request body is not returned in full, which limits direct disclosure. However, `extractEmails()` processes the response, and an email-like string found in an internal response can be printed or written to the enrichment output. The requests can also reveal service av ...[truncated 1457 chars]- Remediation
View remediation
strict syntax validation -> DNS resolution -> reject all non-public addresses -> connect only to the validated destination -> enforce timeout and response-size limits ``` ]]>
