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-58395 Overview
OPNsense, a FreeBSD-based firewall and routing platform, contains an XPath injection vulnerability in its safe-delete API path. The ApiMutableModelControllerBase::delBase() method interpolates an unvalidated safe-delete token from the request URL directly into an XPath expression against config.xml without first confirming the token is a valid identifier. An authenticated user holding any one of several affected module privileges can submit a crafted token to 21 delete endpoints covering Traffic Shaper, DHCP relay, Dnsmasq, Firewall Category, or Kea DHCP. The resulting error response discloses configuration item names, descriptions, reference paths, and UUIDs across modules the user cannot otherwise access.
Critical Impact
Authenticated attackers with any affected module privilege can enumerate configuration data across modules via an XPath substring-presence oracle, exposing identifiers and references from otherwise restricted modules.
Affected Products
- OPNsense core prior to version 26.1.11
- 21 delete endpoints across Traffic Shaper, DHCP relay, Dnsmasq, Firewall Category, and Kea DHCP modules
- The ApiMutableModelControllerBase::delBase() controller path
Discovery Timeline
- 2026-10-15 - CVE CVE-2026-58395 published to NVD
- 2026-10-15 - Last updated in NVD database
Technical Details for CVE-2026-58395
Vulnerability Analysis
The flaw is an XPath injection ([CWE-643]) in the OPNsense MVC base controller. When a safe-delete request reaches delBase(), the token from the URL is interpolated into an XPath expression evaluated against config.xml. Because the token is not validated against an identifier pattern before interpolation, an attacker can inject XPath syntax that matches nodes outside the caller's module. The request does not alter configuration or perform a deletion, so no state changes occur. The error response, however, reveals matched configuration item names, descriptions, reference paths, and UUIDs. This behavior effectively creates a substring-presence oracle that discloses structured configuration metadata across modules.
Root Cause
The checkAndThrowValueInUse helper built an XPath string using the user-supplied token without a prior format check. Both branches (contains(.,'{$token}') and text() = '{$token}') were vulnerable to injection via XPath metacharacters and quote-breaking sequences. The fix enforces a strict regex (/^[0-9a-z\-]{1,255}$/i) on the token before any XPath construction and throws a UserException when the token does not match.
Attack Vector
Exploitation requires network reach to the OPNsense web API and valid credentials with any one of the module privileges tied to the 21 affected delete endpoints. The attacker sends a crafted token in the URL to one of the safe-delete endpoints and parses the error response to extract leaked configuration data or perform iterative substring probing.
$exclude_refs = [],
$title = null
) {
- if ($contains) {
+ if (!preg_match('/^[0-9a-z\-]{1,255}$/i', $token)) {
+ throw new UserException(gettext('Invalid input token provided'), gettext("Invalid token"));
+ } elseif ($contains) {
$xpath = "//text()[contains(.,'{$token}')]";
} else {
$xpath = "//*[text() = '{$token}']";
Source: OPNsense core patch commit 631e147. The patch introduces input validation that restricts the token to alphanumeric characters and hyphens before any XPath construction.
Detection Methods for CVE-2026-58395
Indicators of Compromise
- Requests to OPNsense API delete endpoints containing XPath metacharacters such as single quotes, square brackets, or, and, contains(, or text() in the token segment of the URL.
- Repeated 4xx or 5xx error responses from safe-delete endpoints under modules such as Traffic Shaper, DHCP relay, Dnsmasq, Firewall Category, or Kea DHCP from the same authenticated session.
- Unusual enumeration patterns from a single low-privilege account hitting multiple module delete endpoints in a short window.
Detection Strategies
- Inspect web server access logs for URL path segments to /api/*/delete* endpoints containing non-[0-9a-z\-] characters in the token position.
- Correlate authenticated API traffic with the user's assigned module privileges and alert when a user touches delete endpoints for modules outside their normal scope.
- Track rate and diversity of safe-delete API calls per account to flag oracle-style iterative probing.
Monitoring Recommendations
- Enable verbose API audit logging on OPNsense and forward logs to a central SIEM for retention and query.
- Monitor for UserException entries referencing Invalid input token after patching, which indicate blocked exploitation attempts.
- Alert on configuration-read anomalies from accounts that normally only perform operational tasks.
How to Mitigate CVE-2026-58395
Immediate Actions Required
- Upgrade OPNsense to version 26.1.11 or later, which contains the input validation fix.
- Review and reduce module privileges granted to non-administrative users, particularly for Traffic Shaper, DHCP relay, Dnsmasq, Firewall Category, and Kea DHCP.
- Rotate credentials for any account that may have been used to probe the affected endpoints.
Patch Information
The fix is delivered in OPNsense 26.1.11. Technical details are documented in the OPNsense GitHub Security Advisory GHSA-98h6-479q-9q3w and in commits 631e147 and d7054ce. The patch adds a preg_match('/^[0-9a-z\-]{1,255}$/i', $token) guard in checkAndThrowValueInUse before any XPath interpolation.
Workarounds
- Restrict access to the OPNsense web UI and API to trusted management networks via firewall rules.
- Remove module privileges tied to the 21 affected delete endpoints from accounts that do not strictly need them until the upgrade is applied.
- Place the OPNsense management interface behind a reverse proxy or WAF that rejects URL path segments containing XPath metacharacters.
# Example: upgrade OPNsense to the patched release
opnsense-update -ub
opnsense-update -kr
configctl firmware check
configctl firmware upgrade
# Verify the installed version is 26.1.11 or later
opnsense-version
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

