gnu: rsync: Patch CVE-2017-{16548,17433,17434}.

* gnu/packages/rsync.scm (rsync)[source]: Add patches.
[properties]: Mark CVE-2017-15994 as not relevant.
* gnu/packages/patches/rsync-CVE-2017-16548.patch,
gnu/packages/patches/rsync-CVE-2017-17433.patch,
gnu/packages/patches/rsync-CVE-2017-17433-fix-tests.patch,
gnu/packages/patches/rsync-CVE-2017-17434-pt1.patch,
gnu/packages/patches/rsync-CVE-2017-17434-pt2.patch: New files.
* gnu/local.mk (dist_patch_DATA): Register them.
This commit is contained in:
Efraim Flashner 2017-12-18 22:37:41 +02:00
parent b50a9cc008
commit 91675d5082
No known key found for this signature in database
GPG Key ID: 41AAE7DCCA3D8351
7 changed files with 200 additions and 1 deletions

View File

@ -1052,6 +1052,11 @@ dist_patch_DATA = \
%D%/packages/patches/ripperx-missing-file.patch \
%D%/packages/patches/rpcbind-CVE-2017-8779.patch \
%D%/packages/patches/rsem-makefile.patch \
%D%/packages/patches/rsync-CVE-2017-16548.patch \
%D%/packages/patches/rsync-CVE-2017-17433.patch \
%D%/packages/patches/rsync-CVE-2017-17433-fix-tests.patch \
%D%/packages/patches/rsync-CVE-2017-17434-pt1.patch \
%D%/packages/patches/rsync-CVE-2017-17434-pt2.patch \
%D%/packages/patches/ruby-concurrent-ignore-broken-test.patch \
%D%/packages/patches/ruby-concurrent-test-arm.patch \
%D%/packages/patches/ruby-rack-ignore-failing-test.patch \

View File

