T09 · Insecure Skill Coding Practices
- Location
scripts/minimax_media.py:18- Finding
Unrestricted API Endpoint Override Can Exfiltrate Credentials and User Content
- Content
View full analysis
Vulnerability Details
File Location:
scripts/minimax_media.py, lines 18-30 and 57-76
Vulnerability Type: Unrestricted sensitive-data transmission endpoint
Risk Level: HighVulnerable Code
python API_KEY = os.environ.get('MINIMAX_API_KEY', '') BASE_URL = os.environ.get('MINIMAX_BASE_URL', 'https://api.minimax.io').rstrip('/v1').rstrip('/') def generate_image(prompt: str, output_path: str = None) -> dict: """Use MiniMax image-01 to generate an image.""" url = f"{BASE_URL}/v1/image_generation" headers = { 'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json' } payload = { 'model': 'image-01', 'prompt': prompt } resp = requests.post(url, headers=headers, json=payload, timeout=60)python def text_to_speech(text: str, voice_id: str = 'female-tianmei', speed: float = 1.0, output_path: str = None) -> dict: """Use MiniMax speech-2.8-hd to generate speech.""" url = f"{BASE_URL}/v1/t2a_v2" headers = { 'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json' } payload = { 'model': 'speech-2.8-hd', 'text': text, 'stream': False, 'output_format': 'hex', 'voice_setting': { 'voice_id': voice_id, 'speed': speed, 'vol': 1, 'pitch': 0 }, 'language_boost': 'auto' } resp = requests.post(url, headers=headers, json=payload, timeout=60)Technical Analysis
Sending the API credential and user-supplied prompts or TTS text over the network is necessary for the declared MiniMax functionality. However,
MINIMAX_BASE_URLaccepts an arbitrary value without validating its scheme or hostname. Both API operations then attach the MiniMax bearer credential and send user content to that endpoint.This exceeds the minimum pr ...[truncated 1416 chars]
- Remediation
View remediation
Remediation Suggestions
- Require HTTPS and validate the parsed URL before transmitting any credential.
- Restrict credential-bearing requests to an explicit hostname allowlist, such as
api.minimax.io. - Reject URLs containing embedded credentials, fragments, unexpected ports, or unsupported schemes.
- If custom endpoints are a legitimate requirement, require explicit opt-in and use separate endpoint-specific credentials rather than automatically forwarding
MINIMAX_API_KEY. - Disable automatic redirects for authenticated API requests, or validate the destination of every redirect before following it.
- Fail before making a request when
MINIMAX_API_KEYis empty. - Replace the trailing-character operation with proper URL parsing and path normalization.
- Document that prompts and TTS text are transmitted to MiniMax and should not contain secrets unless users accept that disclosure.
