/

CVE-2026-58390

Severity:

HIGH RISK

(8.0)

Stored XSS (CWE-79) in OPNsense OpenVPN Dashboard Widget

CVE-2026-58390

Deferred

Vulnerability type

Category:

Stored Cross-Site Scripting

CWE:

CWE-79

Impact:

Administrator session compromise and potential privilege escalation

Severity:

HIGH RISK

(8.0)

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

A stored cross-site scripting vulnerability in OPNsense allows a crafted OpenVPN client common name to inject script into administrator-facing connection-status pages. If an authenticated client can provision a backend username containing a double quote, the script may execute in an administrator's session when the affected dashboard or status view is opened.

A stored cross-site scripting vulnerability in OPNsense allows a crafted OpenVPN client common name to inject script into administrator-facing connection-status pages. If an authenticated client can provision a backend username containing a double quote, the script may execute in an administrator's session when the affected dashboard or status view is opened.

Affected context

The issue can occur in OPNsense deployments that use an OpenVPN server with username-as-common-name and RADIUS or LDAP authentication. It requires a trusted identity backend to accept a username containing a double quote and an administrator to view the OpenVPN client dashboard or connection-status page. Local usernames may be protected by stricter validation, so the exposure depends on the configured authentication and provisioning paths.

The issue can occur in OPNsense deployments that use an OpenVPN server with username-as-common-name and RADIUS or LDAP authentication. It requires a trusted identity backend to accept a username containing a double quote and an administrator to view the OpenVPN client dashboard or connection-status page. Local usernames may be protected by stricter validation, so the exposure depends on the configured authentication and provisioning paths.

Exploit preconditions

  • Attack surface: Administrator-facing OpenVPN dashboard and connection-status views
  • Required access: An authenticated OpenVPN client account, plus the ability to provision or self-register a backend username containing a double quote
  • Trigger point: Rendering the client common name in a data-common-name HTML attribute, followed by the administrator opening the relevant page and triggering the injected event
  • Why exploitation is possible: The common name is inserted without quote-safe HTML encoding, allowing attacker-controlled input to terminate the attribute and introduce script-capable markup
  • Attack surface: Administrator-facing OpenVPN dashboard and connection-status views
  • Required access: An authenticated OpenVPN client account, plus the ability to provision or self-register a backend username containing a double quote
  • Trigger point: Rendering the client common name in a data-common-name HTML attribute, followed by the administrator opening the relevant page and triggering the injected event
  • Why exploitation is possible: The common name is inserted without quote-safe HTML encoding, allowing attacker-controlled input to terminate the attribute and introduce script-capable markup

Why this happens

The underlying bug is context-inappropriate output encoding. An attacker- controlled OpenVPN client common name is placed into an HTML attribute without escaping characters that have structural meaning in that context. This permits attribute injection and event-handler execution, mapping to CWE-79, Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

The underlying bug is context-inappropriate output encoding. An attacker- controlled OpenVPN client common name is placed into an HTML attribute without escaping characters that have structural meaning in that context. This permits attribute injection and event-handler execution, mapping to CWE-79, Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

Potential impact

  • An attacker may execute script in an administrator's browser session
  • The script could read sensitive firewall configuration data
  • An attacker could invoke privileged administrative APIs
  • The root account password could be reset
  • The vulnerability could lead to root-level command execution
  • Firewall configuration, routing, or authentication settings could be altered
  • An attacker may execute script in an administrator's browser session
  • The script could read sensitive firewall configuration data
  • An attacker could invoke privileged administrative APIs
  • The root account password could be reset
  • The vulnerability could lead to root-level command execution
  • Firewall configuration, routing, or authentication settings could be altered

General mitigation guidance

Mitigation generally focuses on treating identity attributes as untrusted

display data and applying context-specific output encoding.

Common defensive patterns include:

  • HTML-attribute-encode all externally sourced values before inserting them into markup
  • Prefer DOM APIs that assign text or safely encoded attribute values rather than concatenating HTML
  • Validate backend usernames against a conservative, documented character policy where operationally appropriate
  • Apply server-side validation in addition to client-side checks
  • Use a restrictive Content Security Policy to reduce the impact of injected event handlers
  • Limit administrator session privileges and require reauthentication for sensitive operations
  • Avoid exposing high-impact administrative APIs to ordinary browser contexts when possible

