T09 · Insecure Skill Coding Practices
- Location
scripts/gen_digital_human.py:99- Finding
Arbitrary AEP Endpoint Can Receive Authentication Credentials and Sensitive Media
- Content
View full analysis
Vulnerability Details
File Location:
scripts/gen_digital_human.py, lines 99-106, 188-200, 293-306, and 510-530
Vulnerability Type: Unrestricted authenticated upload destination
Risk Level: HighVulnerable Code
python p.add_argument("--user-id", default=os.getenv("AEP_USER_ID", "aim_user")) p.add_argument("--test", action="store_true", default=True, help="使用测试环境(服务端FFS)") p.add_argument("--prod", action="store_true", help="使用正式环境") # aim-secret-key —— 展示/存储用这个规范名;读取时宽容接受常见变体 aep_group = p.add_argument_group("aim-secret-key 配置") aep_group.add_argument("--aep-base-url", default=os.getenv("AEP_BASE_URL", DEFAULT_AEP_BASE_URL)) aep_group.add_argument("--aim-secret-key", default=resolve_secret_value())python tts_url = f"{args.aep_base_url.rstrip('/')}/{args.tts_service_id}{DEFAULT_TTS_AEP_ROUTE_URI}" headers = { "X-AEP-CONSUMER-SECRET": args.aim_secret_key, "X-AEP-SERVICE-ID": args.tts_service_id, "X-AEP-REQUEST-ID": str(uuid.uuid4()), } print(f"[TTS] 走 AEP: {tts_url}") resp = requests.post(tts_url, json=request_data, headers=headers, timeout=120, proxies={"http": None, "https": None})python request_id = str(uuid.uuid4()) target_url = f"{args.aep_base_url.rstrip('/')}/{DEFAULT_AEP_SERVICE_ID}{DEFAULT_AEP_ROUTE_URI}" headers = { "X-AEP-CONSUMER-SECRET": secret, "X-AEP-REQUEST-ID": request_id, } print(f"[AEP] 提交到: {target_url}") print(f"[AEP] request_id: {request_id}") resp = requests.post(target_url, json=payload, headers=headers, timeout=30, proxies={"http": None, "https": None})python image_b64 = file_to_base64(args.image_path) audio_b64 = file_to_base64(audio_path) upstream_uuid = f"dh_{uuid.uuid4().hex[:12]}" payload: dict = { "uuid": upstream_uuid, "userId": args.user_id, "imageBase64": image_b64, "audioBase64": audio_b64, "prompt": a ...[truncated 2468 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the production
--aep-base-urloverride and avoid taking the authenticated endpoint from an ambient environment variable. - Enforce HTTPS and an exact allowlist of approved AEP hostnames.
- Parse the endpoint with a standard URL parser and reject embedded credentials, fragments, unexpected ports, IP literals, and malformed hostnames.
- Disable redirects for authenticated submission requests. If redirects are operationally required, validate every destination and never forward the secret across origins.
- If development endpoints are necessary, place them behind an explicit unsafe-development mode and require a separate non-production credential.
- Display a clear consent notice describing which image, audio, transcript, and voice-biometric data will be transmitted.
- Apply request-size limits before reading and Base64-encoding files to reduce memory and service-abuse risks.
- Rotate any credential that may have been sent to an untrusted endpoint and review associated service usage.
- Remove the production
