subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def start_server(port=HTTP_PORT): """Start HTTP server for DLNA push.""" subprocess.run(["fuser", "-k", f"{port}/tcp"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) time.sleep(0.5) httpd = ReuseAddrTCPServer(("0.0.0.0", port), DLNAHandler) t = threading.Thread(target=httpd.serve_forever, daemon=False)- Confidence
- 94% confidence
- Finding
- The code unconditionally runs `fuser -k` on the configured port before starting its HTTP server, which will terminate whatever process currently owns that port. This creates a local denial-of-service condition and can disrupt unrelated services if the port is in use by another application.
