/

CVE-2026-62948

Severity:

CRITICAL RISK

(9.6)

Stored XSS (CWE-79) in OpenWrt LuCI DHCP Lease View

CVE-2026-62948

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79, CWE-117, CWE-150

Impact:

Stored Cross-Site Scripting in Web Admin Interface

Severity:

CRITICAL RISK

(9.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OpenWrt's odhcpd service previously wrote unescaped hostnames into a lease file that LuCI rendered as live HTML in the web-based admin interface.

An attacker who can supply a crafted DHCPv6 hostname can inject malicious script content, leading to stored cross-site scripting when an administrator views the Active DHCPv6 Leases page.

Affected context

The vulnerability occurs in OpenWrt deployments using odhcpd together with the LuCI web interface for administration.

When DHCPv6 clients provide fully qualified domain names (FQDNs), odhcpd writes these values into /tmp/odhcpd.leases without escaping.

LuCI's RPC layer and JavaScript views then read this lease file and insert the hostname strings directly into the DOM as HTML on the Active DHCPv6 Leases status page.

Environments where untrusted or semi-trusted devices can obtain DHCP leases are particularly exposed to this issue.

Exploit preconditions

  • Attack surface: OpenWrt LuCI web administration interface (Active DHCPv6 Leases page).
  • Required access: Ability to connect a device or virtual client to the affected network segment and obtain a DHCPv6 lease, while controlling the client's hostname/FQDN option.
  • Trigger point: An authenticated administrator (or other LuCI user with access) opens or refreshes the Active DHCPv6 Leases page, causing LuCI to read /tmp/odhcpd.leases and render the injected content.
  • Why exploitation is possible: Hostname values are written to the lease file without escaping or validation (CWE-117 / CWE-150), and later interpreted as HTML/JavaScript in the browser without proper output encoding (CWE-79), enabling script execution in the admin's session.

Why this happens

The root cause is a combination of improper output encoding and unsafe handling of log/state data across trust boundaries.

odhcpd's statefiles_write_state6() and statefiles_write_state4() functions accept DHCP client FQDN values and write them directly into a state file without escaping special characters or line breaks (CWE-117: Improper Output Neutralization for Logs; CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences).

LuCI subsequently treats the file contents as trusted data and inserts them into the DOM using functions like dom.append without HTML encoding (CWE-79: Improper Neutralization of Input During Web Page Generation), allowing attacker-controlled content to become executable script in the admin's browser.

Potential impact

  • Theft of administrator session data or browser-accessible tokens via injected JavaScript.
  • Unauthorized actions in the LuCI interface performed on behalf of the administrator (e.g., configuration changes, adding SSH keys, modifying firewall rules).
  • Injection of misleading or spoofed UI content, potentially tricking administrators into dangerous actions.
  • Pivoting to other internal resources reachable from the administrator's browser context (e.g., CSRF-style attacks against adjacent services).
  • Persistent compromise of the router's management plane as long as the malicious lease entry remains active.

General mitigation guidance

Effective mitigation focuses on strict separation between data storage formats and rendered HTML, along with treating all client-supplied identifiers as untrusted:

  • Apply context-appropriate output encoding for any data rendered into HTML, ensuring hostnames and other lease fields are HTML-escaped before DOM insertion.
  • Normalize and validate DHCP client identifiers, enforcing a conservative character set and rejecting or sanitizing control characters, newlines, and markup-like sequences.
  • Treat state and lease files as untrusted input surfaces; when reading them for web presentation, re-validate their contents rather than trusting them as internal-only data.
  • Limit administrative exposure by restricting LuCI access to dedicated management networks and accounts with least-privilege permissions.
  • Prefer UI components and templating helpers that encode by default, reducing the likelihood of raw string insertion into the DOM.

How teams detect issues like this

Detection commonly involves a mix of code-level analysis and runtime inspection:

  • Use static analysis and linters to flag direct insertion of untrusted data into the DOM (e.g., innerHTML, dom.append with raw strings) without encoding.
  • Review paths where network-originated data (such as DHCP options) flows into state or log files, and then into web views, checking for missing validation or escaping at each hop.
  • Implement security-focused code review checklists requiring explicit output encoding for any values stored in system files and later displayed in the UI.
  • Employ dynamic testing and fuzzing of DHCP client fields (especially hostnames and FQDNs) to detect script injection in rendered admin pages.
  • Consider using automated SAST/DAST tools that recognize XSS patterns and unescaped log-to-UI data flows in web administration interfaces.

Sources

SourceLink
github.comgithub.com/openwrt/luci/commit/55379d04fcc3c605003a5001d6135cf02ae6048a
github.comgithub.com/openwrt/odhcpd/commit/68f382690bfaec56d5b1f31c3c31c48bcb642e3a
github.comgithub.com/openwrt/odhcpd/pull/404
github.comgithub.com/openwrt/openwrt/releases/tag/v25.12.5
github.comgithub.com/openwrt/openwrt/security/advisories/GHSA-hhmc-92hw-535f

Frequently asked

questions

It depends on how the router's management interface is exposed. If LuCI is accessible from untrusted networks or the internet, a remote attacker who can obtain a DHCPv6 lease or emulate a client on a reachable segment can exploit it. Even when LuCI is only accessible from internal networks, any attacker or malware operating on that network segment could abuse the issue.

The attacker must be able to act as a DHCPv6 client on the affected network and control the hostname/FQDN option sent to odhcpd. Exploitation then requires that an authenticated LuCI user view the Active DHCPv6 Leases page, at which point the stored payload executes in their browser.

The safest pattern is to consistently apply output encoding at the point where data is rendered, regardless of its origin, and to validate and sanitize all externally influenced data before writing it to internal state or log files. Using framework helpers that encode HTML by default and centralizing encoding logic reduces the chance of missing a path.

Adopt a defense-in-depth strategy: treat all data originating from network clients as untrusted, enforce strict validation on identifiers (like hostnames), ensure lease/log/state files are never trusted blindly, and require that any data reaching the UI passes through context-aware encoding. Integrate secure coding guidelines, automated XSS-focused tooling, and targeted code review practices into the development lifecycle for management interfaces.

Find out what's already
exploitable in your codebase.