T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/app.py:107
- Finding
- Unauthenticated Paid Generation Service Exposed on All Network Interfaces## Vulnerability Details **File Location**: `scripts/app.py:107-108` **Vulnerability Type**: Unauthenticated network exposure and unrestricted resource consumption **Risk Level**: High **Vulnerable Code**: ```python if __name__ == "__main__": app = build_ui() app.launch(server_name="0.0.0.0", server_port=7860) ``` ## Technical Analysis The Gradio application listens on `0.0.0.0`, making it accessible through every available network interface. No authentication, authorization, rate limiting, request quota, or application-level concurrency restriction is configured. This exposure is especially significant because the application operates using the server's Google Cloud credentials and provides actions that invoke paid Vertex AI models. A single request can initiate script generation, image generation, and nine concurrent video-generation operations. The public binding also conflicts with the documentation in `SKILL.md`, which describes the interface as being available at `http://localhost:7860`. Reference media is also loaded entirely into memory before submission to Vertex AI. For example: ```python with open(reference_video_path, "rb") as f: video_bytes = f.read() ``` Consequently, unrestricted uploads can consume server memory in addition to paid cloud-model quota. ### Attack Path 1. The operator starts the application on a host reachable by other systems. 2. Gradio binds to all interfaces on TCP port 7860. 3. An unauthenticated attacker discovers or directly accesses that port. 4. The attacker submits topics, images, or reference videos through the exposed interface. 5. Each accepted request invokes `generate_video_pipeline()`. 6. The pipeline uses the server's service-account identity to call paid Vertex AI models and starts up to nine concurrent Veo operations. 7. The attacker repeats requests or uploads large media files, consuming cloud quota, processing capacity, memory, storage, an ...[truncated 926 chars]
- Remediation
- ## Remediation Suggestions 1. Bind to the loopback interface by default: ```python app.launch(server_name="127.0.0.1", server_port=7860) ``` 2. If remote access is required, place the application behind an authenticated HTTPS reverse proxy or enable a supported Gradio authentication mechanism. 3. Enforce authorization so only approved users can invoke cloud-generation operations. 4. Add per-user and global rate limits, request quotas, and cost controls. 5. Restrict the number of queued and concurrent jobs instead of allowing unbounded requests to each create nine generation tasks. 6. Configure maximum upload sizes and validate media duration, dimensions, MIME type, and decoded format before reading files into memory. 7. Stream or stage large uploads rather than loading complete videos into process memory. 8. Apply Google Cloud budget alerts, quota limits, and a least-privilege service account dedicated to this application. 9. Restrict inbound network access to port 7860 using host and cloud firewalls. 10. Avoid returning detailed internal exception messages to remote users; record details in protected server logs and return sanitized errors.
