T09 · Insecure Skill Coding Practices
- Location
scripts/agent-ping.sh:24- Finding
Unvalidated Remote Hub URL Enables Server-Side Request Forgery
- Content
View full analysis
/dev/null || true) if echo "$WK" | jq -e '.protocol' >/dev/null 2>&1; then HUB_NAME=$(echo "$WK" | jq -r '.hub.name // "Unknown"') HUB_URL=$(echo "$WK" | jq -r '.hub.url // "?"') REG=$(echo "$WK" | jq -r '.hub.register // "?"') echo " ✅ Hub: $HUB_NAME ($HUB_URL)" ``` ```bash if [ -n "$HUB_URL" ] && [ "$HUB_URL" != "?" ]; then PING_URL="${HUB_URL%/}/ping" PONG=$(curl -s --max-time 5 -X POST "$PING_URL" -H "Content-Type: application/json" -d '{"source":"agent-ping-scanner"}' 2>/dev/null || true) if echo "$PONG" | jq -e '.pong // .status' >/dev/null 2>&1; then echo " ✅ PONG received" FOUND=$((FOUND+1)) else echo " ❌ No PONG" ``` ### Technical Analysis The script retrieves `/.well-known/agent-protocol.json` from the user-selected domain and extracts `.hub.url` without validating its scheme, hostname, port, resolved IP address, or relationship to the original scanned domain. It then appends `/ping` and automatically sends an HTTP POST request to that location. Because the discovery document is controlled by the scanned website, an attacker can supply URLs targeting loopback, private, link-local, or otherwise locally reachable services. Quoting prevents shell command injection, but it does not prevent network-level request forgery. The fixed JSON request body limits arbitrary payload construction, and the script does not directly expose response contents beyond checking them with `jq`. Nevertheless, it can make requests from the victim's network context to services unavailable to the attacker. ### Attack Path 1. An attacker operates a domain that the victim is induced to scan. 2. The attacker serves a v ...[truncated 1031 chars]- Remediation
View remediation
