Skip to content

Commit 0991bd0

Browse files
committed
Sync with 2.46.4
* maint-2.46: Git 2.46.4 Git 2.45.4 Git 2.44.4 Git 2.43.7 wincred: avoid buffer overflow in wcsncat() bundle-uri: fix arbitrary file writes via parameter injection config: quote values containing CR character git-gui: sanitize 'exec' arguments: convert new 'cygpath' calls git-gui: do not mistake command arguments as redirection operators git-gui: introduce function git_redir for git calls with redirections git-gui: pass redirections as separate argument to git_read git-gui: pass redirections as separate argument to _open_stdout_stderr git-gui: convert git_read*, git_write to be non-variadic git-gui: override exec and open only on Windows gitk: sanitize 'open' arguments: revisit recently updated 'open' calls git-gui: use git_read in githook_read git-gui: sanitize $PATH on all platforms git-gui: break out a separate function git_read_nice git-gui: assure PATH has only absolute elements. git-gui: remove option --stderr from git_read git-gui: cleanup git-bash menu item git-gui: sanitize 'exec' arguments: background git-gui: avoid auto_execok in do_windows_shortcut git-gui: sanitize 'exec' arguments: simple cases git-gui: avoid auto_execok for git-bash menu item git-gui: treat file names beginning with "|" as relative paths git-gui: remove unused proc is_shellscript git-gui: remove git config --list handling for git < 1.5.3 git-gui: remove special treatment of Windows from open_cmd_pipe git-gui: remove HEAD detachment implementation for git < 1.5.3 git-gui: use only the configured shell git-gui: remove Tcl 8.4 workaround on 2>@1 redirection git-gui: make _shellpath usable on startup git-gui: use [is_Windows], not bad _shellpath git-gui: _which, only add .exe suffix if not present gitk: encode arguments correctly with "open" gitk: sanitize 'open' arguments: command pipeline gitk: collect construction of blameargs into a single conditional gitk: sanitize 'open' arguments: simple commands, readable and writable gitk: sanitize 'open' arguments: simple commands with redirections gitk: sanitize 'open' arguments: simple commands gitk: sanitize 'exec' arguments: redirect to process gitk: sanitize 'exec' arguments: redirections and background gitk: sanitize 'exec' arguments: redirections gitk: sanitize 'exec' arguments: 'eval exec' gitk: sanitize 'exec' arguments: simple cases gitk: have callers of diffcmd supply pipe symbol when necessary gitk: treat file names beginning with "|" as relative paths Signed-off-by: Taylor Blau <[email protected]>
2 parents e1fbebe + 47d3b50 commit 0991bd0

31 files changed

+723
-450
lines changed

Documentation/RelNotes/2.43.7.txt

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
Git v2.43.7 Release Notes
2+
=========================
3+
4+
This release includes fixes for CVE-2025-27613, CVE-2025-27614,
5+
CVE-2025-46334, CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and
6+
CVE-2025-48386.
7+
8+
Fixes since v2.43.6
9+
-------------------
10+
11+
* CVE-2025-27613, Gitk:
12+
13+
When a user clones an untrusted repository and runs Gitk without
14+
additional command arguments, any writable file can be created and
15+
truncated. The option "Support per-file encoding" must have been
16+
enabled. The operation "Show origin of this line" is affected as
17+
well, regardless of the option being enabled or not.
18+
19+
* CVE-2025-27614, Gitk:
20+
21+
A Git repository can be crafted in such a way that a user who has
22+
cloned the repository can be tricked into running any script
23+
supplied by the attacker by invoking `gitk filename`, where
24+
`filename` has a particular structure.
25+
26+
* CVE-2025-46334, Git GUI (Windows only):
27+
28+
A malicious repository can ship versions of sh.exe or typical
29+
textconv filter programs such as astextplain. On Windows, path
30+
lookup can find such executables in the worktree. These programs
31+
are invoked when the user selects "Git Bash" or "Browse Files" from
32+
the menu.
33+
34+
* CVE-2025-46835, Git GUI:
35+
36+
When a user clones an untrusted repository and is tricked into
37+
editing a file located in a maliciously named directory in the
38+
repository, then Git GUI can create and overwrite any writable
39+
file.
40+
41+
* CVE-2025-48384, Git:
42+
43+
When reading a config value, Git strips any trailing carriage
44+
return and line feed (CRLF). When writing a config entry, values
45+
with a trailing CR are not quoted, causing the CR to be lost when
46+
the config is later read. When initializing a submodule, if the
47+
submodule path contains a trailing CR, the altered path is read
48+
resulting in the submodule being checked out to an incorrect
49+
location. If a symlink exists that points the altered path to the
50+
submodule hooks directory, and the submodule contains an executable
51+
post-checkout hook, the script may be unintentionally executed
52+
after checkout.
53+
54+
* CVE-2025-48385, Git:
55+
56+
When cloning a repository Git knows to optionally fetch a bundle
57+
advertised by the remote server, which allows the server-side to
58+
offload parts of the clone to a CDN. The Git client does not
59+
perform sufficient validation of the advertised bundles, which
60+
allows the remote side to perform protocol injection.
61+
62+
This protocol injection can cause the client to write the fetched
63+
bundle to a location controlled by the adversary. The fetched
64+
content is fully controlled by the server, which can in the worst
65+
case lead to arbitrary code execution.
66+
67+
* CVE-2025-48386, Git:
68+
69+
The wincred credential helper uses a static buffer (`target`) as a
70+
unique key for storing and comparing against internal storage. This
71+
credential helper does not properly bounds check the available
72+
space remaining in the buffer before appending to it with
73+
`wcsncat()`, leading to potential buffer overflows.

