T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/debug-notify.sh:38
- Finding
- Unauthenticated Webhook Listener Logs Sensitive Requests and Can Be Publicly Exposed<![CDATA[ ## Vulnerability Details **File Location**: `scripts/debug-notify.sh`, lines 38-120 **Vulnerability Type**: Unauthenticated network listener and plaintext sensitive-data logging **Risk Level**: High ### Vulnerable Code ```bash LOG_FILE="$HOME/.openclaw/workspace/alipayplus-notify.log" case $choice in 1) echo "" echo "=== Start Local Webhook Server ===" echo "" read -p "Enter listening port (default 8080): " port port=${port:-8080} echo "Listening on port $port ..." echo "Log file: $LOG_FILE" echo "" echo "Press Ctrl+C to stop listening" echo "" # Start a simple HTTP server to receive webhooks while true; do timestamp=$(date '+%Y-%m-%d %H:%M:%S') echo "[$timestamp] Waiting for requests..." >> "$LOG_FILE" # Use nc to receive requests request=$(nc -l -p "$port" -q 1 2>/dev/null || true) if [ -n "$request" ]; then timestamp=$(date '+%Y-%m-%d %H:%M:%S') echo "[$timestamp] Received request:" >> "$LOG_FILE" echo "$request" >> "$LOG_FILE" echo "-------------------" >> "$LOG_FILE" echo "✅ Notification received and logged to: $LOG_FILE" echo "" echo "Request content:" echo "$request" fi done ;; 2) # ... read -p "Enter local service port (default 8080): " port port=${port:-8080} echo "" echo "Starting ngrok, exposing port $port to the public network..." echo "" # Start ngrok ngrok http "$port" --log="$HOME/.openclaw/workspace/ngrok.log" & ``` ### Technical Analysis The debugging listener uses `nc` without restricting the listening interface, authenticating clients, validating Alipay+ signatures, limiting request size, or applying rate limits. Every received request is written verbatim to a predictable plaintext log file. Webhook requests can contain transaction identifiers, customer or merchant information, authorization-related headers, signatures, and payme ...[truncated 1702 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bind the debugging listener to `127.0.0.1` by default rather than all network interfaces. 2. Require explicit, informed user confirmation before exposing any port through ngrok. 3. Verify the Alipay+ request signature, client identifier, timestamp, and replay window before accepting or logging a webhook. 4. Replace the raw netcat listener with an HTTP server that enforces request-body limits, timeouts, rate limits, and valid HTTP parsing. 5. Redact signatures, tokens, customer identifiers, payment codes, and other sensitive fields before logging. 6. Create the log with restrictive permissions: ```bash umask 077 install -m 600 /dev/null "$LOG_FILE" ``` 7. Add log rotation, retention limits, and maximum file-size controls. 8. Use synthetic test payloads for debugging rather than real production notifications. 9. Keep tunnel URLs short-lived and restrict access with ngrok authentication or an equivalent access policy. ]]>
