]> git.ipfire.org Git - thirdparty/git.git/commit
gitk(Windows): avoid inadvertently calling executables in the worktree
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Thu, 19 Jan 2023 12:40:31 +0000 (13:40 +0100)
committerJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 11 Jan 2025 17:17:42 +0000 (18:17 +0100)
commit4cbe9e0e21fca682d78980a03184071e9fe1c955
treeeb8b5e8c4b362e4f57c42c9dc4487d952cdfa3bf
parente76b53ef23871ff81ab305822eb605baf0cc5bd3
gitk(Windows): avoid inadvertently calling executables in the worktree

Just like CVE-2022-41953 for Git GUI, there exists a vulnerability of
`gitk` where it looks for `taskkill.exe` in the current directory before
searching `PATH`.

Note that the many `exec git` calls are unaffected, due to an obscure
quirk in Tcl's `exec` function. Typically, `git.exe` lives next to
`wish.exe` (i.e. the program that is run to execute `gitk` or Git GUI)
in Git for Windows, and that is the saving grace for `git.exe because
`exec` searches the directory where `wish.exe` lives even before the
current directory, according to
https://www.tcl-lang.org/man/tcl/TclCmd/exec.htm#M24:

If a directory name was not specified as part of the application
name, the following directories are automatically searched in
order when attempting to locate the application:

    The directory from which the Tcl executable was loaded.

    The current directory.

    The Windows 32-bit system directory.

    The Windows home directory.

    The directories listed in the path.

The same is not true, however, for `taskkill.exe`: it lives in the
Windows system directory (never mind the 32-bit, Tcl's documentation is
outdated on that point, it really means `C:\Windows\system32`).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
gitk