/

CVE-2026-61875

Severity:

HIGH RISK

(8.8)

Stored XSS (CWE-79) in luci-app-upnp Port Mapping UI

CVE-2026-61875

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Cross-Site Scripting leading to session hijacking and UI compromise

Severity:

HIGH RISK

(8.8)

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

luci-app-upnp contains a stored cross-site scripting flaw where malicious JavaScript can be injected via UPnP AddPortMapping metadata and later executed in an administrator's browser.

When an attacker on the LAN submits crafted HTML in the NewPortMappingDescription field, miniupnpd persists it and luci-app-upnp renders it without output encoding on the UPnP or Status pages, allowing unauthorized script execution in the router's management context.

Affected context

This vulnerability appears in router or gateway deployments that:

  • Expose the luci-app-upnp web interface for managing UPnP port mappings
  • Run miniupnpd or a compatible UPnP IGD daemon that stores port mapping descriptions
  • Allow untrusted or semi-trusted LAN clients to send UPnP AddPortMapping SOAP requests

The issue manifests when luci-app-upnp displays stored port mapping descriptions on UPnP or Status pages without applying proper HTML/JavaScript output encoding in the administrator's browser.

Exploit preconditions

  • Attack surface: Internal network (LAN-side) via UPnP IGD AddPortMapping requests and the router's web UI.
  • Required access: Ability to send UPnP SOAP requests from a LAN client (no web UI login required) and the presence of an administrator who later opens the luci-app-upnp or Status pages.
  • Trigger point: Display of the malicious NewPortMappingDescription field in the browser when the admin visits the affected pages.
  • Why exploitation is possible: The application treats stored port mapping descriptions as trusted content, rendering them directly into HTML without contextual output encoding or sanitization, enabling attacker-controlled script execution in the admin's session.

Why this happens

The root cause is improper output handling of untrusted data that originates from UPnP AddPortMapping requests and is later rendered in the web UI.

luci-app-upnp reads the NewPortMappingDescription field, previously stored by miniupnpd, and injects it into HTML pages without escaping special characters or stripping script-capable constructs.

This matches CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where data accepted from an external source is incorporated into a web page without context-aware encoding, allowing execution of arbitrary JavaScript in the victim's browser.

Potential impact

  • Execution of arbitrary JavaScript in the administrator's browser when viewing UPnP or Status pages
  • Theft or misuse of administrative session tokens or CSRF tokens
  • Unauthorized configuration changes on the router via script-driven UI actions
  • Installation or modification of firewall and port forwarding rules under the admin's authority
  • Use of the router management session for further internal network reconnaissance or pivoting

General mitigation guidance

Effective mitigation centers on treating all UPnP-sourced metadata as untrusted and ensuring it cannot be rendered as active content.

Common defensive patterns include:

  • Applying strict, context-aware output encoding for any user- or device-supplied text before inserting it into HTML templates (e.g., escaping <, >, ", ', and & in text and attribute contexts).
  • Constraining allowed description fields to a safe character set and length, rejecting or normalizing unexpected markup-like input.
  • Isolating dynamic content using safe templating engines that encode output by default, instead of building HTML via string concatenation.
  • Applying least-privilege principles in the web interface so that actions triggered from a single page have limited scope where practical.
  • Optionally segregating or disabling UPnP features in environments where untrusted LAN clients exist, to reduce exposure of the management plane to arbitrary metadata.

How teams detect issues like this

Organizations can detect and monitor for this class of issue through:

  • Static analysis rules or linters that flag direct insertion of external data into HTML responses without passing through encoding or templating helpers.
  • Code review checklists that explicitly call out XSS risks when handling UPnP fields, query parameters, or configuration descriptions displayed in the UI.
  • Security testing that exercises UPnP AddPortMapping requests with benign HTML/JavaScript markers and verifies whether they appear unescaped in rendered pages.
  • Periodic content inspection of stored port mapping descriptions for suspicious markup patterns indicative of attempted XSS payloads.

Sources

SourceLink
github.comgithub.com/openwrt/luci/security/advisories/GHSA-8v49-6387-7f89
vulncheck.comvulncheck.com/advisories/luci-app-upnp-stored-xss-via-upnp-port-mapping-description

Frequently asked

questions

Typically, direct exploitation is limited to the internal network because it relies on sending UPnP AddPortMapping requests from a LAN client and then having an administrator open the router's web UI. However, if an attacker can cause a device on the LAN to send such UPnP traffic (for example via malware or drive-by downloads), they may still leverage this issue indirectly.

The attacker needs the capability to send UPnP SOAP AddPortMapping requests from a LAN-accessible device to the router running miniupnpd and luci-app-upnp. They do not need web UI credentials; exploitation completes when an authenticated administrator later views the affected pages.

The most robust fix pattern is to ensure all externally sourced text, including UPnP descriptions, is passed through context-appropriate output encoding routines before it is inserted into HTML, attributes, or scripts. Complement this with server-side validation that rejects or normalizes inputs containing markup-like constructs.

Adopt a secure-by-default templating approach where encoding is automatic, maintain coding standards that forbid raw HTML concatenation with untrusted data, and integrate automated security testing (static analysis and targeted dynamic tests) into the development pipeline. Regular security-focused code reviews for management interfaces and any feature that surfaces device- or user-provided metadata further reduces the chance of introducing new XSS flaws.

Find out what's already
exploitable in your codebase.