From d0ba0020000a658fb30b4d71b76b9d2b2b29c31f Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Wed, 9 Aug 2017 15:30:16 +0200 Subject: [PATCH] Resolves: CVE-2017-1000101 - do not continue parsing of glob after range overflow --- .gitignore | 1 + 0009-curl-7.54.1-CVE-2017-1000101.patch | 95 +++++++++++++++++++++++++ curl.spec | 9 ++- 3 files changed, 104 insertions(+), 1 deletion(-) create mode 100644 0009-curl-7.54.1-CVE-2017-1000101.patch diff --git a/.gitignore b/.gitignore index c5a0e59..7dcfd8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /curl-[0-9.]*.tar.lzma +/curl-[0-9.]*.tar.xz diff --git a/0009-curl-7.54.1-CVE-2017-1000101.patch b/0009-curl-7.54.1-CVE-2017-1000101.patch new file mode 100644 index 0000000..975c239 --- /dev/null +++ b/0009-curl-7.54.1-CVE-2017-1000101.patch @@ -0,0 +1,95 @@ +From 8846a6507283f2bfe439cc3679ac81aca5ee3447 Mon Sep 17 00:00:00 2001 +From: Daniel Stenberg +Date: Tue, 1 Aug 2017 17:16:07 +0200 +Subject: [PATCH] glob: do not continue parsing after a strtoul() overflow + range + +Added test 1289 to verify. + +CVE-2017-1000101 + +Bug: https://curl.haxx.se/docs/adv_20170809A.html +Reported-by: Brian Carpenter + +Upstream-commit: 453e7a7a03a2cec749abd3878a48e728c515cca7 +Signed-off-by: Kamil Dudka +--- + src/tool_urlglob.c | 5 ++++- + tests/data/Makefile.inc | 2 +- + tests/data/test1289 | 35 +++++++++++++++++++++++++++++++++++ + 3 files changed, 40 insertions(+), 2 deletions(-) + create mode 100644 tests/data/test1289 + +diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c +index d002f27..caf2385 100644 +--- a/src/tool_urlglob.c ++++ b/src/tool_urlglob.c +@@ -269,7 +269,10 @@ static CURLcode glob_range(URLGlob *glob, char **patternp, + } + errno = 0; + max_n = strtoul(pattern, &endp, 10); +- if(errno || (*endp == ':')) { ++ if(errno) ++ /* overflow */ ++ endp = NULL; ++ else if(*endp == ':') { + pattern = endp+1; + errno = 0; + step_n = strtoul(pattern, &endp, 10); +diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc +index ecfedc9..be69e7c 100644 +--- a/tests/data/Makefile.inc ++++ b/tests/data/Makefile.inc +@@ -128,7 +128,7 @@ test1220 test1221 test1222 test1223 test1224 test1225 test1226 test1227 \ + test1228 test1229 test1230 test1231 test1232 test1233 test1234 test1235 \ + test1236 test1237 test1238 test1239 test1240 test1241 test1242 test1243 \ + test1244 test1245 test1246 \ +-\ ++test1289 \ + test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \ + test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \ + test1316 test1317 test1318 test1319 test1320 test1321 test1322 \ +diff --git a/tests/data/test1289 b/tests/data/test1289 +new file mode 100644 +index 0000000..d679cc0 +--- /dev/null ++++ b/tests/data/test1289 +@@ -0,0 +1,35 @@ ++ ++ ++ ++HTTP ++HTTP GET ++globbing ++ ++ ++ ++# ++# Server-side ++ ++ ++ ++# Client-side ++ ++ ++http ++ ++ ++globbing with overflow and bad syntxx ++ ++ ++http://ur%20[0-60000000000000000000 ++ ++ ++ ++# Verify data after the test has been "shot" ++ ++# curl: (3) [globbing] bad range in column ++ ++3 ++ ++ ++ +-- +2.9.4 + diff --git a/curl.spec b/curl.spec index dc5f5a1..b57d825 100644 --- a/curl.spec +++ b/curl.spec @@ -1,7 +1,7 @@ Summary: A utility for getting files from remote servers (FTP, HTTP, and others) Name: curl Version: 7.51.0 -Release: 8%{?dist} +Release: 9%{?dist} License: MIT Group: Applications/Internet Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma @@ -27,6 +27,9 @@ Patch6: 0006-curl-7.51.0-ciphers-man-page.patch # nss: fix a possible use-after-free in SelectClientCert() (#1436158) Patch7: 0007-curl-7.54.1-nss-cc-use-after-free.patch +# do not continue parsing of glob after range overflow (CVE-2017-1000101) +Patch9: 0009-curl-7.54.1-CVE-2017-1000101.patch + # patch making libcurl multilib ready Patch101: 0101-curl-7.32.0-multilib.patch @@ -151,6 +154,7 @@ documentation of the library, too. %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch9 -p1 # Fedora patches %patch101 -p1 @@ -262,6 +266,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/aclocal/libcurl.m4 %changelog +* Wed Aug 09 2017 Kamil Dudka 7.51.0-9 +- do not continue parsing of glob after range overflow (CVE-2017-1000101) + * Thu Jul 20 2017 Kamil Dudka 7.51.0-8 - nss: fix a possible use-after-free in SelectClientCert() (#1436158)