Skip to content

Commit a97f313

Browse files
committed
Sync with 2.48.2
* maint-2.48: Git 2.48.2 Git 2.47.3 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]> Signed-off-by: Junio C Hamano <[email protected]>
2 parents d50a5e8 + fbae1f0 commit a97f313

33 files changed

+738
-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.

Documentation/RelNotes/2.47.3.txt

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

Documentation/RelNotes/2.48.2.txt

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

bundle-uri.c

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

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

config.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2941,7 +2941,7 @@ static ssize_t write_pair(int fd, const char *key, const char *value,
29412941
if (value[0] == ' ')
29422942
quote = "\"";
29432943
for (i = 0; value[i]; i++)
2944-
if (value[i] == ';' || value[i] == '#')
2944+
if (value[i] == ';' || value[i] == '#' || value[i] == '\r')
29452945
quote = "\"";
29462946
if (i && value[i - 1] == ' ')
29472947
quote = "\"";

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

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

42+
static void target_append(const WCHAR *src)
43+
{
44+
size_t avail = ARRAY_SIZE(target) - wcslen(target) - 1; /* -1 for NUL */
45+
if (avail < wcslen(src))
46+
die("target buffer overflow");
47+
wcsncat(target, src, avail);
48+
}
49+
4250
static void write_item(const char *what, LPCWSTR wbuf, int wlen)
4351
{
4452
char *buf;
@@ -330,17 +338,17 @@ int main(int argc, char *argv[])
330338

331339
/* prepare 'target', the unique key for the credential */
332340
wcscpy(target, L"git:");
333-
wcsncat(target, protocol, ARRAY_SIZE(target));
334-
wcsncat(target, L"://", ARRAY_SIZE(target));
341+
target_append(protocol);
342+
target_append(L"://");
335343
if (wusername) {
336-
wcsncat(target, wusername, ARRAY_SIZE(target));
337-
wcsncat(target, L"@", ARRAY_SIZE(target));
344+
target_append(wusername);
345+
target_append(L"@");
338346
}
339347
if (host)
340-
wcsncat(target, host, ARRAY_SIZE(target));
348+
target_append(host);
341349
if (path) {
342-
wcsncat(target, L"/", ARRAY_SIZE(target));
343-
wcsncat(target, path, ARRAY_SIZE(target));
350+
target_append(L"/");
351+
target_append(path);
344352
}
345353

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

0 commit comments

Comments
 (0)