Summary
LuCI fails to HTML-encode DHCPv6 lease hostnames before rendering them in status tables, enabling injected markup to execute in the administrator's browser.
An attacker on the adjacent network can send a crafted DHCPv6 Client FQDN containing script tags, which will run when an administrator views the DHCP lease page in the LuCI web interface.
Affected context
This vulnerability arises in LuCI's web-based management interface when displaying DHCPv6 lease information in status tables.
The affected context involves environments where:
- LuCI is used as the administrative interface for routers or network devices
- DHCPv6 is enabled and processes client-supplied FQDN/hostname data
- Administrators regularly view DHCP lease or status pages through a web browser
In these conditions, unencoded client hostnames can inject arbitrary HTML into the rendered page.
Exploit preconditions
- Attack surface: LuCI web interface displaying DHCPv6 lease status pages
- Required access: Ability to send DHCPv6 requests on the local or adjacent network (e.g., as a connected client or attacker on the same segment)
- Trigger point: Administrator opens or refreshes the DHCPv6 lease/status page in the LuCI interface
- Why exploitation is possible: Client-supplied DHCPv6 FQDN/hostname fields are reflected into HTML without proper encoding or sanitization, allowing attacker-controlled markup to be interpreted by the browser
Why this happens
The underlying issue is an output encoding failure in a web management interface.
LuCI takes user-controlled data from DHCPv6 lease records (such as Client FQDN/hostname) and injects it directly into HTML context in the status tables without applying the appropriate escaping or encoding.
This corresponds to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where untrusted data is included in the HTML response without neutralizing characters that have special meaning in HTML or JavaScript.
Potential impact
- Attackers can execute arbitrary JavaScript in the administrator's browser session
- Malicious scripts may steal or misuse session information and browser-stored data within the LuCI context
- Administrative actions could be performed on behalf of the logged-in user via CSRF-like scripted requests
- Users may be redirected to phishing or malware-hosting sites from the management interface
- Long-lived malicious payloads may persist as long as the crafted DHCPv6 lease entry remains visible
General mitigation guidance
Defensive measures generally focus on robust output encoding and strict handling of untrusted data in web interfaces:
- Apply context-aware HTML escaping for all user-controlled fields before rendering them in the UI, especially in tables and status views
- Use templating frameworks or helper functions that enforce automatic output encoding by default
- Treat all DHCP-derived hostnames and FQDNs as untrusted input and avoid rendering them as raw HTML
- Limit the browser's ability to execute dynamic content in administrative pages, for example by adopting a restrictive Content Security Policy tailored to the management UI
- Separate display logic from data collection, ensuring that network-originated values pass through centralized validation and encoding routines
How teams detect issues like this
Detection efforts can center on both code-level and behavior-level indicators:
- Use static analysis or linters that flag direct insertion of untrusted variables into HTML templates without encoding
- During code review, look for concatenation of user or network-sourced data into HTML output, especially in administrative status or logging pages
- Establish secure coding guidelines mandating context-aware escaping of all variables rendered in views
- Employ automated security testing and dynamic analysis that injects test payloads into DHCPv6 or similar network inputs to see if they surface unencoded in the UI
- Integrate web application security scanners into QA processes to identify XSS patterns in management interfaces

