T09 · Insecure Skill Coding Practices
- Location
gomoku_bot.py:25- Finding
Published Shared API Credential Enables Unauthorized InStreet API Use
- Content
View full analysis
Vulnerability Details
File Location:
gomoku_bot.py:25,instreet_gomoku.py:11, andSKILL.md:103
Vulnerability Type: Hardcoded authentication credential
Risk Level: HighVulnerable Code
gomoku_bot.py:25:python API_KEY = os.environ.get('INSTREET_API_KEY', 'sk_inst_adfe55c5fe69ca780201cb466bebbbce')Representative transmission in
gomoku_bot.py:38-43:python def get_activity(): """获取当前活动状态""" url = f'{BASE_URL}/activity' req = urllib.request.Request(url, headers={'Authorization': f'Bearer {API_KEY}'}) try: response = urllib.request.urlopen(req, timeout=10)instreet_gomoku.py:11-12:python API_KEY = 'sk_inst_adfe55c5fe69ca780201cb466bebbbce' BASE_URL = 'https://instreet.coze.site/api/v1/games'Representative transmission in
instreet_gomoku.py:855-861:python def get_activity(): """获取当前活动""" url = f'{BASE_URL}/activity' req = urllib.request.Request(url, headers={'Authorization': f'Bearer {API_KEY}'}) try: response = urllib.request.urlopen(req, timeout=10) data = json.loads(response.read().decode('utf-8'))SKILL.md:103also publishes the credential:markdown 4. **API Key**:已配置在代码中 `sk_inst_adfe55c5fe69ca780201cb466bebbbce`Technical Analysis
A live-looking bearer credential is embedded in two executable source files and explicitly disclosed in the published Skill documentation. Although
gomoku_bot.pyallows the environment to override it, the hardcoded token remains the default and is automatically placed in theAuthorizationheader of outbound HTTPS requests.The network destination is the declared InStreet game API, and transmitting an authorization token to that API is necessary for authenticated gameplay. Therefore, the transmission itself does not appear to be covert exfiltration. The vulnerability is that all Skill recipients receive and can reus ...[truncated 1729 chars]
- Remediation
View remediation
Remediation Suggestions
- Immediately revoke and rotate the published credential.
- Remove the credential from all source files, documentation, package metadata, repository history, and published artifacts.
- Require callers to provide
INSTREET_API_KEY; do not retain a default:python API_KEY = os.environ.get("INSTREET_API_KEY") if not API_KEY: raise RuntimeError("INSTREET_API_KEY must be configured") - Issue separate credentials for individual users rather than distributing a shared account token.
- Restrict each credential to the minimum API scopes required to list, create, join, and play Gomoku games.
- Add server-side expiration, rotation, rate limiting, and anomalous-use monitoring.
- Add automated secret scanning to source-control and publication workflows.
- Avoid logging authorization headers or returning credentials in error messages.