Documentation/RelNotes/2.44.4.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Git v2.44.4 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appears in v2.43.7 to address
5+
the following CVEs: CVE-2025-27613, CVE-2025-27614, CVE-2025-46334,
6+
CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and CVE-2025-48386.
7+
See the release notes for v2.43.7 for details.

Documentation/RelNotes/2.45.4.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Git v2.45.4 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appears in v2.43.7, and v2.44.4
5+
to address the following CVEs: CVE-2025-27613, CVE-2025-27614,
6+
CVE-2025-46334, CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and
7+
CVE-2025-48386. See the release notes for v2.43.7 for details.

Documentation/RelNotes/2.46.4.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Git v2.46.4 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appears in v2.43.7, v2.44.4, and
5+
v2.45.4 to address the following CVEs: CVE-2025-27613, CVE-2025-27614,
6+
CVE-2025-46334, CVE-2025-46835, CVE-2025-48384, CVE-2025-48385, and
7+
CVE-2025-48386. See the release notes for v2.43.7 for details.

bundle-uri.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,28 @@ static int download_https_uri_to_file(const char *file, const char *uri)
296296
struct strbuf line = STRBUF_INIT;
297297
int found_get = 0;
298298

299+
/*
300+
* The protocol we speak with git-remote-https(1) uses a space to
301+
* separate between URI and file, so the URI itself must not contain a
302+
* space. If it did, an adversary could change the location where the
303+
* downloaded file is being written to.
304+
*
305+
* Similarly, we use newlines to separate commands from one another.
306+
* Consequently, neither the URI nor the file must contain a newline or
307+
* otherwise an adversary could inject arbitrary commands.
308+
*
309+
* TODO: Restricting newlines in the target paths may break valid
310+
* usecases, even if those are a bit more on the esoteric side.
311+
* If this ever becomes a problem we should probably think about
312+
* alternatives. One alternative could be to use NUL-delimited
313+
* requests in git-remote-http(1). Another alternative could be
314+
* to use URL quoting.
315+
*/
316+
if (strpbrk(uri, " \n"))
317+
return error("bundle-uri: URI is malformed: '%s'", file);
318+
if (strchr(file, '\n'))
319+
return error("bundle-uri: filename is malformed: '%s'", file);
320+
299321
strvec_pushl(&cp.args, "git-remote-https", uri, NULL);
300322
cp.err = -1;
301323
cp.in = -1;

config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2966,7 +2966,7 @@ static ssize_t write_pair(int fd, const char *key, const char *value,
29662966
if (value[0] == ' ')
29672967
quote = "\"";
29682968
for (i = 0; value[i]; i++)
2969-
if (value[i] == ';' || value[i] == '#')
2969+
if (value[i] == ';' || value[i] == '#' || value[i] == '\r')
29702970
quote = "\"";
29712971
if (i && value[i - 1] == ' ')
29722972
quote = "\"";

contrib/credential/wincred/git-credential-wincred.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ static void *xmalloc(size_t size)
3737
static WCHAR *wusername, *password, *protocol, *host, *path, target[1024],
3838
*password_expiry_utc, *oauth_refresh_token;
3939

40+
static void target_append(const WCHAR *src)
41+
{
42+
size_t avail = ARRAY_SIZE(target) - wcslen(target) - 1; /* -1 for NUL */
43+
if (avail < wcslen(src))
44+
die("target buffer overflow");
45+
wcsncat(target, src, avail);
46+
}
47+
4048
static void write_item(const char *what, LPCWSTR wbuf, int wlen)
4149
{
4250
char *buf;
@@ -328,17 +336,17 @@ int main(int argc, char *argv[])
328336

329337
/* prepare 'target', the unique key for the credential */
330338
wcscpy(target, L"git:");
331-
wcsncat(target, protocol, ARRAY_SIZE(target));
332-
wcsncat(target, L"://", ARRAY_SIZE(target));
339+
target_append(protocol);
340+
target_append(L"://");
333341
if (wusername) {
334-
wcsncat(target, wusername, ARRAY_SIZE(target));
335-
wcsncat(target, L"@", ARRAY_SIZE(target));
342+
target_append(wusername);
343+
target_append(L"@");
336344
}
337345
if (host)
338-
wcsncat(target, host, ARRAY_SIZE(target));
346+
target_append(host);
339347
if (path) {
340-
wcsncat(target, L"/", ARRAY_SIZE(target));
341-
wcsncat(target, path, ARRAY_SIZE(target));
348+
target_append(L"/");
349+
target_append(path);
342350
}
343351

344352
if (!strcmp(argv[1], "get"))

0 commit comments

Comments
 (0)