Tridge writes: SAMR password change can carry a mapped username into unix password sync; passwd program expands %u with plain talloc_string_sub() and executes /bin/sh -c as root. - source3/rpc_server/samr/srv_samr_chgpasswd.c:249-260 - source3/rpc_server/samr/srv_samr_chgpasswd.c:599-626 - source3/rpc_server/samr/srv_samr_chgpasswd.c:1167-1270 - source3/rpc_server/samr/srv_samr_nt.c:1893-2101 - Attacker role: Remote SAMR password-change caller for an account whose passdb/Unix username contains shell-sensitive syntax, or an actor able to create/map such an account. - Entrypoint: SAMR ChangePasswordUser2, OemChangePasswordUser2, or ChangePasswordUser3. - Trust boundary: Remote account names and passdb usernames cross into a root Unix password-sync shell command. Attacker outcome: SAMR password change can carry a mapped username into unix password sync; passwd program expands %u with plain talloc_string_sub() and executes /bin/sh -c as root. #### Severity Final severity is **high**. This breaks a privileged integrity, authorization, filesystem, or remote daemon boundary with a concrete sink in repository code. #### Remediation Apply the check_password_script unsafe-character validation/masking to passwd program %u, reject unsafe account names before password sync, and avoid root shell command construction for password changes. Add regression coverage that exercises the attacker-controlled input at the listed entry point and asserts the validation, authorization, containment, or size check occurs before the dangerous sink. | Severity | high | | Confidence | high |
This is the SAMR password change RCE variant that depends on the *unix* username containing shell metacharacters.
The affected code does not appear to be tested.
Created attachment 19136 [details] proposed patch for master Not tested because we have no tests for ‘unix password sync’.
(In reply to Douglas Bagnall from comment #1) I think we can disqualify this as a security bug. Certainly should be fixed, but if your unix usernames contain shell meta-characters, there are bigger issues.
[Bulk message on a number of bugs being made public at once] The embargo is being removed from this bug. That is not to say that the issue is not a real bug, but some things are better dealt with in public, where the normal process is both more available to external contributors and much, much more efficient. If you have a patch for this issue, please do contribute it via our normal GitLab process: https://wiki.samba.org/index.php/Contribute#Submitting_Patches_via_GitLab All patches to Samba must follow our copyright policy: https://www.samba.org/samba/devel/copyright-policy.html Thanks to all who report issues to Samba, we value your patience as we, along with the rest of the Open Source and Free Software communities, work though the reported issues.