T09 · Insecure Skill Coding Practices
- Location
main.py:75- Finding
Undocumented API endpoint override can redirect sensitive vault traffic
- Content
View full analysis
ColonyMemory: api_key = os.environ.get("COLONY_MEMORY_API_KEY") or os.environ.get("COLONY_API_KEY") if not api_key: raise RuntimeError("COLONY_API_KEY (or COLONY_MEMORY_API_KEY) is not set") kwargs: dict[str, Any] = {"api_key": api_key} base = os.environ.get("COLONY_MEMORY_API_BASE") or os.environ.get("COLONY_API_BASE") if base: kwargs["base_url"] = base ``` ### Technical Analysis The code allows `COLONY_MEMORY_API_BASE` or `COLONY_API_BASE` to replace the expected Colony service endpoint without validating the URL scheme or destination hostname. These variables are not declared in the skill manifest's environment-variable permissions, which only list the API keys and signing seed. The same `ColonyMemory` client configuration contains both the caller's API key and the supplied base URL. Depending on the SDK's HTTP authentication behavior, requests directed to an attacker-controlled endpoint may disclose authorization credentials. Backup requests can also expose sensitive memory documents directly in their request bodies. An attacker-controlled service could return fabricated snapshot data during restore operations. Exploitation requires the attacker to influence the process or deployment environment. This is particularly relevant where environment variables can be configured by an orchestrator, wrapper, shared runtime, or untrusted deployment template. ### Attack Path 1. The attacker obtains the ability to influence environment variables used to launch the skill. 2. The attacker sets `COLONY_MEMORY_API_BASE` or `COLONY_API_BASE` to an attacker-controlled URL. 3. A legitimate caller invokes `backup`, `restore`, or another network-backed operation. 4. `_build_memory()` constructs the SDK client with the legitim ...[truncated 791 chars]- Remediation
View remediation
