Skip to content

Commit 65420a5

Browse files
committed
Merge tag 'v2.35.2.windows.1'
Git for Windows v2.35.2 Changes since Git for Windows v2.35.1(2) (February 1st 2022) This version addresses CVE-2022-24765 and CVE-2022-24767. New Features * Comes with Git v2.35.2. Bug Fixes * The uninstaller was hardened to avoid a vulnerability when running under the SYSTEM account, addressing CVE-2022-24767. Signed-off-by: Victoria Dye <[email protected]>
2 parents d61d20d + c26f3fb commit 65420a5

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Documentation/config/safe.txt

+6
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ line option `-c safe.directory=<path>`.
1919
The value of this setting is interpolated, i.e. `~/<path>` expands to a
2020
path relative to the home directory and `%(prefix)/<path>` expands to a
2121
path relative to Git's (runtime) prefix.
22+
+
23+
Due to the permission model on Windows where ACLs are used instead of
24+
Unix' simpler permission model, it can be a bit tricky to figure out why
25+
a directory is considered unsafe. To help with this, Git will provide
26+
more detailed information when the environment variable
27+
`GIT_TEST_DEBUG_UNSAFE_DIRECTORIES` is set to `true`.

compat/mingw.c

+31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "../git-compat-util.h"
22
#include "win32.h"
33
#include <aclapi.h>
4+
#include <sddl.h>
45
#include <conio.h>
56
#include <wchar.h>
67
#include <winioctl.h>
@@ -3513,6 +3514,7 @@ int is_path_owned_by_current_sid(const char *path)
35133514
else if (sid && IsValidSid(sid)) {
35143515
/* Now, verify that the SID matches the current user's */
35153516
static PSID current_user_sid;
3517+
BOOL is_member;
35163518

35173519
if (!current_user_sid)
35183520
current_user_sid = get_current_user_sid();
@@ -3521,6 +3523,35 @@ int is_path_owned_by_current_sid(const char *path)
35213523
IsValidSid(current_user_sid) &&
35223524
EqualSid(sid, current_user_sid))
35233525
result = 1;
3526+
else if (IsWellKnownSid(sid, WinBuiltinAdministratorsSid) &&
3527+
CheckTokenMembership(NULL, sid, &is_member) &&
3528+
is_member)
3529+
/*
3530+
* If owned by the Administrators group, and the
3531+
* current user is an administrator, we consider that
3532+
* okay, too.
3533+
*/
3534+
result = 1;
3535+
else if (git_env_bool("GIT_TEST_DEBUG_UNSAFE_DIRECTORIES", 0)) {
3536+
LPSTR str1, str2, to_free1 = NULL, to_free2 = NULL;
3537+
3538+
if (ConvertSidToStringSidA(sid, &str1))
3539+
to_free1 = str1;
3540+
else
3541+
str1 = "(inconvertible)";
3542+
3543+
if (!current_user_sid)
3544+
str2 = "(none)";
3545+
else if (!IsValidSid(current_user_sid))
3546+
str2 = "(invalid)";
3547+
else if (ConvertSidToStringSidA(current_user_sid, &str2))
3548+
to_free2 = str2;
3549+
else
3550+
str2 = "(inconvertible)";
3551+
warning("'%s' is owned by:\n\t'%s'\nbut the current user is:\n\t'%s'", path, str1, str2);
3552+
LocalFree(to_free1);
3553+
LocalFree(to_free2);
3554+
}
35243555
}
35253556

35263557
/*

0 commit comments

Comments
 (0)