Skip to content

Commit 6a6229b

Browse files
committed
fix(launcher): accept a trusted privileged owner on elevated installs
The launcher validated its own binary, staged payload, and their directories with a strict "owner must be the exact token user" check (launcher_security_is_private -> launcher_security_is_safe with require_current_owner=true). On an elevated or managed install -- Program Files, an admin-run installer, and GitHub's Windows runners -- the default owner of newly created objects is BUILTIN\Administrators, not the calling user, so the launcher rejected its own legitimately privileged-owned files with "launcher ownership or access policy is unsafe [owner is not the current user: S-1-5-32-544]" and refused to start. Widen the owner check to the trusted-owner set that launcher_sid_is_trusted already defines (self, SYSTEM, Administrators, TrustedInstaller) -- the same set the daemon side applies for the identical default-owner reason. DACL strictness is unchanged: every allow ACE must still grant only a trusted identity, so tamper resistance is preserved; only the owner field is widened to the privileged identities that manage the install. A less-privileged attacker cannot stamp any of those owners without already holding that privilege, so no real attack surface is added. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent fb54f54 commit 6a6229b

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

‎src/launcher/windows_launcher.c‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,22 @@ static DWORD launcher_private_mutation_rights(void) {
315315
DELETE | WRITE_DAC | WRITE_OWNER | ACCESS_SYSTEM_SECURITY;
316316
}
317317

318-
static bool launcher_security_is_private(HANDLE file) {
319-
return launcher_security_is_safe(file, true, launcher_private_mutation_rights());
318+
static bool launcher_security_is_trusted(HANDLE file) {
319+
/* The launcher validates its own binary, staged payloads, and their
320+
* directories. On an elevated or managed install (Program Files, an
321+
* admin-run installer, GitHub's Windows runners) the default owner of
322+
* newly created objects is BUILTIN\Administrators, not the exact token
323+
* user, so demanding the current user as owner rejects the launcher's
324+
* own legitimately privileged-owned files. Accept the trusted-owner set
325+
* (self, SYSTEM, Administrators, TrustedInstaller) that
326+
* launcher_sid_is_trusted already defines and that the daemon side
327+
* applies for the identical reason (see src/daemon/ipc.c owner policy):
328+
* a less-privileged attacker cannot stamp any of those owners without
329+
* already holding that privilege. DACL strictness is unchanged -- every
330+
* allow ACE must still grant only a trusted identity -- so tamper
331+
* resistance is preserved; only the owner field is widened to the
332+
* privileged identities that manage the install. */
333+
return launcher_security_is_safe(file, false, launcher_private_mutation_rights());
320334
}
321335

322336
static HANDLE launcher_open_regular(const wchar_t *path, DWORD access, bool require_private) {
@@ -326,7 +340,7 @@ static HANDLE launcher_open_regular(const wchar_t *path, DWORD access, bool requ
326340
FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
327341
BY_HANDLE_FILE_INFORMATION information;
328342
if (!launcher_file_information(file, &information) ||
329-
(require_private && !launcher_security_is_private(file))) {
343+
(require_private && !launcher_security_is_trusted(file))) {
330344
if (file != INVALID_HANDLE_VALUE)
331345
(void)CloseHandle(file);
332346
return INVALID_HANDLE_VALUE;
@@ -344,7 +358,7 @@ static HANDLE launcher_open_directory_private(const wchar_t *path) {
344358
GetFileInformationByHandle(directory, &information) != 0 &&
345359
(information.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0 &&
346360
(information.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) == 0 &&
347-
launcher_security_is_private(directory);
361+
launcher_security_is_trusted(directory);
348362
if (!valid) {
349363
if (directory != INVALID_HANDLE_VALUE)
350364
(void)CloseHandle(directory);

0 commit comments

Comments
 (0)