T09 · Insecure Skill Coding Practices
- Location
scripts/lib.py:129- Finding
Bearer Token Disclosure Through an Unrestricted API Base URL
- Content
View full analysis
httpx.Client: return httpx.Client( timeout=config.timeout, headers={ "Authorization": f"Bearer {config.token}", "Accept": "application/json", "User-Agent": "mineru-ocr-local-api-skill/1.1.0", }, ) ``` ### Technical Analysis `MINERU_API_BASE_URL` accepts an arbitrary scheme and host. HTTPS is added only when the supplied value has no scheme; an explicitly supplied `http://` URL remains permitted. The HTTP client attaches `MINERU_API_TOKEN` as a bearer token to every API request made through that client. Consequently, an attacker who can influence the environment or runtime configuration can redirect authenticated API requests to an attacker-controlled server. If HTTP is selected, the token can also be exposed in plaintext to parties capable of observing or modifying network traffic. Custom API endpoints are a documented feature, but the implementation does not enforce transport security, verify that the destination is trusted, or warn that the production credential will be sent to the configured host. ### Attack Path 1. An attacker influences `MINERU_API_BASE_URL`, such as through a poisoned environment, deployment configuration, or wrapper script. 2. The value is set to `https://attacker.example` or `http://attacker.example`. 3. A user or agent runs the skill in API mode with `MINERU_API_TOKEN` configured. 4. `_make_client()` installs the token in the default `Authorization` header. 5. The skill submits a request to the attacker-control ...[truncated 736 chars]- Remediation
View remediation
