T09 · Insecure Skill Coding Practices
- Location
references/nginx-snippet.conf:5- Finding
Unauthenticated Exposure of Watchdog Operational Information
- Content
View full analysis
Vulnerability Details
File Location:
references/nginx-snippet.conf, lines 5-18
Vulnerability Type: Unauthenticated operational information disclosure
Risk Level: LowVulnerable Code
nginx location /watchdog/state.json { alias /opt/openclaw-watchdog/watchdog-state.json; default_type application/json; add_header Access-Control-Allow-Origin *; add_header Cache-Control "no-cache, no-store"; } # Watchdog alert — returns JSON only when status is critical; 404 otherwise # Useful for monitoring: if this endpoint returns data, something is wrong location /watchdog/alert.json { alias /opt/openclaw-watchdog/watchdog-alert.json; default_type application/json; add_header Access-Control-Allow-Origin *; add_header Cache-Control "no-cache, no-store"; }Related file-permission and data-generation behavior appears in
scripts/watchdog.py, lines 100-119:python alert = { "severity": severity, "subject": subject, "message": message, "timestamp": datetime.now(timezone.utc).isoformat(), "gateway_url": cfg["HEALTH_URL"], } alert_path = Path(cfg["ALERT_FILE"]) alert_path.parent.mkdir(parents=True, exist_ok=True) with open(str(alert_path), "w") as f: json.dump(alert, f, indent=2) os.chmod(str(alert_path), 0o644)Technical Analysis
The recommended nginx locations expose the watchdog state and alert files without authentication, client-network restrictions, or authorization checks. They also return
Access-Control-Allow-Origin: *, permitting browser applications from any origin to read the responses when the endpoints are network-accessible.The published data can include gateway health status, consecutive failure and restart counts, timestamps, alert messages, and the configured health endpoint URL. The generated JSON files are also assigned mode
0644, making them readable by every local user. Although remot ...[truncated 1498 chars]- Remediation
View remediation
Remediation Suggestions
- Restrict the status endpoints to trusted monitoring systems using nginx
allowanddenydirectives, a private VPN, or firewall rules. - Require authentication, mutual TLS, or a reverse-proxy authorization layer when the endpoints must be reachable over a broader network.
- Remove
Access-Control-Allow-Origin *unless cross-origin browser access is explicitly required. If required, allow only specific trusted origins. - Publish only the minimum telemetry needed by the monitor. Avoid exposing internal URLs and detailed recovery information where possible.
- Store the files with mode
0640and use a dedicated group shared by the watchdog and web server rather than making them world-readable. - Ensure parent directories are not unnecessarily accessible to unrelated local users.
- Serve the endpoints exclusively over HTTPS when they leave the local host or a trusted private network.
- Restrict the status endpoints to trusted monitoring systems using nginx