Mitigation generally focuses on treating identity attributes as untrusted

display data and applying context-specific output encoding.

Common defensive patterns include:

  • HTML-attribute-encode all externally sourced values before inserting them into markup
  • Prefer DOM APIs that assign text or safely encoded attribute values rather than concatenating HTML
  • Validate backend usernames against a conservative, documented character policy where operationally appropriate
  • Apply server-side validation in addition to client-side checks
  • Use a restrictive Content Security Policy to reduce the impact of injected event handlers
  • Limit administrator session privileges and require reauthentication for sensitive operations
  • Avoid exposing high-impact administrative APIs to ordinary browser contexts when possible

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings involving string concatenation into HTML attributes
  • Code-review signals such as unescaped identity, username, common-name, or directory attributes in templates and JavaScript
  • Tests that render quotes, angle brackets, and event-handler characters in externally controlled display fields
  • Dynamic application-security tests covering dashboard and status pages with provisioned directory identities
  • Content Security Policy reports and browser telemetry indicating unexpected inline handlers or script execution
  • Policy enforcement requiring context-aware output encoding and centralized rendering helpers

Automated code-review and SAST tools may help identify unsafe HTML construction, but findings should be validated against the actual browser output context.

Organizations can look for:

  • Static-analysis findings involving string concatenation into HTML attributes
  • Code-review signals such as unescaped identity, username, common-name, or directory attributes in templates and JavaScript
  • Tests that render quotes, angle brackets, and event-handler characters in externally controlled display fields
  • Dynamic application-security tests covering dashboard and status pages with provisioned directory identities
  • Content Security Policy reports and browser telemetry indicating unexpected inline handlers or script execution
  • Policy enforcement requiring context-aware output encoding and centralized rendering helpers

Automated code-review and SAST tools may help identify unsafe HTML construction, but findings should be validated against the actual browser output context.

Sources

SourceLink
github.comgithub.com/opnsense/core/commit/11180daf579879d84d91a7fbea7a59320bc80868
github.comgithub.com/opnsense/core/commit/e7b2ac8093f804bef8eb88dfa9a0d99fad00c12b
github.comgithub.com/opnsense/core/security/advisories/GHSA-26cj-h9rj-g5pf

Frequently asked

questions

It can be exploitable by an authenticated OpenVPN client when the deployment

permits a backend username containing a double quote and an administrator

later opens the affected page. It is not an unauthenticated, arbitrary

internet-wide attack in the described configuration.

No administrative access is required to create the malicious client identity,

but the attacker needs valid client authentication and a provisioning path

accepted by the configured RADIUS or LDAP backend. The impact depends on an

administrator viewing the affected content.

Encode every untrusted value for its exact output context, especially when

placing values in HTML attributes, and avoid constructing markup through

string concatenation. Strict validation and a restrictive Content Security

Policy provide additional defense in depth.

Treat usernames and directory attributes as untrusted data, use centralized

context-aware output-encoding utilities, test special characters in all

administrator-facing views, and apply least privilege to administrative

sessions and APIs.

It can be exploitable by an authenticated OpenVPN client when the deployment

permits a backend username containing a double quote and an administrator

later opens the affected page. It is not an unauthenticated, arbitrary

internet-wide attack in the described configuration.

No administrative access is required to create the malicious client identity,

but the attacker needs valid client authentication and a provisioning path

accepted by the configured RADIUS or LDAP backend. The impact depends on an

administrator viewing the affected content.

Encode every untrusted value for its exact output context, especially when

placing values in HTML attributes, and avoid constructing markup through

string concatenation. Strict validation and a restrictive Content Security

Policy provide additional defense in depth.

Treat usernames and directory attributes as untrusted data, use centralized

context-aware output-encoding utilities, test special characters in all

administrator-facing views, and apply least privilege to administrative

sessions and APIs.

Find out what's already
exploitable in your codebase.