T09 · Insecure Skill Coding Practices
- Location
SKILL.md:210- Finding
Backend API Exposed Beyond the Required Proxy Boundary
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 193 and 210–212
Vulnerability Type: Excessive network exposure and insecure deployment configuration
Risk Level: MediumVulnerable Code
bash # Start FastAPI backend in the background cd /app python -m uvicorn api:app --host 0.0.0.0 --port 18000 & FASTAPI_PID=$!yaml version: '3.8' services: api: build: . command: python -m uvicorn api:app --host 0.0.0.0 --port 18000 ports: - "18000:18000"Similar all-interface bindings also appear in the example code at lines 51 and 72.
Technical Analysis
The documented architecture designates Flask as the public frontend and API proxy, with FastAPI acting as an internal backend. Binding FastAPI to
0.0.0.0makes it listen on every available network interface. The Docker Compose configuration additionally publishes port18000on the host.Publishing the backend contradicts the stated internal-proxy architecture and exceeds the minimum network privileges required for same-host or private-container communication. External clients may connect directly to FastAPI, bypassing any authentication, validation, rate limiting, logging, origin controls, or other policy enforced by Flask.
The guide does not demonstrate API authentication, TLS, firewall restrictions, trusted-host validation, or access controls that would compensate for this exposure. Although this is documentation rather than an active deployment, users following it may reproduce the insecure configuration.
Attack Path
- A user deploys the documented configuration on a host reachable by an untrusted network.
- The FastAPI process listens on all interfaces, and Docker or the host publishes TCP port
18000. - An attacker discovers the exposed port through network scanning or deployment metadata.
- The attacker sends requests directly to
http://HOST:18000/api/..., avoiding the Flask p ...[truncated 1048 chars]
- Remediation
View remediation
Remediation Suggestions
-
For same-host deployment, bind FastAPI only to loopback:
bash python -m uvicorn api:app --host 127.0.0.1 --port 18000 -
For Docker Compose, do not publish the API port on the host. Use the private Compose network:
yaml services: api: build: . command: python -m uvicorn api:app --host 0.0.0.0 --port 18000 expose: - "18000" web: build: . environment: - FASTAPI_URL=http://api:18000Listening on
0.0.0.0inside the API container is acceptable when the container port is not published and network policy restricts access to the frontend service. -
Enforce authentication and authorization within FastAPI itself rather than relying exclusively on the proxy.
-
Require TLS for traffic crossing an untrusted network.
-
Add firewall, security-group, or container-network rules that permit backend access only from the proxy.
-
Apply rate limiting, request-size limits, timeouts, and audit logging at both the proxy and backend layers.
-
Document that backend ports must not be publicly exposed unless direct API access is an explicit, secured requirement.
-