@ -0,0 +1,31 @@
https://bugzilla.samba.org/show_bug.cgi?id=13112
https://git.samba.org/rsync.git/?p=rsync.git;a=patch;h=47a63d90e71d3e19e0e96052bb8c6b9cb140ecc1
From 47a63d90e71d3e19e0e96052bb8c6b9cb140ecc1 Mon Sep 17 00:00:00 2001
From: Wayne Davison <wayned@samba.org>
Date: Sun, 5 Nov 2017 11:33:15 -0800
Subject: [PATCH] Enforce trailing \0 when receiving xattr name values. Fixes
bug 13112.
---
xattrs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/xattrs.c b/xattrs.c
index 68305d7..4867e6f 100644
--- a/xattrs.c
+++ b/xattrs.c
@@ -824,6 +824,10 @@ void receive_xattr(int f, struct file_struct *file)
out_of_memory("receive_xattr");
name = ptr + dget_len + extra_len;
read_buf(f, name, name_len);
+ if (name_len < 1 || name[name_len-1] != '\0') {
+ rprintf(FERROR, "Invalid xattr name received (missing trailing \\0).\n");
+ exit_cleanup(RERR_FILEIO);
+ }
if (dget_len == datum_len)
read_buf(f, ptr, dget_len);
else {
--
1.9.1

View File

@ -0,0 +1,42 @@
https://git.samba.org/?p=rsync.git;a=patch;h=f5e8a17e093065fb20fea00a29540fe2c7896441
minor edits were made to get the patch to apply
From f5e8a17e093065fb20fea00a29540fe2c7896441 Mon Sep 17 00:00:00 2001
From: Wayne Davison <wayned@samba.org>
Date: Sun, 3 Dec 2017 15:49:56 -0800
Subject: [PATCH] Fix issue with earlier path-check (fixes "make check") and
make a BOOL more explicit.
---
checksum.c | 2 +-
receiver.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/receiver.c b/receiver.c
index 9c46242..75cb00d 100644
--- a/receiver.c
+++ b/receiver.c
@@ -574,15 +574,15 @@ int recv_files(int f_in, int f_out, char *local_name)
file = dir_flist->files[cur_flist->parent_ndx];
fname = local_name ? local_name : f_name(file, fbuf);
- if (daemon_filter_list.head
- && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {
+ if (DEBUG_GTE(RECV, 1))
+ rprintf(FINFO, "recv_files(%s)\n", fname);
+
+ if (daemon_filter_list.head && (*fname != '.' || fname[1] != '\0')
+ && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {
rprintf(FERROR, "attempt to hack rsync failed.\n");
exit_cleanup(RERR_PROTOCOL);
}
- if (DEBUG_GTE(RECV, 1))
- rprintf(FINFO, "recv_files(%s)\n", fname);
-
#ifdef SUPPORT_XATTRS
if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && do_xfers
&& !(want_xattr_optim && BITS_SET(iflags, ITEM_XNAME_FOLLOWS|ITEM_LOCAL_CHANGE)))
--
1.9.1

View File

@ -0,0 +1,45 @@
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17433
https://git.samba.org/?p=rsync.git;a=patch;h=3e06d40029cfdce9d0f73d87cfd4edaf54be9c51
From 3e06d40029cfdce9d0f73d87cfd4edaf54be9c51 Mon Sep 17 00:00:00 2001
From: Jeriko One <jeriko.one@gmx.us>
Date: Thu, 2 Nov 2017 23:44:19 -0700
Subject: [PATCH] Check fname in recv_files sooner.
---
receiver.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/receiver.c b/receiver.c
index baae3a9..9fdafa1 100644
--- a/receiver.c
+++ b/receiver.c
@@ -574,6 +574,12 @@ int recv_files(int f_in, int f_out, char *local_name)
file = dir_flist->files[cur_flist->parent_ndx];
fname = local_name ? local_name : f_name(file, fbuf);
+ if (daemon_filter_list.head
+ && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {
+ rprintf(FERROR, "attempt to hack rsync failed.\n");
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
if (DEBUG_GTE(RECV, 1))
rprintf(FINFO, "recv_files(%s)\n", fname);
@@ -645,12 +651,6 @@ int recv_files(int f_in, int f_out, char *local_name)
cleanup_got_literal = 0;
- if (daemon_filter_list.head
- && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {
- rprintf(FERROR, "attempt to hack rsync failed.\n");
- exit_cleanup(RERR_PROTOCOL);
- }
-
if (read_batch) {
int wanted = redoing
? we_want_redo(ndx)
--
1.9.1

View File

@ -0,0 +1,28 @@
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17434
https://git.samba.org/?p=rsync.git;a=patch;h=5509597decdbd7b91994210f700329d8a35e70a1
From 5509597decdbd7b91994210f700329d8a35e70a1 Mon Sep 17 00:00:00 2001
From: Jeriko One <jeriko.one@gmx.us>
Date: Thu, 16 Nov 2017 17:26:03 -0800
Subject: [PATCH] Check daemon filter against fnamecmp in recv_files().
---
receiver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/receiver.c b/receiver.c
index 9fdafa1..9c46242 100644
--- a/receiver.c
+++ b/receiver.c
@@ -722,7 +722,7 @@ int recv_files(int f_in, int f_out, char *local_name)
break;
}
if (!fnamecmp || (daemon_filter_list.head
- && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0)) {
+ && check_filter(&daemon_filter_list, FLOG, fnamecmp, 0) < 0)) {
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
}
--
1.9.1

View File

@ -0,0 +1,39 @@
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-17434
https://git.samba.org/?p=rsync.git;a=patch;h=70aeb5fddd1b2f8e143276f8d5a085db16c593b9
From 70aeb5fddd1b2f8e143276f8d5a085db16c593b9 Mon Sep 17 00:00:00 2001
From: Jeriko One <jeriko.one@gmx.us>
Date: Thu, 16 Nov 2017 17:05:42 -0800
Subject: [PATCH] Sanitize xname in read_ndx_and_attrs.
---
rsync.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/rsync.c b/rsync.c
index b82e598..a0945ba 100644
--- a/rsync.c
+++ b/rsync.c
@@ -49,6 +49,7 @@ extern int flist_eof;
extern int file_old_total;
extern int keep_dirlinks;
extern int make_backups;
+extern int sanitize_paths;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
#ifdef ICONV_OPTION
@@ -396,6 +397,11 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
if (iflags & ITEM_XNAME_FOLLOWS) {
if ((len = read_vstring(f_in, buf, MAXPATHLEN)) < 0)
exit_cleanup(RERR_PROTOCOL);
+
+ if (sanitize_paths) {
+ sanitize_path(buf, buf, "", 0, SP_DEFAULT);
+ len = strlen(buf);
+ }
} else {
*buf = '\0';
len = -1;
--
1.9.1

View File

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; This file is part of GNU Guix.
;;;
@ -38,7 +39,15 @@
version ".tar.gz"))
(sha256
(base32
"1hm1q04hz15509f0p9bflw4d6jzfvpm1d36dxjwihk1wzakn5ypc"))))
"1hm1q04hz15509f0p9bflw4d6jzfvpm1d36dxjwihk1wzakn5ypc"))
(patches (search-patches "rsync-CVE-2017-16548.patch"
"rsync-CVE-2017-17433.patch"
"rsync-CVE-2017-17433-fix-tests.patch"
"rsync-CVE-2017-17434-pt1.patch"
"rsync-CVE-2017-17434-pt2.patch"
))
))
(properties `((lint-hidden-cve . ("CVE-2017-15994")))) ; introduced after 3.1.2
(build-system gnu-build-system)
(inputs `(("perl" ,perl)
("acl" ,acl)))