T09 · Insecure Skill Coding Practices
- Location
audit.sh:48- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
/dev/null || echo "000") ``` Additional requests are derived from the user-controlled target host: ```bash ROBOTS_STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$ROBOTS_URL" 2>/dev/null || echo "000") ROBOTS_CONTENT=$(curl -s --max-time 10 "$ROBOTS_URL" 2>/dev/null || echo "") ``` ```bash SITEMAP_STATUS_CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$SITEMAP_URL" 2>/dev/null || echo "000") SITEMAP_CONTENT=$(curl -s --max-time 15 "$SITEMAP_URL" 2>/dev/null || echo "") ``` ```bash SITEMAP_ALTS=( "${BASE_URL}/sitemap-index.xml" "${BASE_URL}/sitemap_index.xml" "${BASE_URL}/sitemap/index.xml" ) FOUND_SITEMAP="" for ALT in "${SITEMAP_ALTS[@]}"; do if [[ $(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$ALT" 2>/dev/null || echo "000") == "200" ]]; then FOUND_SITEMAP="$ALT" break fi done ``` ### Technical Analysis The script accepts an arbitrary URL and validates only whether it begins with `http://` or `https://`. It does not parse and validate the destination host, resolve the host before making the request, or reject loopback, private, link-local, reserved, multicast, and cloud metadata addresses. The initial request also uses `curl -L`, which follows redirects. Consequently, even if a public destination were validated, that destination could redirect the request to an internal address unless every redirect target were independen ...[truncated 1983 chars]- Remediation
View remediation
