T09 · Insecure Skill Coding Practices
- Location
validate-links.sh:91- Finding
Server-Side Request Forgery Through External Link Validation
- Content
View full analysis
\s"]+' ./*.md 2>/dev/null | sort -u) URL_COUNT=$(echo "$URLS" | grep -c "http" || echo 0) echo "Found $URL_COUNT unique external URLs" if $CHECK_EXTERNAL; then echo "Checking external URLs (this may take a moment)..." echo "" for url in $URLS; do # Clean URL (remove trailing punctuation) url=$(echo "$url" | sed 's/[.,;:!?]$//') # Skip obviously dynamic URLs if [[ "$url" == *"example.com"* ]] || [[ "$url" == *"localhost"* ]]; then echo -e "${YELLOW}⊘${NC} Skipped (example): $url" continue fi # Check URL with timeout HTTP_CODE=$(curl -o /dev/null -s -w "%{http_code}" --max-time 10 -L "$url" 2>/dev/null || echo "000") ``` ### Technical Analysis When external validation is enabled, the script extracts HTTP and HTTPS URLs directly from project Markdown and passes them to `curl`. The only destination filtering excludes strings containing `example.com` or `localhost`. The implementation does not reject: - IPv4 or IPv6 loopback addresses - Private network ranges - Link-local addresses - Cloud instance metadata services - Internal DNS names - Reserved or otherwise non-public address ranges - Public URLs that redirect to an internal destination The `-L` option follows redirects, but redirect destinations are not revalidated. Consequently, validating an untrusted project gives that project control over outbound requests made from the auditor's machine or CI runner. ### Attack Path 1. An attacker places a crafted HTTP or HTTPS link in a top-level Markdown file. 2. The link points directly to an internal service, cloud metadata endpoint, or attacker-controlled red ...[truncated 936 chars]- Remediation
View remediation
