/

CVE-2026-125391

Severity:

HIGH RISK

(7.2)

OS Command Injection (CWE-78) in Webmin Samba CGI Handler

CVE-2026-125391

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Root-Level Command Execution

Severity:

HIGH RISK

(7.2)

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

Webmin's Samba user-management handler may pass an unvalidated opts parameter into shell-command processing. An authenticated Samba user maintainer who can supply shell metacharacters through account options may cause commands to run with root privileges.

Affected context

The issue is reported in Webmin through version 2.670, in samba/save_euser.cgi. It can arise in Samba account creation or modification workflows when option flags are passed to backquote_logged without adequate validation or safe command handling. Exposure depends on the endpoint being available and an attacker having the required authenticated maintainer access.

Exploit preconditions

  • Attack surface: Webmin's Samba user-management interface and samba/save_euser.cgi
  • Required access: Authenticated access with permission to maintain Samba users
  • Trigger point: Account creation or modification through create_user or modify_user
  • Why exploitation is possible: The opts parameter is not adequately validated before being passed to shell-command processing, allowing shell metacharacters to affect command execution

Why this happens

The handler incorporates externally supplied account options into an OS command without safely separating data from command syntax. This is an OS command injection flaw mapped to CWE-78: Improper Neutralization of Special Elements used in an OS Command. The underlying insecure pattern is passing untrusted input to a shell-interpreted command rather than using a structured API or safely bounded arguments.

Potential impact

  • An attacker may execute arbitrary commands with root privileges
  • The Webmin host could be compromised
  • Sensitive files or service data could be accessed or modified
  • The compromised host could be used to affect connected systems

General mitigation guidance

Defensive patterns focus on preventing untrusted values from becoming shell syntax and limiting the consequences of command execution.

  • Prefer structured system APIs or process execution that avoids shell interpretation
  • Validate option values against a strict, documented allowlist and reject unexpected input
  • Keep command arguments separate from executable and shell syntax
  • Apply least-privilege execution so account-management operations do not run with broader privileges than necessary
  • Restrict access to administrative interfaces and relevant Samba management functions

How teams detect issues like this

  • Use static analysis to identify shell invocation APIs and data flows from request parameters into commands
  • Review code paths that pass account options to command-execution helpers, including backquote_logged
  • Enforce code-review policies requiring shell-free process execution or documented input validation
  • Monitor administrative activity and host process logs for unexpected commands associated with Samba account changes
  • Automated code review tools may help flag potentially unsafe command construction

Sources

SourceLink
github.comgithub.com/webmin/webmin
github.comgithub.com/webmin/webmin/blob/2.670/samba/samba-lib.pl#L658
github.comgithub.com/webmin/webmin/commit/18cab89b1fc74ab7e8b1b8b90bbccbe5aba99154
vulncheck.comvulncheck.com/advisories/webmin-through-2.670-os-command-injection-via-samba-user-account-options

Frequently asked

questions

The described attack requires authenticated access with permission to maintain Samba users and the ability to supply account option values.

No. The vulnerability may allow commands to execute as root when the affected account-management path processes the supplied options.

Avoid shell interpretation for externally influenced values. Prefer structured APIs or safely separated arguments, with strict allowlist validation as an additional control.

Review data flows into command-execution functions, enforce least privilege, and use static analysis and code-review policies to detect unsafe command construction.

Find out what's already
exploitable in your codebase.