T09 · Insecure Skill Coding Practices
- Location
scripts/mupibox_media_manager.py:22- Finding
Plaintext HTTP Transport for Media Database Operations
- Content
View full analysis
Vulnerability Details
File Location:
scripts/mupibox_media_manager.py, lines 22–46; documented inSKILL.md, lines 12 and 22
Vulnerability Type: Plaintext transmission of database contents and mutation requests
Risk Level: MediumVulnerable Code
python DEFAULT_BASE_URL = "http://mupibox:8200" DEFAULT_BACKUP_DIR = Path.home() / ".mupibox-db-backups" @dataclass class Client: base_url: str def _get(self, path: str) -> Any: req = request.Request(self.base_url.rstrip("/") + path, method="GET") with request.urlopen(req, timeout=20) as resp: body = resp.read().decode("utf-8") return json.loads(body) def _post(self, path: str, payload: dict[str, Any]) -> str: data = json.dumps(payload).encode("utf-8") req = request.Request( self.base_url.rstrip("/") + path, method="POST", data=data, headers={"Content-Type": "application/json"}, ) with request.urlopen(req, timeout=20) as resp: return resp.read().decode("utf-8", errors="replace")The documented default is also plaintext:
markdown - Access to a running MuPiBox backend instance (MuPiBox host is often `http://mupibox/`, API for this script defaults to `http://mupibox:8200`; override with `--base-url`)Technical Analysis
The client defaults to an
http://backend and transmits database reads and mutation requests without transport encryption. The requests also contain no client-supplied authorization header or other request authentication mechanism.An attacker with a network-adjacent position, control over DNS or local hostname resolution, or access to a compromised network device could observe the database returned by
/api/data. The attacker could also intercept, redirect, replay, or modify requests sent to/api/add,/api/edit, and/api/delete.Because HTT ...[truncated 1818 chars]
- Remediation
View remediation
Remediation Suggestions
-
Change the default endpoint to an HTTPS URL:
python DEFAULT_BASE_URL = "https://mupibox:8200" -
Reject plaintext HTTP by default. If compatibility with isolated legacy deployments is required, permit it only through an explicit option such as
--allow-insecure-httpand display a prominent warning. -
Configure the MuPiBox backend with a certificate trusted by the client. Preserve Python's default certificate and hostname verification rather than introducing an unverified TLS context.
-
Add backend authentication, such as a narrowly scoped bearer token, and avoid placing credentials in command-line arguments where they may appear in process listings. Prefer environment variables, protected configuration files, or an operating-system credential store.
-
Add request integrity or anti-replay protections where supported, particularly for destructive endpoints. Examples include short-lived authenticated requests, nonces, or server-side authorization controls.
-
Restrict access to the backend using host firewall rules and network segmentation. The API should only accept connections from authorized management hosts.
-
Document the security assumptions for local-network deployments and clearly state that plaintext HTTP does not protect against interception, spoofing, or request modification.
-
Add tests confirming that insecure URL schemes are refused unless explicit insecure mode is enabled and that HTTPS certificate-validation failures stop all mutations.
-
