Skip to content

Commit f2771ef

Browse files
committed
Git 2.23.3
This merges up the security fix from v2.17.5. Signed-off-by: Jonathan Nieder <[email protected]>
2 parents 17a0278 + c9808fa commit f2771ef

15 files changed

+489
-42
lines changed

Documentation/RelNotes/2.17.5.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Git v2.17.5 Release Notes
2+
=========================
3+
4+
This release is to address a security issue: CVE-2020-11008
5+
6+
Fixes since v2.17.4
7+
-------------------
8+
9+
* With a crafted URL that contains a newline or empty host, or lacks
10+
a scheme, the credential helper machinery can be fooled into
11+
providing credential information that is not appropriate for the
12+
protocol in use and host being contacted.
13+
14+
Unlike the vulnerability CVE-2020-5260 fixed in v2.17.4, the
15+
credentials are not for a host of the attacker's choosing; instead,
16+
they are for some unspecified host (based on how the configured
17+
credential helper handles an absent "host" parameter).
18+
19+
The attack has been made impossible by refusing to work with
20+
under-specified credential patterns.
21+
22+
Credit for finding the vulnerability goes to Carlo Arenas.

Documentation/RelNotes/2.18.4.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.18.4 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.5; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.19.5.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.19.5 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.5; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.20.4.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.20.4 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.5; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.21.3.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.21.3 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.5; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.22.4.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.22.4 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.5; see
5+
the release notes for that version for details.

Documentation/RelNotes/2.23.3.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Git v2.23.3 Release Notes
2+
=========================
3+
4+
This release merges the security fix that appears in v2.17.5; see
5+
the release notes for that version for details.

GIT-VERSION-GEN

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
GVF=GIT-VERSION-FILE
4-
DEF_VER=v2.23.2
4+
DEF_VER=v2.23.3
55

66
LF='
77
'

RelNotes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Documentation/RelNotes/2.23.2.txt
1+
Documentation/RelNotes/2.23.3.txt

credential.c

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ static int proto_is_http(const char *s)
8989

9090
static void credential_apply_config(struct credential *c)
9191
{
92+
if (!c->host)
93+
die(_("refusing to work with credential missing host field"));
94+
if (!c->protocol)
95+
die(_("refusing to work with credential missing protocol field"));
96+
9297
if (c->configured)
9398
return;
9499
git_config(credential_config_callback, c);
@@ -191,8 +196,11 @@ int credential_read(struct credential *c, FILE *fp)
191196
return 0;
192197
}
193198

194-
static void credential_write_item(FILE *fp, const char *key, const char *value)
199+
static void credential_write_item(FILE *fp, const char *key, const char *value,
200+
int required)
195201
{
202+
if (!value && required)
203+
BUG("credential value for %s is missing", key);
196204
if (!value)
197205
return;
198206
if (strchr(value, '\n'))
@@ -202,11 +210,11 @@ static void credential_write_item(FILE *fp, const char *key, const char *value)
202210

203211
void credential_write(const struct credential *c, FILE *fp)
204212
{
205-
credential_write_item(fp, "protocol", c->protocol);
206-
credential_write_item(fp, "host", c->host);
207-
credential_write_item(fp, "path", c->path);
208-
credential_write_item(fp, "username", c->username);
209-
credential_write_item(fp, "password", c->password);
213+
credential_write_item(fp, "protocol", c->protocol, 1);
214+
credential_write_item(fp, "host", c->host, 1);
215+
credential_write_item(fp, "path", c->path, 0);
216+
credential_write_item(fp, "username", c->username, 0);
217+
credential_write_item(fp, "password", c->password, 0);
210218
}
211219

212220
static int run_credential_helper(struct credential *c,
@@ -352,8 +360,11 @@ int credential_from_url_gently(struct credential *c, const char *url,
352360
* (3) proto://<user>:<pass>@<host>/...
353361
*/
354362
proto_end = strstr(url, "://");
355-
if (!proto_end)
356-
return 0;
363+
if (!proto_end || proto_end == url) {
364+
if (!quiet)
365+
warning(_("url has no scheme: %s"), url);
366+
return -1;
367+
}
357368
cp = proto_end + 3;
358369
at = strchr(cp, '@');
359370
colon = strchr(cp, ':');
@@ -374,10 +385,8 @@ int credential_from_url_gently(struct credential *c, const char *url,
374385
host = at + 1;
375386
}
376387

377-
if (proto_end - url > 0)
378-
c->protocol = xmemdupz(url, proto_end - url);
379-
if (slash - host > 0)
380-
c->host = url_decode_mem(host, slash - host);
388+
c->protocol = xmemdupz(url, proto_end - url);
389+
c->host = url_decode_mem(host, slash - host);
381390
/* Trim leading and trailing slashes from path */
382391
while (*slash == '/')
383392
slash++;
@@ -401,8 +410,6 @@ int credential_from_url_gently(struct credential *c, const char *url,
401410

402411
void credential_from_url(struct credential *c, const char *url)
403412
{
404-
if (credential_from_url_gently(c, url, 0) < 0) {
405-
warning(_("skipping credential lookup for url: %s"), url);
406-
credential_clear(c);
407-
}
413+
if (credential_from_url_gently(c, url, 0) < 0)
414+
die(_("credential url cannot be parsed: %s"), url);
408415
}

0 commit comments

Comments
 (0)