T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/painter.py:12
- Finding
- Hardcoded Bearer Credential for Local Image API## Vulnerability Details **File Location**: `scripts/painter.py`, lines 12–13 and 20–23 **Vulnerability Type**: Hardcoded credential **Risk Level**: Medium ### Vulnerable Code ```python BASE_URL = "http://127.0.0.1:8317/v1" API_KEY = "OpenClaw" ``` ```python headers = { "Content-Type": "application/json", "Authorization": f"Bearer {API_KEY}" } ``` ### Technical Analysis The source code embeds the static bearer credential `OpenClaw` and sends it in the `Authorization` header when accessing the local image-generation API. Any user or process capable of reading the distributed Skill can recover and reuse this credential. The loopback destination limits exposure to the local host, and the audited code does not transmit the credential to an external server. Nevertheless, a hardcoded shared token provides no meaningful secrecy, rotation, revocation, or per-user isolation. Its effective scope depends on the permissions granted by the service listening on TCP port 8317. ### Attack Path 1. An attacker obtains read access to the Skill package or its source code. 2. The attacker reads `scripts/painter.py` and extracts the bearer token `OpenClaw`. 3. From the same host, the attacker connects to `127.0.0.1:8317`. 4. The attacker submits requests with `Authorization: Bearer OpenClaw`. 5. If the local service accepts the token, the attacker invokes any API operations authorized for that credential. This path requires local access to the API because the configured endpoint is bound to the loopback address. Whether the service is independently exposed through another interface is outside the reviewed project. ### Impact Assessment A local attacker may submit unauthorized image-generation requests, consume model or computational resources, and invoke other operations exposed by the local API if the shared credential authorizes them. The reviewed code does not establish system-level privilege escalation, external credential exfiltration, or remote code executio ...[truncated 289 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the bearer credential from source code and version control. 2. Load the credential from a protected environment variable or operating-system secret store. 3. Fail closed with a clear configuration error when a required credential is absent. 4. Issue a unique, revocable token scoped only to image generation and apply rate limits where supported. 5. Restrict access to the secret and the local API to the specific account or process that runs the Skill. 6. Rotate or revoke the embedded `OpenClaw` credential because it must be treated as disclosed. 7. If the loopback service intentionally requires no authentication, remove the ineffective bearer-token mechanism rather than distributing a shared token. 8. Prefer authenticated local IPC or enforce a strict loopback binding and service-level authorization to reduce unauthorized local use.
