Skip to content

CVE-2026-119409: OPNsense Firewall & Routing Platform Root Command Injection via Firmware Mirror Setting

Density:
C-Level Executive Briefing CVE-2026-119409 CRITICAL SCORE 94/100

Critical network perimeter vulnerability weaponized and cataloged by VulnCheck on October 31, 2026. Designated CVE-2026-119409, the flaw exists within the firmware configuration module of OPNsense core in all versions prior to 26.7.8. When administrators update the firmware mirror repository setting through the REST API (/api/core/firmware/set/) or web interface, the supplied mirror string is passed directly into underlying FreeBSD shell commands invoked by opnsense-update and pkg without sufficient parameter escaping. An authenticated attacker with administrative privileges, or an external adversary leveraging cross-site request forgery (CSRF) or exposed API tokens, can inject arbitrary shell metacharacters to execute commands with root privileges directly on the perimeter firewall appliance.

HYBRID

HERMES THREAT SCORE & PERIMETER FIREWALL ROOT COMPROMISE EVALUATION

Target: OPNsense Core Firmware Management API & FreeBSD System Command Dispatcher
Confidence: 98%
94 / 100
CRITICAL

Measures real-world operational relevance, exploit weaponization, and active threat posture.

Dimension Breakdown
Exploitability 18 / 20
Threat Activity 18 / 20
Weaponization 20 / 20
Exposure 19 / 20
Prevalence 18 / 20
Impact 20 / 20
Exploit Maturity 20 / 20
Attack Chain Potential 20 / 20

1. Vulnerability Overview & OS Command Injection Mechanics

Section titled โ€œ1. Vulnerability Overview & OS Command Injection Mechanicsโ€

OPNsense is an open-source, FreeBSD-based firewall and routing platform widely deployed across enterprise perimeter gateways, cloud virtual appliances, and branch offices. Administrators manage firmware updates, plugin repositories, and mirror mirrors via the web interface or REST API.

flowchart TD
A["Attacker (Authenticated Admin, API Token, or via CSRF Chain)"] -->|"1. POST /api/core/firmware/set/ with crafted mirror setting"| B["OPNsense Web GUI / MVC API Controller"]
B -->|"2. FirmwareController parses 'firmware.mirror' parameter"| C["No Shell Escaping or Regex Validation on Mirror URL"]
C -->|"3. Concatenates string into shell command line"| D["mwexec('/usr/local/sbin/opnsense-update -m ' . $mirror)"]
D -->|"4. FreeBSD Shell evaluates command substitution: $(payload)"| E["Arbitrary Command Execution as root (uid=0)"]
E -->|"5. Extracts IPsec/WireGuard private keys & alters pf rules"| F["Full Network Traffic Eavesdropping & Perimeter Compromise"]

In vulnerable OPNsense core versions (< 26.7.8), the firmware controller handling mirror updates located at src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php accepts user input for firmware.mirror and persists it to the XML configuration (config.xml). During repository validation or synchronization, the backend calls helper scripts via shell wrapper functions (mwexec() or shell_exec()):

// Vulnerable firmware mirror synchronization pattern in OPNsense
public function setAction()
{
if ($this->request->isPost()) {
$mdlFirmware = new Firmware();
$mdlFirmware->setNodes($this->request->getPost('firmware'));
// Parameter extracted without sanitization
$mirror = (string)$mdlFirmware->mirror;
// VULNERABILITY: Direct concatenation into shell command string!
// An attacker supplying 'https://valid.mirror/$(id > /tmp/pwned)' triggers command execution
$cmd = "/usr/local/opnsense/scripts/firmware/check.sh -m " . $mirror;
$output = shell_exec($cmd);
return ["status" => "ok", "output" => $output];
}
}

Because FreeBSDโ€™s /bin/sh interprets backticks and $(...) command substitutions prior to executing the target binary, any command embedded within the mirror string executes immediately with the permissions of the calling processโ€”which runs as root (UID 0) to allow low-level package and kernel updates.


Adversaries weaponize CVE-2026-119409 through multiple strategic vectors:

  1. API Token Compromise & Lateral Movement: Attackers who compromise backup configurations, Ansible playbooks, or developer credentials containing an OPNsense API key and secret directly issue a POST request to /api/core/firmware/set/, instantly popping an interactive root shell on the perimeter device.
  2. Cross-Site Request Forgery (CSRF) Pivoting: An adversary who entices an authenticated OPNsense network administrator into clicking a malicious link from an internal workstation can trigger background POST requests if CSRF protections are relaxed or bypassed via sub-domain cookie injection.
  3. Firmware Backdooring & Traffic Interception: Root access enables the attacker to modify /etc/pf.conf directly, mirror internal traffic to an offsite listening post, or dump WireGuard/IPsec cryptographic keys from kernel memory.

Security teams should audit OPNsense system logs (/var/log/system.log), web server access records, and FreeBSD process creation.

title: OPNsense Firmware Mirror Root Command Injection Attempt
id: 8d29a1b0-4f3e-4d12-98aa-cve2026119409
status: critical
description: Detects command injection attempts targeting the OPNsense firmware mirror configuration API or shell executions originating from firmware update scripts.
references:
- https://vulncheck.com/advisories/opnsense-before-26.7.8-root-command-injection-via-firmware-mirror-setting
- https://opnsense.org/about/security-announcements/
author: Hermes Codex Cyber Defense Team
date: 2026-10-31
logsource:
category: webserver
product: opnsense
detection:
selection_api:
cs-method: 'POST'
cs-uri-stem: '/api/core/firmware/set'
cs-body|contains:
- '$('
- '`'
- ';'
- '|'
- '&'
selection_shell:
ParentImage|endswith: '/check.sh'
Image|endswith:
- '/sh'
- '/curl'
- '/fetch'
- '/nc'
condition: selection_api or selection_shell
falsepositives:
- Legitimate custom mirror URLs containing URL-encoded characters (inspect payload closely)
level: critical
tags:
- attack.execution
- attack.t1059.004
- attack.t1190

  1. Apply OPNsense 26.7.8 Hotfix: Update OPNsense core immediately to version 26.7.8. The patch replaces raw shell concatenation with escapeshellarg() and enforces strict URL schema validation on custom mirror inputs.
  2. Audit Configuration XML: Review /conf/config.xml under <system><firmware><mirror> to verify no unauthorized mirror URLs or embedded command strings are present.
  3. Restrict Management Access: Ensure the OPNsense Web GUI and REST API endpoints are bound exclusively to dedicated internal management interfaces (LAN/MGMT) and strictly prohibited on WAN interfaces.
  4. Rotate VPN Keys and API Secrets: In the event of confirmed or suspected exploitation, immediately rotate all WireGuard, IPsec, and OpenVPN private keys, as well as administrator passwords and API keys.