Impact
In Git for Windows, no localized messages are shipped with the installer. As a consequence, Git is expected not to localize messages at all, and skips the gettext initialization.
However, due to the change in msys2/MINGW-packages#10461, the gettext()
function's implicit initialization no longer uses the runtime prefix but uses the hard-coded path C:\mingw64\share\locale
to look for localized messages.
And since any authenticated user has the permission to create folders in C:\
(and since C:\mingw64
does not typically exist), it is possible for low-privilege users to place fake messages in that location where git.exe
will pick them up.
This vulnerability is relatively hard to exploit and requires a lot of social engineering. For example, a
legitimate message at the end of a clone could be maliciously modified to ask the user to direct their web browser to a malicious website, and the user might think that the message comes from Git and is legitimate. It does require local write access by the attacker, though, which makes this attack vector less likely.
Patches
The problem has been patched in Git for Windows v2.40.1.
Workarounds
Do not work on a Windows machine with shared accounts, or alternatively create a C:\mingw64
folder and leave it empty. If you have administrative rights, remove the permission to create folders in C:\
.
References
Impact
In Git for Windows, no localized messages are shipped with the installer. As a consequence, Git is expected not to localize messages at all, and skips the gettext initialization.
However, due to the change in msys2/MINGW-packages#10461, the
gettext()
function's implicit initialization no longer uses the runtime prefix but uses the hard-coded pathC:\mingw64\share\locale
to look for localized messages.And since any authenticated user has the permission to create folders in
C:\
(and sinceC:\mingw64
does not typically exist), it is possible for low-privilege users to place fake messages in that location wheregit.exe
will pick them up.This vulnerability is relatively hard to exploit and requires a lot of social engineering. For example, a
legitimate message at the end of a clone could be maliciously modified to ask the user to direct their web browser to a malicious website, and the user might think that the message comes from Git and is legitimate. It does require local write access by the attacker, though, which makes this attack vector less likely.
Patches
The problem has been patched in Git for Windows v2.40.1.
Workarounds
Do not work on a Windows machine with shared accounts, or alternatively create a
C:\mingw64
folder and leave it empty. If you have administrative rights, remove the permission to create folders inC:\
.References