Tridge writes: An authenticated SVCCTL caller can receive SCM/service handle rights checked with root_nt_token instead of the caller token when the RPC worker euid is root, creating a service-control authorization bypass. - source3/rpc_server/svcctl/srv_svcctl_nt.c:143-155 replaces the supplied token with get_root_nt_token() when geteuid() == sec_initial_uid(). - source3/auth/token_util.c:81-125 constructs a root token with BUILTIN Administrators membership. - source3/rpc_server/svcctl/srv_svcctl_nt.c:288-309 passes session_info->security_token from OpenSCManagerW into svcctl_access_check(). - source3/rpc_server/svcctl/srv_svcctl_nt.c:316-365 passes the caller token into the same helper for OpenServiceW. - source3/rpc_server/svcctl/srv_svcctl_nt.c:268-275 stores access_granted in the service handle state. - source3/rpc_server/rpc_handles.c:200-230 is only a generic anonymous pipe gate, not SCM/service descriptor enforcement. Remaining uncertainty: No Samba service was started to observe euid at SVCCTL dispatch. If a deployment always impersonates the connection user before these open calls, reachability would be reduced. - Attacker role: Authenticated remote SVCCTL RPC caller who is not otherwise an administrator or service-control operator. - Entry point: OpenSCManagerW/OpenServiceW receive a caller desired access mask and pass the remote session_info->security_token to svcctl_access_check(). - Trust boundary: Remote authenticated RPC identity crosses into local service-control authorization where process euid is used to substitute the token. - Exploit steps: 1. Authenticate to the svcctl RPC endpoint and request an SCM or service handle with privileged access bits. 2. Reach a server mode where svcctl_access_check() executes while geteuid() equals sec_initial_uid(). 3. svcctl_access_check() discards the caller token and replaces it with get_root_nt_token(). 4. The root token contains BUILTIN Administrators membership and is checked against the SCM/service security descriptor. 5. The inflated access_granted mask is stored in the returned SERVICE_INFO handle and later service operations rely on those bits. - Impact: Non-admin callers may obtain admin-equivalent service-control handles, enabling unauthorized service start/stop, lock, query, or configuration/security changes according to granted rights. - Likelihood: Medium: the endpoint and handle flow are repository-visible, but exploitability depends on actual RPC worker impersonation/euid behavior in deployment. Attacker outcome: An authenticated SVCCTL caller can receive SCM/service handle rights checked with root_nt_token instead of the caller token when the RPC worker euid is root, creating a service-control authorization bypass. #### Severity Final severity is **high**. This breaks a privileged integrity, authorization, filesystem, or remote daemon boundary with a concrete sink in repository code. If reachable, this changes an authenticated non-admin caller into an administrator for service-control handles, an integrity/authorization impact warranting high severity. Deployment euid uncertainty lowers priority but not final severity. Policy decision: report; final severity: high. #### Remediation Never replace the caller token based on process euid for remote SVCCTL descriptor checks; use session_info->security_token consistently and reserve root/system contexts only for local descriptor retrieval. 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 | medium | | Confidence rationale | Source evidence supports the issue, but no Samba service was started to observe euid at SVCCTL dispatch. |
I am not sure this report is particularly helpful without concrete steps to reproduce the exploit. (More than just “reach a server mode where svcctl_access_check() executes while geteuid() equals sec_initial_uid().”)
I'm pretty sure this is all by design. The original Samba design was around Unix UID values, and if you have an account that is set up to map to root (via our various ways of doing that) we wanted that to be the overriding check. Then later we added in the NT access checks, but didn't want to break 'admin users'. See bug 16112 for the pattern, we would act as the user, and then might also act as root if an NT check was passed. The source3/rpc_server code was always expecting to run as the connecting user, just like is done for file server operations, with exceptions to become root when needed. We had to add in special code in the pdb_ldap case for example, so that LDAP access would fail just as access to passdb.tdb/smbpasswd would fail. Finally, thankfully Volker disabled the control of unix services in services/svc_rcinit.c, the only actually working control I could find was for printing. I'm going to put this as a 'Non-security bugs on their way out', and someone can change it back if they want.
[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.