T09 · Insecure Skill Coding Practices
Error
- Location
- emby.py:5
- Finding
- Hard-Coded Emby API Credential in Source Code and Documentation<![CDATA[ ## Vulnerability Details **File Location**: `emby.py:5-6` **Vulnerability Type**: Hard-coded secret **Risk Level**: High ### Complete Code Snippet ```python BASE_URL = "https://emby.example.com/emby" API_KEY = "652436b1ffa84d9a85f579eeb34b87aa" ``` The same credential-shaped value is also shown in `SKILL.md:11-15`: ```python BASE_URL = "https://emby.example.com/emby" # Modify to your Emby server address API_KEY = "652436b1ffa84d9a85f579eeb34b87aa" # Modify to your API key ``` ### Technical Analysis The Emby API key is stored directly in application source and repeated in the documentation. If this is an active credential, anyone who can read the package, repository history, distribution archive, build output, or logs containing the source can recover it. Even if the current value is intended only as an example, this configuration pattern encourages users to replace it with a production credential in a tracked source file. Such replacement credentials can subsequently be committed or distributed accidentally. The key is used globally by an API client exposing a broad server-management surface. Depending on server-side permissions, it may authorize operations involving media, users, devices, server configuration, backups, and server environment information. ### Attack Path 1. A user commits, publishes, distributes, or otherwise exposes the Skill package containing a valid API key. 2. An attacker obtains the package or repository and extracts `API_KEY` from `emby.py`, documentation, or version history. 3. The attacker identifies the associated Emby endpoint from configuration, deployment records, or infrastructure discovery. 4. The attacker submits requests to Emby API endpoints using the extracted key. 5. Emby processes the requests with all privileges assigned to that key. ### Impact Assessment If the hard-coded value is valid and the corresponding Emby server is reachable, an attacker may obtain the privileges assigned to the key. Th ...[truncated 651 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Revoke and rotate the committed API key if it has ever been active. 2. Remove the key from the current source tree and repository history. 3. Load credentials from an environment variable or protected secret manager: ```python import os BASE_URL = os.environ["EMBY_BASE_URL"] API_KEY = os.environ["EMBY_API_KEY"] ``` 4. Fail closed when the key is missing rather than supplying a built-in default. 5. Replace documentation values with unmistakable placeholders such as `YOUR_EMBY_API_KEY`. 6. Add secret-scanning checks to pre-commit hooks and CI pipelines. 7. Use a dedicated Emby credential with only the permissions required by the deployment. 8. Separate read-only operations from administrative or destructive operations by using distinct credentials where Emby supports that model. ]]>
