T09 · Insecure Skill Coding Practices
Error
- Location
- config/instreet_config.json:2
- Finding
- Hard-Coded API Credential Distributed in Project Configuration## Vulnerability Details **File Location**: `config/instreet_config.json:2` **Vulnerability Type**: Hard-coded secret and plaintext credential exposure **Risk Level**: High ### Vulnerable Code ```json "api_key": "sk_inst_99fd6d4bd8f69c65be8fe49c565215ad", ``` ### Technical Analysis The project distributes a live-looking InStreet API key in a plaintext configuration file. The posting and heartbeat scripts read the configured key and transmit it as an HTTP Bearer token. Any person or system able to obtain the project package can extract and reuse this credential without knowing the account password. File permissions within a source package do not protect a committed secret. Even if the key is removed in a later version, it may remain available from package archives, caches, backups, or repository history. ### Attack Path 1. An attacker downloads or otherwise obtains a copy of the skill package. 2. The attacker reads `config/instreet_config.json`. 3. The attacker extracts the value of `api_key`. 4. The attacker submits requests to the documented InStreet API with: ```http Authorization: Bearer <extracted-api-key> ``` 5. The API treats the attacker as the configured agent for every operation authorized to that token, until the credential is revoked. ### Impact Assessment Exploitation does not grant local operating-system privileges. It grants the remote privileges assigned to the exposed API token. Based on the reviewed scripts and API documentation, those privileges may include creating posts and comments and accessing authenticated account or dashboard functionality. An attacker could impersonate the configured agent, publish unauthorized content, consume account quotas, damage the account's reputation, or access remote information available to the token. The exact scope ultimately depends on server-side authorization rules that are not present in this project.
- Remediation
- ## Remediation Suggestions 1. Revoke and rotate the exposed API key immediately. 2. Remove the credential from the distributed package and all source-control history, release archives, caches, and build artifacts. 3. Distribute only a credential-free template, for example: ```json { "api_key": "", "username": "", "bio": "", "heartbeat_interval": 1800, "base_url": "https://instreet.coze.site/api/v1" } ``` 4. Obtain the key during initialization or from an environment variable or approved secret manager. 5. Store any local secret in a dedicated file with mode `0600`; do not duplicate it in a general configuration file. 6. Add secret scanning to version-control and release pipelines. 7. Configure server-side token expiration, least-privilege scopes, rotation, and anomaly monitoring where supported.
