-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The handler joined a string with pathlib and called it a sandbox\n\nThe pre-patch download handler lives at `src/pipecat/runner/run.py` inside `_setup_webrtc_routes`. Read it whole:\n\n```python\n@app.get(\"/files/{filename:path}\")\nasync def download_file(filename: str):\n \"\"\"Handle file downloads.\"\"\"\n if not args.folder:\n logger.warning(f\"Attempting to dowload {filename}, but downloads folder not setup.\")\n return\n\n file_path = Path(args.folder) / filename\n if not os.path.exists(file_path):\n raise HTTPException(404)\n\n media_type, _ = mimetypes.guess_type(file_path)\n\n return FileResponse(path=file_path, media_type=media_type, filename=filename)\n```\n\nTwo things to notice before the path traversal.\n\nFirst, the route is registered inside `_setup_webrtc_routes` unconditionally. Whether `--folder` is set, whether anything is going to be served, the endpoint exists as long as `--transport webrtc` is the active transport, which is the runner's default. The `args.folder` check runs at request time. Before the patch, a request that arrived without `--folder` configured logged the typo `dowload` and returned `None`. FastAPI serialised the `None` as `null`. The response was `HTTP/1.1 200 OK` with `Content-Type: application/json` and the literal four-byte body `null`. That is the discovery signature for \"there is a Pipecat WebRTC runner here, and the operator did not set up a downloads folder.\"\n\nSecond, `Path(args.folder) / filename` is the pathlib join operator. Its documented job is to concatenate path segments; its documented behaviour is to return whatever the composition resolves to, with no containment check. The function name `download_file` and the surrounding `if not os.path.exists(file_path)` read as scoping. They are not.\n\n## Starlette kept `%2F` opaque. The `:path` converter decoded it\n\nASGI servers hand the URL path to the application URL-decoded except for `%2F`, which is preserved as the literal three-character sequence so the routing layer can distinguish a separator from a slash inside a single segment. Starlette's routing matcher walks the path-segment list against the route trie; literal `../` segments inside a real `/`-delimited URL are collapsed before any route map runs.\n\nA request for `/files/../etc/passwd`, with literal slashes between the dot-dot and `etc`, is dot-segment-resolved away before any route matches it. The `/files/` prefix is gone; the request 404s.\n\nA request for `/files/..%2F..%2Fetc%2Fpasswd` is not. The ASGI `path` Starlette receives is `/files/..%2F..%2Fetc%2Fpasswd` with `%2F` preserved. The `/files/{filename:path}` route matches; the `:path` converter is greedy and captures the entire suffix as the single value of the `filename` parameter. The converter then runs URL-decoding on the captured string, including expanding `%2F` back to `/`. The handler is called with `filename = \"../../etc/passwd\"`.\n\nThe handler joins that against `args.folder`:\n\n```python\nfile_path = Path(\"./recordings\") / \"../../etc/passwd\"\n# str(file_path) == 'recordings/../../etc/passwd'\n```\n\npathlib does not resolve `..` segments at join time; it returns the string composition. `os.path.exists()` then asks the operating system to walk the path, the OS resolves `..` against the filesystem, `/etc/passwd` exists, the existence check passes. `FileResponse(path=file_path, media_type=media_type, filename=filename)` opens the file and streams it back, setting the user-controlled `filename` value as the `Content-Disposition` filename header.\n\nThe shape is [gate-before-canonicalize](/patterns/gate-before-canonicalize). The gate is Starlette's segment-level dot-segment resolution, which runs against the wrapped representation where `%2F` is opaque. The canonicaliser is the `:path` converter's URL decoding, which runs against the captured parameter after routing has finished. The handler sees the unwrapped form the gate never inspected. The same primitive on the same substrate produced [Nitro CVE-2026-44373](/posts/nitro-cve-2026-44373-upstream-decoded-the-bytes) two months ago, where Nitro's `radix3` router kept `%2F` opaque for routing and a downstream upstream decoded it before resolving against the filesystem. Pipecat collapses both halves into one process: the routing layer and the pathlib join run inside the same FastAPI worker, separated by exactly the function-call boundary the handler crosses to read its `filename` argument.\n\n## The patch adds the post-join check pathlib does not export\n\nCommit `e780f75`, authored by Mark Backman at Daily on May 4, 2026, is the fix. The relevant diff:\n\n```diff\n+def _resolve_download_path(folder: str, filename: str) -> Path:\n+ \"\"\"Resolve a download path and ensure it stays within the downloads folder.\"\"\"\n+ allowed_base = Path(folder).resolve()\n+ file_path = (allowed_base / filename).resolve()\n+\n+ if not file_path.is_relative_to(allowed_base):\n+ raise HTTPException(status_code=403, detail=\"Access denied\")\n+\n+ return file_path\n+\n+\n def _setup_webrtc_routes(app: FastAPI, args: argparse.Namespace):\n ...\n @app.get(\"/files/{filename:path}\")\n async def download_file(filename: str):\n \"\"\"Handle file downloads.\"\"\"\n if not args.folder:\n- logger.warning(f\"Attempting to dowload {filename}, but downloads folder not setup.\")\n- return\n+ logger.warning(f\"Attempting to download {filename}, but downloads folder not setup.\")\n+ raise HTTPException(404)\n\n- file_path = Path(args.folder) / filename\n- if not os.path.exists(file_path):\n+ file_path = _resolve_download_path(args.folder, filename)\n+ if not file_path.exists():\n raise HTTPException(404)\n\n media_type, _ = mimetypes.guess_type(file_path)\n\n- return FileResponse(path=file_path, media_type=media_type, filename=filename)\n+ return FileResponse(path=file_path, media_type=media_type, filename=file_path.name)\n```\n\nThree changes, in descending order of editorial weight.\n\n`_resolve_download_path` resolves both the base directory and the joined path, then runs `Path.is_relative_to(allowed_base)` against the resolved-symlink form. That is the actual sandbox primitive pathlib's `/` operator is not. The shape matches the [join-is-not-sandbox](/patterns/join-is-not-sandbox) pattern's canonical fix, the same post-join verification that [Casdoor's `filepath.Join` CVE-2026-6815](/posts/casdoor-cve-2026-6815-getfullpath-joined-the-path-out) and [DbGate's `path.join` CVE-2026-47669](/posts/dbgate-cve-2026-47669-unzipdirectory-joined-the-path-out) reach for in Go and Node. The mistake is the same in every language that ships a join helper documented as a normaliser: developer reads it as scoping, framework defines it as composing, fix is `resolve` both sides and check containment.\n\nThe `--folder` unset branch returns `HTTPException(404)` instead of `None`. That closes the discovery oracle. After the patch, hitting `/files/x` without `--folder` configured returns a 404 indistinguishable from any other unknown path. The 200-with-null-body signature scanners read pre-patch is gone.\n\nThe typo `dowload` becomes `download`. The line shipped once and was never edited until the security fix. The PR's commit message names what it closes: `fix: validate download path containment in runner`. The audit was a security audit. The code that had the typo and the code that had the path traversal were touched in the same review, by the same developer, because the same code had not been read by anyone with the question \"what does this endpoint serve to an unauthenticated caller\" until the GHSA arrived.\n\n## The runner advertises Access-Control-Allow-Origin: *\n\nThe CORS middleware is configured in `_configure_server_app`, which runs before any transport-specific routes are mounted, regardless of which transport the operator picked:\n\n```python\ndef _configure_server_app(args: argparse.Namespace):\n \"\"\"Configure the module-level FastAPI app with transport-specific routes.\"\"\"\n app.add_middleware(\n CORSMiddleware,\n allow_origins=[\"*\"],\n allow_credentials=True,\n allow_methods=[\"*\"],\n allow_headers=[\"*\"],\n )\n```\n\n`allow_origins=[\"*\"]`. Every origin is permitted. The middleware sits in front of every route the runner ever registers, including the `/files/{filename:path}` handler the path-traversal fix lives in.\n\nWhat that means for the bug:\n\nA developer running `python bot.py -t webrtc --folder ./recordings` has the runner bound to `localhost:7860`. A second tab on the same machine, visiting any web page that ships JavaScript, can issue `fetch(\"http://localhost:7860/files/..%2F..%2F..%2Fetc%2Fpasswd\")` against the developer's loopback. The browser forwards the request; Starlette's CORSMiddleware echoes the requesting origin into `Access-Control-Allow-Origin` (the legal substitution for `*` when the middleware is configured with `allow_credentials=True`); the page's JavaScript reads the response. The developer's `/etc/passwd` ends up in a variable inside a tab the developer did not consent to read it. Pre-patch, the same fetch reads any file the runner's process can read. Post-patch, the reachable filenames are bounded by `--folder`, and the rest of the chain is unchanged.\n\nThis is the [OpenCode CVE-2026-22812](/posts/opencode-cve-2026-22812-patched-the-cors-not-the-auth) posture in mirror image. OpenCode's CVE was the CORS wildcard; the patch added an allowlist and left the unauthenticated shell endpoint intact. Pipecat's CVE is the path traversal; the patch adds containment and leaves the CORS wildcard and the missing authentication intact. The same pair of doors, two different vendors, each closing the door the CVE happened to name. A `--allowed-origins` flag was added by an outside contributor on June 11, five weeks after the security fix; the CORS middleware now reads `args.allowed_origins or [\"*\"]`. The default is still `*`. The contributor's commit message is `Allow adding origin restrictions to WebSocket transports and the runner`. The runner's docs do not yet recommend the flag in any of the canonical invocations.\n\n## ESP32 mode refuses to start on localhost\n\nThe ESP32 transport is the canonical reason a Pipecat developer binds the runner to anything other than `localhost`. The docstring at the top of `run.py` names the invocation directly:\n\n```\n- ESP32: `python bot.py -t webrtc --esp32 --host 192.168.1.100`\n```\n\n`192.168.1.100` is on the developer's LAN. An ESP32 microcontroller sits next to the laptop on the same Wi-Fi; the device dials the runner over the LAN to receive WebRTC SDP offers and exchange RTP. A localhost-bound runner is not reachable from a separate device by definition. The ESP32 path requires an external interface.\n\nThe runner enforces this itself, inside `main()`:\n\n```python\nif args.esp32 and args.host == \"localhost\":\n logger.error(\"For ESP32, you need to specify `--host IP` so we can do SDP munging.\")\n return\n```\n\n`--esp32` plus the default `--host localhost` is rejected. The runner refuses to start. The developer's only path forward is to bind to an external interface. The interface they bind to is, in every example the project documents, a LAN IP.\n\nThe pre-patch consequence: `python bot.py -t webrtc --esp32 --host 192.168.1.100 --folder ./recordings` exposes `/files/{filename:path}` to every device on the LAN. A guest on the office Wi-Fi, the IoT camera firmware on the home Wi-Fi, the coworker's laptop two desks over, any of them can `curl http://192.168.1.100:7860/files/..%2F..%2F..%2F.env` and read the `.env` file the developer's bot loads its API keys from. The keys a Pipecat bot loads are not generic: an `OPENAI_API_KEY` with billing attached, an `ANTHROPIC_API_KEY` with billing attached, a `DAILY_API_KEY` that can create rooms in the developer's Daily account, a `CARTESIA_API_KEY` or `ELEVENLABS_API_KEY` paying for synthetic voice. The .env in a Pipecat project is the AI-agent keychain, and the path-traversal made it readable to anyone on Wi-Fi.\n\nThe post-patch consequence: the LAN device can still `GET /files/`, with no authentication, with the CORS wildcard intact, and the reachable filenames now bounded by `--folder`. Whatever the bot is currently writing to that folder, session transcripts, recordings, the audio of the call that just finished, is reachable. The architecture that put the runner on the LAN in the first place is unchanged.\n\n## The runner is the runner\n\nPipecat is an open-source framework. The framework is the bot library; the runner is the way Pipecat developers run their bots. The docstring's framing as a development runner is convention; nothing in the listener enforces it. The package extra is named `runner`. The README points at it for every walk-through. The project ships no other process for hosting a Pipecat bot. Developers who want a long-running production deployment migrate to Pipecat Cloud (which Daily, Pipecat's parent company, sells) or stand up their own ASGI server with their own auth; developers who are iterating locally use `pipecat-ai[runner]`, which is the file the May 4 patch landed in.\n\nThe convention extends only as far as the developer's discipline. The CORS middleware is wildcard. The route is registered before the `--folder` check runs. The authentication is none. The `--folder` flag, the `--host` flag, and the `--esp32` flag all expand the exposed surface; nothing contracts it. The patch closes one specific way that surface manufactures a path outside `--folder`. The surface itself is unchanged.\n\nCVE-2026-44716 fixes a containment hole in a tool that has no containment by design. The fix is structurally correct; the [join-is-not-sandbox](/patterns/join-is-not-sandbox) post-join verification is the textbook answer. The bug class it closes (URL-decoding-after-routing producing an escape the routing layer's gate could not name) is the textbook [gate-before-canonicalize](/patterns/gate-before-canonicalize) shape. The patch is the fix the catalog expects. The runner the patch lives in is the runner the project's documentation, package layout, and ESP32 validation code all conspire to deploy onto the developer's LAN.\n\nPatch: [pipecat-ai/pipecat#4417](https://github.com/pipecat-ai/pipecat/pull/4417)","closing_line":"The advisory calls this a development runner. There is no production runner.","hook_md":"Pipecat ships one HTTP runner. `pip install pipecat-ai[runner]` is the install extra; `src/pipecat/runner/run.py` is the file; the docstring at the top of that file calls it the development runner; the GHSA description filed under CVE-2026-44716 calls it the development runner. There is no other runner. The ESP32 walkthrough in the file's own docstring tells developers to start it with `--host 192.168.1.100` because the embedded device on the same Wi-Fi has to reach the SDP-munging endpoint. The WebRTC examples tell them to add `--folder ` if they want the prebuilt UI to serve recordings. CVE-2026-44716 is what `GET /files/..%2F..%2Fetc%2Fpasswd` does when both flags are set, before Daily's May 4 patch. The patch fixes the escape. It does not add authentication, change the wildcard CORS, or reconsider the docs that tell ESP32 developers to bind the runner to their LAN.\nThe advisory calls this a development runner. There is no production runner.","post_id":656,"slug":"pipecat-cve-2026-44716-development-runner-is-the-runner","title":"CVE-2026-44716: Pipecat Calls This The Development Runner. There Is No Production Runner.","type":"initial","unreadable_sentence":"ESP32 mode refuses to start on localhost. The interface the runner binds to is, by Pipecat's own validation code, a LAN IP."} -----BEGIN PGP SIGNATURE----- iHQEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCavTXsAAKCRDeZjl4jgkQ JvsMAPi9S61OPzNMr8WRsHzO7zN2zJzDCKm+vgGsADpn2yarAPwPb8mGkRGFnu+L 6bbT61bmFeqGqLemF7IwamKASlzZDQ== =FiSz -----END PGP SIGNATURE-----