Skip to content

Commit e317708

Browse files
committed
diag(daemon): print the raw SID of an untrusted DACL grant
The guards cache-dir rejection classified the offending ACE as an untrusted "other" identity - a specific account, not a well-known group - which a class label alone can't pin down. Print the SID in string form (ConvertSidToStringSidW) so the exact account behind the harness/profile ACL leak is named. mingw-verified. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 30b5f12 commit e317708

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

‎src/daemon/ipc.c‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3248,6 +3248,7 @@ bool cbm_daemon_ipc_local_transition_release(cbm_daemon_ipc_local_transition_t *
32483248
#endif
32493249
#include <windows.h>
32503250
#include <aclapi.h>
3251+
#include <sddl.h>
32513252
#include <fcntl.h>
32523253
#include <io.h>
32533254
#include <shlobj.h>
@@ -3961,9 +3962,18 @@ static bool win_file_acl_secure(win_security_t *security, HANDLE file, DWORD mut
39613962
: security->is_well_known_sid((PSID)sid, WinWorldSid) ? "Everyone"
39623963
: security->is_well_known_sid((PSID)sid, WinInteractiveSid) ? "INTERACTIVE"
39633964
: "other";
3965+
/* Print the raw SID too: an "other" class is a specific account,
3966+
* and only its string form identifies the harness/profile leak. */
3967+
wchar_t *sid_text = NULL;
3968+
char sid_utf8[96] = "<unprintable>";
3969+
if (ConvertSidToStringSidW((PSID)sid, &sid_text) && sid_text) {
3970+
(void)WideCharToMultiByte(CP_UTF8, 0, sid_text, -1, sid_utf8, (int)sizeof(sid_utf8),
3971+
NULL, NULL);
3972+
LocalFree(sid_text);
3973+
}
39643974
ipc_validation_detail_set(
3965-
"DACL entry %lu grants mutation rights 0x%08lx to untrusted identity (%s)",
3966-
(unsigned long)index, (unsigned long)(ace->Mask & mutation), sid_class);
3975+
"DACL entry %lu grants mutation rights 0x%08lx to untrusted identity (%s %s)",
3976+
(unsigned long)index, (unsigned long)(ace->Mask & mutation), sid_class, sid_utf8);
39673977
secure = false;
39683978
}
39693979
}

0 commit comments

Comments
 (0)