T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/media_to_obsidian.py:48
- Finding
- Configurable MiniMax endpoint can receive confidential images and API credentials<![CDATA[ ## Vulnerability Details **File Location**: `scripts/media_to_obsidian.py:48-64` **Related Documentation**: `SKILL.md:24-26` **Vulnerability Type**: Unrestricted transmission of sensitive data to a configurable network endpoint **Risk Level**: High ### Vulnerable Code ```python def understand_minimax(image_data, media_type, prompt): """MiniMax VLM""" API_KEY = os.environ.get("MINIMAX_API_KEY", "") API_HOST = os.environ.get("MINIMAX_API_HOST", "https://api.minimaxi.com") if not API_KEY: return "[错误] 请设置 MINIMAX_API_KEY" image_url = f"data:{media_type};base64,{image_data}" payload = {"prompt": prompt, "image_url": image_url} cmd = [ "curl", "-s", "--max-time", "30", f"{API_HOST}/v1/coding_plan/vlm", "-H", f"Authorization: Bearer {API_KEY}", "-H", "Content-Type: application/json", "-d", json.dumps(payload) ] ``` The documentation explicitly encourages users to configure the host: ```bash export MINIMAX_API_KEY="your-key" export MINIMAX_API_HOST="https://api.minimaxi.com" ``` ### Technical Analysis The script Base64-encodes complete extracted images and submits them to the URL derived from `MINIMAX_API_HOST`. Base64 is transport encoding and provides no confidentiality. Although sending images to a multimodal provider is necessary for the declared functionality, allowing the destination host to be changed without validation exceeds the minimum network privilege needed to communicate with the official provider. The code does not: - Require the HTTPS scheme. - Restrict the hostname to an approved MiniMax domain. - Reject URLs containing embedded credentials or unexpected path components. - Warn the user when a non-default destination is selected. - Establish an explicit policy for redirects. Consequently, control over the process environment is sufficient to redirect both document contents and the MiniMax bearer credential to an arbitrary endpoint. ### ...[truncated 1212 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove arbitrary host configurability if only the official MiniMax service is supported. 2. If custom hosts are required, parse the value with a URL parser and enforce: - HTTPS only. - An explicit allowlist of exact hostnames. - No embedded username or password. - No unexpected ports unless specifically approved. - No cross-origin redirects. 3. Display the resolved destination before uploading data and require explicit user consent for any non-default provider. 4. Document that source images are uploaded to a third party and may contain sensitive information. 5. Add a local-only or redaction workflow for confidential documents. 6. Separate endpoint configuration from ambient environment variables where possible, using an explicit command-line option or trusted configuration file with restrictive permissions. ]]>
