Browse code

gnupg: Fix CVE-2018-12020

Change-Id: I634373ae69198767b563f5a1ad45dca0542b1202
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6630
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

ashwin-h authored on 2019/02/01 02:36:54
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,38 @@
0
+From 2326851c60793653069494379b16d84e4c10a0ac Mon Sep 17 00:00:00 2001
1
+From: Werner Koch <wk@gnupg.org>
2
+Date: Fri, 8 Jun 2018 10:45:21 +0200
3
+Subject: [PATCH] gpg: Sanitize diagnostic with the original file name.
4
+
5
+* g10/mainproc.c (proc_plaintext): Sanitize verbose output.
6
+--
7
+
8
+This fixes a forgotten sanitation of user supplied data in a verbose
9
+mode diagnostic.  The mention CVE is about using this to inject
10
+status-fd lines into the stderr output.  Other harm good as well be
11
+done.  Note that GPGME based applications are not affected because
12
+GPGME does not fold status output into stderr.
13
+
14
+CVE-id: CVE-2018-12020
15
+GnuPG-bug-id: 4012
16
+(cherry picked from commit 13f135c7a252cc46cff96e75968d92b6dc8dce1b)
17
+---
18
+ g10/mainproc.c | 6 +++++-
19
+ 1 file changed, 5 insertions(+), 1 deletion(-)
20
+
21
+diff --git a/g10/mainproc.c b/g10/mainproc.c
22
+index 33a654b34..ffa7ef6d8 100644
23
+--- a/g10/mainproc.c
24
+@@ -675,7 +675,11 @@
25
+   if (pt->namelen == 8 && !memcmp( pt->name, "_CONSOLE", 8))
26
+     log_info (_("Note: sender requested \"for-your-eyes-only\"\n"));
27
+   else if (opt.verbose)
28
+-    log_info (_("original file name='%.*s'\n"), pt->namelen, pt->name);
29
++    {
30
++        char *tmp = make_printable_string (pt->name, pt->namelen, 0);
31
++        log_info (_("original file name='%.*s'\n"), (int)strlen (tmp), tmp);
32
++        xfree (tmp);
33
++    }
34
+ 
35
+   free_md_filter_context (&c->mfx);
36
+   if (gcry_md_open (&c->mfx.md, 0, 0))
... ...
@@ -1,11 +1,12 @@
1 1
 Summary:	OpenPGP standard implementation used for encrypted communication and data storage.
2 2
 Name:		gnupg
3 3
 Version:	2.1.20
4
-Release:	3%{?dist}
4
+Release:	4%{?dist}
5 5
 License:	GPLv3+
6 6
 URL:		https://gnupg.org/index.html
7 7
 Group:		Applications/Cryptography.
8 8
 Source0:        https://gnupg.org/ftp/gcrypt/gnupg/%{name}-%{version}.tar.bz2
9
+Patch0:         CVE-2018-12020.patch
9 10
 %define sha1 gnupg=500ddae8e4225ae2e300934090f9b9a427b8def1
10 11
 Vendor:		VMware, Inc.
11 12
 Distribution:	Photon
... ...
@@ -36,6 +37,7 @@ a command line tool with features for easy integration with other applications.
36 36
 
37 37
 %prep
38 38
 %setup -q -n %{name}-%{version}
39
+%patch0 -p1
39 40
 
40 41
 %build
41 42
 ./configure --prefix=%{_prefix}      \
... ...
@@ -59,6 +61,8 @@ make DESTDIR=%{buildroot} install
59 59
 %exclude /usr/share/doc/*
60 60
 
61 61
 %changelog
62
+*   Thu Jan 31 2019 Ashwin H <ashwinh@vmware.com> 2.1.20-4
63
+-   Fix CVE-2018-12020
62 64
 *   Wed Aug 30 2017 Alexey Makhalov <amakhalov@vmware.com> 2.1.20-3
63 65
 -   Add requires libgcrypt
64 66
 *   Wed Jun 07 2017 Danut Moraru <dmoraru@vmware.com> 2.1.20-2