T09 · Insecure Skill Coding Practices
- Location
scripts/painter.py:12- Finding
Hardcoded Bearer Credential for Local Image API
- Content
View full analysis
Vulnerability Details
File Location:
scripts/painter.py, lines 12–13 and 20–23
Vulnerability Type: Hardcoded credential
Risk Level: MediumVulnerable 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
OpenClawand sends it in theAuthorizationheader 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
- An attacker obtains read access to the Skill package or its source code.
- The attacker reads
scripts/painter.pyand extracts the bearer tokenOpenClaw. - From the same host, the attacker connects to
127.0.0.1:8317. - The attacker submits requests with
Authorization: Bearer OpenClaw. - 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
View remediation
Remediation Suggestions
- Remove the bearer credential from source code and version control.
- Load the credential from a protected environment variable or operating-system secret store.
- Fail closed with a clear configuration error when a required credential is absent.
- Issue a unique, revocable token scoped only to image generation and apply rate limits where supported.
- Restrict access to the secret and the local API to the specific account or process that runs the Skill.
- Rotate or revoke the embedded
OpenClawcredential because it must be treated as disclosed. - If the loopback service intentionally requires no authentication, remove the ineffective bearer-token mechanism rather than distributing a shared token.
- Prefer authenticated local IPC or enforce a strict loopback binding and service-level authorization to reduce unauthorized local use.
