GHSA-hhmc-92hw-535f / CVE-2026-62948: odhcpd/LuCI: unauthenticated DHCPv6 client can inject lease-file lines via FQDN hostname → stored XSS in the LuCI admin UI
- Published:
- Fetched:
- Updated:
- Affects:
- openwrt odhcpd/luci
https://github.com/openwrt/openwrt/security/advisories/GHSA-hhmc-92hw-535f ↗
odhcpd/LuCI: unauthenticated DHCPv6 client can inject lease-file lines via FQDN hostname → stored XSS in the LuCI admin UI ## Summary `odhcpd` writes a DHCPv6 client's requested hostname (its FQDN option, opt 39) into the lease state file `/tmp/odhcpd.leases` via `fprintf("…%s…", lease->hostname)` with **no escaping**. The hostname is decoded by `dn_expand()`, which copies DNS-label bytes **verbatim** — including `0x0a` (newline). A single newline **injects an arbitrary additional line** into the lease file. That file is parsed by LuCI's `rpcd-mod-luci` `getDHCPLeases` (`fgets`+`strtok`, lines beginning `# `) and shown in the **"Active DHCPv6 Leases"** admin status page. LuCI renders the host cell through `dom.append` → `node.innerHTML` **without HTML-escaping**, so an attacker-controlled hostname becomes **live markup in the privileged admin DOM** — an unauthenticated, pre-association **stored XSS** in the device management UI. One unauthenticated DHCPv6 REQUEST forges a lease record: ```jsonc // what getDHCPLeases returns after the injection (the forged record): { "interface": "br-lan", "hostname": "", "duid": "dd", "iaid": "1", "ip6addr": "fd1a:bf1c:9075::1ed" } ``` ## Environment / affected range - **Component (injection):** `odhcpd` — `src/statefiles.c` `statefiles_write_state6()` (DHCPv6, line ~498) and `statefiles_write_state4()` (DHCPv4, ~533, identical pattern). - **Component (render sink):** LuCI — `luci-mod-status` (`htdocs/luci-static/resources/view/status/include/40_dhcp.js`) + `luci-base` (`htdocs/luci-static/resources/luci.js`, `dom.append`); back-end `rpcd-mod-luci` `getDHCPLeases` (`/usr/lib/rpcd/luci.so`). - **Hunt corpus:** odhcpd `main` @ `1782f3f` (`PKG_SOURCE_DATE=2026-06-04`), zero downstream patches. - **Live-validated build:** OpenWrt **25.12.4** (`r32933-4ccb782af7`, x86/64), kernel 6.12.87, musl; `odhcpd-ipv6only-2026.03.16~edf2e523-r1`; `rpcd-mod-luci-20240305`; `luci-base 26.133`. odhcpd runs on `br-lan`, `dhcp.lan.dhcpv6='server'`, `leasefile=/tmp/odhcpd.leases` — **all defaults**. - **Affected range:** `statefiles.c` is **byte-identical at upstream HEAD `03dacc2`** — present and **unfixed**. The deployed 25.12.4 binary `/usr/sbin/odhcpd` carries the exact format strings (`# %s %s %x %s%s …` and the `broken\x20` marker). - **CWE-117** (improper output neutralization for logs) / **CWE-150** (improper neutralization of escape sequences) in odhcpd → **CWE-79** (stored XSS) in LuCI. ## Topology The attack rides the LAN as an ordinary unauthenticated DHCPv6 client; the XSS fires when an admin later opens the leases status page. ``` LAN segment br-lan (fw4 zone lan: input ACCEPT) +-------------------------+ +----------------------------------+ | Attacker (on-link) | DHCPv6 SOLICIT/REQUEST | OpenWrt DUT 25.12.4 10.0.2.2 | | fe80::a0a4:d5ff:... | with OPTION_FQDN(39) = | odhcpd [::]:547 (br-lan) | | unauth DHCPv6 client | "x\n# br-lan dd 1 Affected packages: :odhcpd/luci