T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/setup_server.sh:40
- Finding
- Unauthenticated HTTP File Exposure on All Network Interfaces<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup_server.sh`, line 40 **Vulnerability Type**: Unauthenticated network exposure and unrestricted directory serving **Risk Level**: High ### Vulnerable Code ```bash cd "$dir" && nohup python3 -m http.server $port --bind 0.0.0.0 > /dev/null 2>&1 & ``` ### Technical Analysis The script starts Python's general-purpose directory server and binds it to `0.0.0.0`, making it reachable through every network interface. The server provides neither authentication nor transport encryption and normally permits directory listing. The declared functionality includes local video streaming, but binding to every interface is broader than necessary for local access. The directories being served may contain videos, subtitle files, source URL records, proofreading prompts, correction reports, and any future files created in those directories. The script does not configure firewall restrictions, an IP allowlist, an authentication layer, or a restricted set of files that may be downloaded. ### Attack Path 1. An operator runs `bash scripts/setup_server.sh start`. 2. The script starts HTTP servers on ports 8093 and 8095, bound to all interfaces. 3. An attacker with network access to the host connects to either exposed port. 4. The attacker requests the directory root or guesses documented filenames. 5. Python's HTTP server returns directory listings and readable files under the corresponding media directory. 6. The attacker downloads exposed videos, subtitles, proofreading artifacts, source URLs, or other files placed there. ### Impact Assessment An unauthenticated remote user can read all files accessible to the server process beneath the two served directories. The vulnerability does not directly grant command execution or filesystem write access, but it may disclose copyrighted media, generated AI prompts, subtitle content, operational metadata, and accidentally stored sensitive files. If the host is directly ...[truncated 134 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Bind to loopback by default: ```bash python3 -m http.server "$port" --bind 127.0.0.1 ``` 2. Require an explicit, documented option before allowing LAN or Internet exposure. 3. Place remote access behind a hardened web server or reverse proxy that provides: - Authentication - TLS - Request logging - Rate limiting - IP allowlisting 4. Serve media from a dedicated directory containing only explicitly published files. 5. Disable directory listing and use an allowlist for permitted filenames and content types. 6. Run the server as a dedicated, unprivileged user with read access limited to the publication directory. 7. Add firewall rules restricting ports 8093 and 8095 to trusted clients. ]]>
