1 |
commit: 55a42a5c7060468e5406884bfa4294b3cdc824c7 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Aug 1 15:41:53 2020 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Aug 1 22:57:17 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=55a42a5c |
7 |
|
8 |
kde-apps/ark: Fix CVE-2020-16116 |
9 |
|
10 |
Bug: https://bugs.gentoo.org/734622 |
11 |
Package-Manager: Portage-3.0.1, Repoman-2.3.23 |
12 |
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> |
13 |
|
14 |
kde-apps/ark/ark-20.04.3-r1.ebuild | 85 ++++++++++++++++++++++ |
15 |
.../ark/files/ark-20.04.3-CVE-2020-16116.patch | 46 ++++++++++++ |
16 |
2 files changed, 131 insertions(+) |
17 |
|
18 |
diff --git a/kde-apps/ark/ark-20.04.3-r1.ebuild b/kde-apps/ark/ark-20.04.3-r1.ebuild |
19 |
new file mode 100644 |
20 |
index 00000000000..0777dc7a6bc |
21 |
--- /dev/null |
22 |
+++ b/kde-apps/ark/ark-20.04.3-r1.ebuild |
23 |
@@ -0,0 +1,85 @@ |
24 |
+# Copyright 1999-2020 Gentoo Authors |
25 |
+# Distributed under the terms of the GNU General Public License v2 |
26 |
+ |
27 |
+EAPI=7 |
28 |
+ |
29 |
+ECM_HANDBOOK="forceoptional" |
30 |
+ECM_TEST="optional" |
31 |
+KFMIN=5.70.0 |
32 |
+QTMIN=5.14.2 |
33 |
+VIRTUALX_REQUIRED="test" |
34 |
+inherit ecm kde.org |
35 |
+ |
36 |
+DESCRIPTION="KDE Archiving tool" |
37 |
+HOMEPAGE="https://kde.org/applications/utilities/org.kde.ark |
38 |
+https://utils.kde.org/projects/ark/" |
39 |
+ |
40 |
+LICENSE="GPL-2" # TODO: CHECK |
41 |
+SLOT="5" |
42 |
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86" |
43 |
+IUSE="bzip2 lzma zip" |
44 |
+ |
45 |
+BDEPEND=" |
46 |
+ sys-devel/gettext |
47 |
+" |
48 |
+RDEPEND=" |
49 |
+ app-arch/libarchive:=[bzip2?,lzma?,zlib] |
50 |
+ >=dev-qt/qtdbus-${QTMIN}:5 |
51 |
+ >=dev-qt/qtgui-${QTMIN}:5 |
52 |
+ >=dev-qt/qtwidgets-${QTMIN}:5 |
53 |
+ >=kde-frameworks/karchive-${KFMIN}:5 |
54 |
+ >=kde-frameworks/kcompletion-${KFMIN}:5 |
55 |
+ >=kde-frameworks/kconfig-${KFMIN}:5 |
56 |
+ >=kde-frameworks/kconfigwidgets-${KFMIN}:5 |
57 |
+ >=kde-frameworks/kcoreaddons-${KFMIN}:5 |
58 |
+ >=kde-frameworks/kcrash-${KFMIN}:5 |
59 |
+ >=kde-frameworks/kdbusaddons-${KFMIN}:5 |
60 |
+ >=kde-frameworks/ki18n-${KFMIN}:5 |
61 |
+ >=kde-frameworks/kio-${KFMIN}:5 |
62 |
+ >=kde-frameworks/kitemmodels-${KFMIN}:5 |
63 |
+ >=kde-frameworks/kjobwidgets-${KFMIN}:5 |
64 |
+ >=kde-frameworks/kparts-${KFMIN}:5 |
65 |
+ >=kde-frameworks/kpty-${KFMIN}:5 |
66 |
+ >=kde-frameworks/kservice-${KFMIN}:5 |
67 |
+ >=kde-frameworks/kwidgetsaddons-${KFMIN}:5 |
68 |
+ >=kde-frameworks/kxmlgui-${KFMIN}:5 |
69 |
+ sys-libs/zlib |
70 |
+ zip? ( >=dev-libs/libzip-1.2.0:= ) |
71 |
+" |
72 |
+DEPEND="${RDEPEND} |
73 |
+ >=dev-qt/qtconcurrent-${QTMIN}:5 |
74 |
+" |
75 |
+ |
76 |
+# bug #560548, last checked with 16.04.1 |
77 |
+RESTRICT+=" test" |
78 |
+ |
79 |
+PATCHES=( "${FILESDIR}/${P}-CVE-2020-16116.patch" ) |
80 |
+ |
81 |
+src_configure() { |
82 |
+ local mycmakeargs=( |
83 |
+ $(cmake_use_find_package bzip2 BZip2) |
84 |
+ $(cmake_use_find_package lzma LibLZMA) |
85 |
+ $(cmake_use_find_package zip LibZip) |
86 |
+ ) |
87 |
+ |
88 |
+ ecm_src_configure |
89 |
+} |
90 |
+ |
91 |
+pkg_postinst() { |
92 |
+ ecm_pkg_postinst |
93 |
+ |
94 |
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then |
95 |
+ if ! has_version app-arch/rar; then |
96 |
+ elog "For creating/extracting rar archives, installing app-arch/rar is required." |
97 |
+ if ! has_version app-arch/unar && ! has_version app-arch/unrar; then |
98 |
+ elog "Alternatively, for only extracting rar archives, install app-arch/unar (free) or app-arch/unrar (non-free)." |
99 |
+ fi |
100 |
+ fi |
101 |
+ |
102 |
+ has_version app-arch/p7zip || \ |
103 |
+ elog "For handling 7-Zip archives, install app-arch/p7zip." |
104 |
+ |
105 |
+ has_version app-arch/lrzip || \ |
106 |
+ elog "For handling lrz archives, install app-arch/lrzip." |
107 |
+ fi |
108 |
+} |
109 |
|
110 |
diff --git a/kde-apps/ark/files/ark-20.04.3-CVE-2020-16116.patch b/kde-apps/ark/files/ark-20.04.3-CVE-2020-16116.patch |
111 |
new file mode 100644 |
112 |
index 00000000000..79129c7be6e |
113 |
--- /dev/null |
114 |
+++ b/kde-apps/ark/files/ark-20.04.3-CVE-2020-16116.patch |
115 |
@@ -0,0 +1,46 @@ |
116 |
+From 0df592524fed305d6fbe74ddf8a196bc9ffdb92f Mon Sep 17 00:00:00 2001 |
117 |
+From: Elvis Angelaccio <elvis.angelaccio@×××.org> |
118 |
+Date: Wed, 29 Jul 2020 23:45:30 +0200 |
119 |
+Subject: [PATCH] Fix vulnerability to path traversal attacks |
120 |
+ |
121 |
+Ark was vulnerable to directory traversal attacks because of |
122 |
+missing validation of file paths in the archive. |
123 |
+ |
124 |
+More details about this attack are available at: |
125 |
+https://github.com/snyk/zip-slip-vulnerability |
126 |
+ |
127 |
+Job::onEntry() is the only place where we can safely check the path of |
128 |
+every entry in the archive. There shouldn't be a valid reason |
129 |
+to have a "../" in an archive path, so we can just play safe and abort |
130 |
+the LoadJob if we detect such an entry. This makes impossibile to |
131 |
+extract this kind of malicious archives and perform the attack. |
132 |
+ |
133 |
+Thanks to Albert Astals Cid for suggesting to use QDir::cleanPath() |
134 |
+so that we can still allow loading of legitimate archives that |
135 |
+contain "../" in their paths but still resolve inside the extraction folder. |
136 |
+--- |
137 |
+ kerfuffle/jobs.cpp | 8 ++++++++ |
138 |
+ 1 file changed, 8 insertions(+) |
139 |
+ |
140 |
+diff --git a/kerfuffle/jobs.cpp b/kerfuffle/jobs.cpp |
141 |
+index fdaa48695..f73b56f86 100644 |
142 |
+--- a/kerfuffle/jobs.cpp |
143 |
++++ b/kerfuffle/jobs.cpp |
144 |
+@@ -180,6 +180,14 @@ void Job::onError(const QString & message, const QString & details) |
145 |
+ |
146 |
+ void Job::onEntry(Archive::Entry *entry) |
147 |
+ { |
148 |
++ const QString entryFullPath = entry->fullPath(); |
149 |
++ if (QDir::cleanPath(entryFullPath).contains(QLatin1String("../"))) { |
150 |
++ qCWarning(ARK) << "Possibly malicious archive. Detected entry that could lead to a directory traversal attack:" << entryFullPath; |
151 |
++ onError(i18n("Could not load the archive because it contains ill-formed entries and might be a malicious archive."), QString()); |
152 |
++ onFinished(false); |
153 |
++ return; |
154 |
++ } |
155 |
++ |
156 |
+ emit newEntry(entry); |
157 |
+ } |
158 |
+ |
159 |
+-- |
160 |
+GitLab |
161 |
+ |