Skip to main content
Vulnerability Database/CVE-2026-58393

CVE-2026-58393: OPNsense Path Traversal Vulnerability

CVE-2026-58393 is a path traversal flaw in OPNsense that allows authenticated users to write files outside intended directories through OpenVPN Client Specific Override. This article covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-58393 Overview

CVE-2026-58393 is a path traversal vulnerability [CWE-22] in OPNsense, a FreeBSD-based firewall and routing platform. The flaw resides in the OpenVPN Client Specific Override (CSO) feature, where the common_name field accepts path traversal sequences. The openvpn_csc_conf_write() function concatenates the attacker-controlled value into /var/etc/openvpn-csc/<vpnid>/<common_name> without normalization or a basename check. The issue affects the client_connect.php and user_pass_verify.php event handlers. OPNsense fixed the issue in version 26.1.11.

Critical Impact

An authenticated user with Client Specific Override privileges can cause OpenVPN configuration files to be written outside the intended directory when a matching client-connect or authentication event occurs.

Affected Products

  • OPNsense versions prior to 26.1.11
  • OpenVPN Client Specific Override component
  • Event handlers client_connect.php and user_pass_verify.php

Discovery Timeline

  • 2026-10-15 - CVE-2026-58393 published to NVD
  • 2026-10-15 - Last updated in NVD database

Technical Details for CVE-2026-58393

Vulnerability Analysis

The vulnerability stems from unvalidated concatenation of the common_name attribute into a filesystem path. When an OpenVPN client connects or authenticates, the OPNsense plugin writes a generated CSO configuration file using the common name as part of the target filename. Because the code did not call basename() or normalize the input, sequences such as ../ traverse the directory tree.

An authenticated administrator with Client Specific Override privileges stores a malicious common_name value through the web interface. When a matching OpenVPN event fires, OPNsense writes the generated configuration file to an attacker-chosen location on disk. The file content is restricted to generated OpenVPN directives, not arbitrary bytes, which limits downstream impact.

Practical exploitation requires the attacker to cause a matching common name or username to be processed by the OpenVPN server, raising the attack complexity.

Root Cause

The openvpn_csc_conf_write() function in src/etc/inc/plugins.inc.d/openvpn.inc built the target path with raw string concatenation. The common_name field in the OpenVPN model was declared as a permissive TextField, allowing slashes and dot sequences to flow through to filesystem operations.

Attack Vector

The attacker must hold valid credentials with permission to manage OpenVPN Client Specific Override entries. After storing a traversal payload in the common_name field, the attacker triggers a matching OpenVPN client-connect or authentication event. The resulting file write lands outside /var/etc/openvpn-csc/<vpnid>/.

text
     openvpn_add_dhcpopts($settings, $conf);
 
-    $vpnid = filter_var($server['vpnid'], FILTER_SANITIZE_NUMBER_INT);
     if (empty($target_filename)) {
-        $target_filename = "/var/etc/openvpn-csc/" . $vpnid . "/" . $settings['common_name'];
+        $vpnid = filter_var($server['vpnid'], FILTER_SANITIZE_NUMBER_INT);
+        $vpncn = basename($settings['common_name']);
+        $target_filename = "/var/etc/openvpn-csc/{$vpnid}/{$vpncn}";
     }

// Source: https://github.com/opnsense/core/commit/3af496143a19153c18b2f9458b2510d58aff2b98

The patch adds a basename() call to strip any directory components from the user-supplied common name before path concatenation.

Detection Methods for CVE-2026-58393

Indicators of Compromise

  • Unexpected files appearing outside /var/etc/openvpn-csc/<vpnid>/ containing OpenVPN configuration directives such as push, iroute, or ifconfig-push.
  • CSO entries in the OPNsense configuration where the common_name value contains /, .., or encoded traversal sequences.
  • OpenVPN event handler executions correlated with filesystem writes to directories outside the CSO tree.

Detection Strategies

  • Audit the OPNsense config.xml for any OpenVPN Client Specific Override entry whose common_name field contains path separators or .. segments.
  • Monitor web UI audit logs for CSO create or update operations performed by non-root administrative accounts.
  • Compare the file inventory of /var/etc/ against expected OpenVPN output paths and flag deviations.

Monitoring Recommendations

  • Enable OPNsense system audit logging and forward it to a central log platform for correlation with OpenVPN connection events.
  • Watch for new or modified files in filesystem locations writable by the root user that match OpenVPN configuration patterns.
  • Alert on administrative changes to OpenVPN CSO entries, particularly from accounts that do not normally manage VPN configuration.

How to Mitigate CVE-2026-58393

Immediate Actions Required

  • Upgrade OPNsense to version 26.1.11 or later, which enforces basename() on the common_name value.
  • Review existing Client Specific Override entries and remove any common_name value containing path separators or traversal sequences.
  • Restrict administrative accounts with Client Specific Override privileges to trusted operators only.

Patch Information

The fix is implemented in two commits. The first commit applies basename() to the common name before path construction and changes the model definition from TextField to StrictTextField with a mask of /[^\/]+/. See the GitHub Security Advisory GHSA-2m9v-p7r9-gfcw, the initial fix commit, and the follow-up commit.

text
-                <common_name type="TextField">
+                <common_name type="StrictTextField">
+                    <AllowSpaces>Y</AllowSpaces>
+                    <Mask>/[^\/]+/</Mask>
                     <Required>Y</Required>
                 </common_name>

// Source: https://github.com/opnsense/core/commit/3af496143a19153c18b2f9458b2510d58aff2b98

Workarounds

  • Temporarily revoke Client Specific Override management privileges from non-essential administrative accounts until the patch is applied.
  • Manually inspect and sanitize any stored common_name values to ensure they contain no / or .. characters.
  • Monitor OpenVPN event handler execution for unexpected file write locations.
bash
# Verify OPNsense version and inspect CSO common_name entries
opnsense-version
grep -A2 '<common_name>' /conf/config.xml | grep -E '\.\.|/'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.