T09 · Insecure Skill Coding Practices
- Location
- scripts/monitor.sh:6
- Finding
- Hard-Coded NOFX API Credential Exposed in Source Code and Request URLs<![CDATA[ ## Vulnerability Details **File Location**: `scripts/monitor.sh:6-10`; `references/ai500-report.py:6-7, 14-21` **Vulnerability Type**: Hard-coded credential and sensitive query-string exposure **Risk Level**: High ### Vulnerable Code ```bash KEY="${NOFX_KEY:-cm_568c67eae410d912c54c}" BASE="${NOFX_BASE:-https://nofxos.ai}" KNOWN_FILE="${NOFX_KNOWN_FILE:-$HOME/.openclaw/workspace/nofx-ai500-known.json}" RESPONSE=$(curl -s "${BASE}/api/ai500/list?auth=${KEY}") ``` ```python BASE = "https://nofxos.ai" KEY = "cm_568c67eae410d912c54c" DURATIONS = ["5m", "15m", "30m", "1h", "4h", "8h", "24h"] def curl_json(url): try: r = subprocess.run(["curl", "-s", "-f", url], capture_output=True, text=True, timeout=15) if r.returncode != 0: return None return json.loads(r.stdout) except: return None def nofx(endpoint, params=""): url = f"{BASE}{endpoint}?auth={KEY}" if params: url += f"&{params}" return curl_json(url) ``` ### Technical Analysis A credential-shaped NOFX API key is embedded directly in two distributed project files. In the shell script, the embedded value is used whenever `NOFX_KEY` is absent, while the Python report generator always uses the hard-coded value. Anyone able to download or read the Skill package can recover the credential without executing the Skill. The credential is also transmitted as an `auth` query parameter. Query-string credentials can be exposed through: - Process listings containing the `curl` command line - HTTP client, reverse-proxy, and application access logs - Monitoring and observability systems - Shell debugging output - URL history or diagnostic records Although HTTPS protects the request in transit when certificate verification remains enabled, it does not prevent local process or server-side logging of the complete URL. ### Attack Path 1. An attacker obtains the publicly distributed Skill package or read access to the project directory. 2. Th ...[truncated 1045 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the embedded credential immediately. 2. Remove all default credential values from source code: ```bash : "${NOFX_KEY:?NOFX_KEY must be set}" KEY="$NOFX_KEY" ``` 3. Read credentials only from an approved secret manager, protected environment variable, or permission-restricted configuration file. 4. Do not place secrets in cron payload text, generated reports, logs, or error messages. 5. Prefer an HTTP authorization header if the NOFX API supports one: ```bash curl --fail --silent --show-error \ -H "Authorization: Bearer ${NOFX_KEY}" \ "${BASE}/api/ai500/list" ``` 6. If query-string authentication is mandated by the API, ensure process visibility and logs are restricted and redact the `auth` parameter in all telemetry. 7. Add automated secret scanning to CI and reject future credential-shaped literals. ]]>
