-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"Ubiquiti's UniFi Network Application ships a guest captive portal that hospitality and SMB networks use to gate their WiFi. The portal has a branding feature: the operator turns on `portal_customized: true` for the site and the splash page renders their logo, their colors, their terms of service instead of Ubiquiti's defaults. The setting is the configuration any hotel, café, or retail captive portal ends up with.\n\nThe same setting decides where the portal's resource loader reads from. With customization off, the loader resolves template paths inside the controller's JAR. With customization on, the loader resolves them against the on-disk portal directory under the controller's data tree. The renderer does not know which backend it is talking to.\n\nCVE-2026-22557 is path traversal on the renderer that serves the portal's failure page. The renderer reads the `page_error` query parameter, prepends nothing, hands the literal string to the loader. With customization off, the traversal walks the JAR, bounded by whatever Ubiquiti chose to bundle. With customization on, the traversal walks the filesystem, bounded by the unix permissions of the user the controller runs as. That user can read the keystore.\n\nThe sandbox was the JAR. The customization feature was the toggle.\n\n## The endpoint legitimate clients reach by POST\n\nThe vulnerable URL is `/guest/s//wechat/sign`. The handler is UniFi's WeChat-login signature callback, the place where a guest who picked \"Sign in with WeChat\" lands after Tencent redirects them back. Legitimate clients reach it via POST carrying WeChat's signed assertion. The dispatcher routes POST into the WeChat handler. It also accepts GET on the same path, and on a GET it falls through to the failure-page renderer instead.\n\nThe failure-page renderer is the code that tells a guest \"your sign-in failed, please try again.\" Captive portals have a long list of failure modes (timeout, declined terms, expired session, missing WeChat field, declined gateway), and the renderer is parameterised by a `page_error` query parameter that names the error template. Operators with customized portals can ship their own error pages; the failure-page renderer is the loader that finds them.\n\nThe exploit is one request:\n\n```\nGET /guest/s/default/wechat/sign?page_error=../../../../system.properties HTTP/1.1\nHost: target:8443\nAccept: application/octet-stream\n```\n\nNo POST body. No authentication. No session cookie. The dispatcher sees GET, routes to the failure-page renderer, the renderer takes `page_error` as the template name, hands the literal `../../../../system.properties` to the resource loader, and the loader returns whatever it finds. If `portal_customized: true` is set on the queried site, the loader is reading from disk. The bytes come back in the HTTP response.\n\nNVD's record for this CVE describes the consequence as a path traversal that \"could be manipulated to access an underlying account.\" That sentence covers the controller's admin password. It does not cover the seven other categories of secret the same primitive returns.\n\n## The two backends behind one resolver\n\nBishop Fox's detection tool, [`BishopFox/CVE-2026-22557-check`](https://github.com/BishopFox/CVE-2026-22557-check), makes the two-backend structure explicit by probing the backends separately. The script's stage-2 calibration uses `system.properties`, a small configuration file that exists in BOTH the JAR's bundled defaults AND on the controller's disk as the runtime config the operator's edits are written into. A successful read of `system.properties` at depth N means the traversal fires AT all, regardless of which backend is active. The script's comment names this distinction:\n\n```python\n# Stage-2 depth-calibration anchor. A small configuration file readable from\n# both the disk branch and the JAR classpath fallback, so it serves only as\n# a depth oracle (not as a branch oracle).\nCALIBRATION_FILE = (\"system.properties\", b\"system.properties\")\n```\n\nStage-3 asks a different question: is the disk branch active right now on this site? The tool reads `firmware.json` or `uidb.json`, runtime catalog files populated by the controller at runtime and never bundled into the JAR. The script's comment, lightly repunctuated:\n\n```python\n# Stage-3 branch-confirmation probe. Runtime-populated catalog files that\n# exist on disk but are not bundled in any JAR. A 200 here positively\n# confirms the filesystem branch is active.\nFS_PROBES: tuple[tuple[str, bytes | None], ...] = (\n (\"firmware.json\", b'\"version\"'),\n (\"uidb.json\", b'\"name\"'),\n)\n```\n\nA 200 on either probe means the loader walked the actual filesystem. That is the precondition for arbitrary file read.\n\nThe structure of the tool is the structure of the bug. Bishop Fox is treating the controller as a black box and using the difference in file availability between the two backends as an oracle for which backend is wired in. They built a two-stage probe because the application has two backends. They calibrated separately because the safety property of each backend is separate. The tool's three verdicts (`VULNERABLE`, `PARTIALLY EXPOSED`, `NOT VULNERABLE`) map directly to \"disk branch active,\" \"vulnerable build but JAR branch active on this site,\" and \"patched build.\"\n\n`PARTIALLY EXPOSED` is the verdict that gives the design away. It says: on this site, today, the traversal is still reachable, but the loader is bounded by what Ubiquiti happened to bundle in the JAR. The same controller is one `portal_customized: true` flip on any of its sites away from `VULNERABLE`. The application binary is not safe; this site's backend just happens to be the bounded one.\n\n## What customization meant\n\nThe README does not euphemise the deployment shape. Quote:\n\n> When `portal_customized: true` is set on the queried site (the configuration any branded captive portal, such as a hotel, retail, or café deployment, ends up with), the loader resolves that path against the on-disk portal directory, and the path can escape it.\n\nEvery UniFi controller serving a captive portal with the operator's brand on it has `portal_customized` set on at least one site. That is the deployment shape across hospitality, retail, education, and small commercial property. Conference centers. Hotel chains. Café franchises. Coworking. Multi-tenant retail. Every public WiFi splash page that is not Ubiquiti's default is a candidate.\n\nAnd it is per-site. A controller with multiple sites is exploitable as soon as ANY one site has the customization flag set, because the renderer's backend choice is per-site, and an unauthenticated attacker picks the site they want to probe in the URL. The detection tool re-runs per site for exactly this reason. An attacker probing a controller scans the same way: enumerate sites, try the traversal at each one, the first hit is enough.\n\nThe product team at Ubiquiti described customization as a UX feature. The marketing page describes it as a UX feature. The operator turned it on for a UX reason. The setting's effect on the resource loader was not in any of the descriptions the operator read.\n\n## What the renderer can now read\n\nBishop Fox's tool prints, on a `VULNERABLE` result, the list of credentials the operator now has to rotate:\n\n```\nAfter patching, rotate credentials that may have been\nexposed: admin passwords, the SSH credential the controller\npushes to managed devices, the controller's TLS keystore,\nRADIUS / VPN / WireGuard secrets, SMTP relay passwords,\nand any payment-gateway keys.\n```\n\nRead that list as the answer to \"what is on the disk the failure-page renderer now walks.\" The administrator password for the controller's web UI. The SSH credential the controller pushes to every UniFi device it adopts, which means every access point, every switch, every gateway, every Dream Machine on the network. The TLS keystore including the private key the controller presents in its own TLS handshake. RADIUS shared secrets used to authenticate wireless clients on the operator's network. VPN and WireGuard keys for any tunnels the controller terminates. SSL-inspection CA material if the operator is doing TLS interception. SMTP relay passwords for the controller's alert mail. Payment-gateway keys if the captive portal takes payment for WiFi (hospitality hot-spot paywalls, some hotel chains).\n\nNVD's record describes the consequence as \"could be manipulated to access an underlying account.\" That clause captures the first item. It silently drops the other seven.\n\nA hotel's controller is one unauthenticated GET away from leaking the credential its access points use to phone home. Whoever holds that credential is inside the L2 of the hotel's network as far as those devices are concerned.\n\n## Same code. Two security properties.\n\nThe bug Ubiquiti shipped is not that they forgot to validate `page_error`. The bug is that they shipped a resource loader whose safety came from the storage backend, and then shipped a feature that toggles the backend.\n\nWhen the loader's backend was the JAR, `../` in the user-controlled template name was a partial primitive: an attacker could walk Ubiquiti's bundled resource tree, bounded by whatever Ubiquiti chose to ship. Annoying. Possibly useful for fingerprinting the build. Not arbitrary file read. The code's apparent safety was not in the code. It was a property of the underlying URL the loader was holding (`jar:file:...`), and of the resource-resolution semantics of the layer reading that URL. The call site looked harmless because the call site's behaviour was bounded by what existed at the other end.\n\nWhen customization was added, the loader's backend became the filesystem. The same call site now resolved through `file:` URLs against a real directory under the controller's data tree. The code did not change. Its safety did. Walking up `../` past the portal directory now reaches the configuration tree, the keystore, the SSH key Ubiquiti's adoption protocol uses, the RADIUS shared secret. The renderer that printed \"your sign-in failed, please try again\" is now an oracle for the controller's secret material.\n\nThis is the shape that produces a [Design Debt Driver](/patterns/design-debt-driver). The customization feature is the substrate. The path-traversal in the failure-page renderer is one instance the substrate produced. The patch in SAB-062 closes the renderer's specific traversal. The substrate, a design where a per-site configuration flag swaps the resource backend the renderer walks, remains. The next exploit primitive in this codebase lives wherever the next user-controlled string flows into a resolver whose safety came from the storage layer.\n\n## The endpoint that branded your guest WiFi reads your keystore\n\nHospitality networks turned on `portal_customized` so the captive portal would say \"Welcome to The Plaza\" instead of \"Welcome to UniFi.\" Retail networks turned it on so the splash page would offer a coupon for the store. Cafés turned it on so guests would see the café's logo. The branding feature was the visible thing. Ubiquiti's product documentation describes it as a UX feature. The operator who turned it on did so for a UX reason.\n\nThe same flag, on the same site, in the same line of YAML, is what made the failure-page renderer reach the keystore.\n\nPoC: [BishopFox/CVE-2026-22557-check](https://github.com/BishopFox/CVE-2026-22557-check)","closing_line":"The patch closes this CVE. The customization feature still decides which backend the renderer walks.","hook_md":"Ubiquiti's UniFi Network Application ships a guest captive portal that hospitality and SMB networks use to gate their WiFi. The portal has a branding feature: the operator turns on `portal_customized: true` for the site and the splash page renders their logo, their colors, their terms of service instead of Ubiquiti's defaults. The setting is the configuration any hotel, café, or retail captive portal ends up with.\n\nThe same setting decides where the portal's resource loader reads from. With customization off, the loader resolves template paths inside the controller's JAR. With customization on, the loader resolves them against the on-disk portal directory under the controller's data tree. The renderer does not know which backend it is talking to.\n\nCVE-2026-22557 is path traversal on the renderer that serves the portal's failure page. The renderer reads the `page_error` query parameter, prepends nothing, hands the literal string to the loader. With customization off, the traversal walks the JAR, bounded by whatever Ubiquiti chose to bundle. With customization on, the traversal walks the filesystem, bounded by the unix permissions of the user the controller runs as. That user can read the keystore.\n\nThe sandbox was the JAR. The customization feature was the toggle.","post_id":523,"slug":"unifi-cve-2026-22557-the-sandbox-was-the-jar","title":"CVE-2026-22557: UniFi's Sandbox Was The JAR","type":"initial","unreadable_sentence":"The sandbox was the JAR. The customization feature was the toggle."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCao811gAKCRDeZjl4jgkQ JkcFAQCP5Js0apWtA5D4kpvKeFwHEgAqK8XwCfX7TjxRSV1/NAD8CshxvnHKzp/q d0lqzv731MeIvb57VdVt4rbZLPKK0w0= =5QuM -----END PGP SIGNATURE-----