014-CVE-2015-3153.patch 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. From 69a2e8d7ec581695a62527cb2252e7350f314ffa Mon Sep 17 00:00:00 2001
  2. From: Daniel Stenberg <daniel@haxx.se>
  3. Date: Thu, 23 Apr 2015 15:58:21 +0200
  4. Subject: [PATCH] CURLOPT_HEADEROPT: default to separate
  5. Make the HTTP headers separated by default for improved security and
  6. reduced risk for information leakage.
  7. Bug: http://curl.haxx.se/docs/adv_20150429.html
  8. Reported-by: Yehezkel Horowitz, Oren Souroujon
  9. ---
  10. docs/libcurl/opts/CURLOPT_HEADEROPT.3 | 12 ++++++------
  11. lib/url.c | 1 +
  12. tests/data/test1527 | 2 +-
  13. tests/data/test287 | 2 +-
  14. tests/libtest/lib1527.c | 1 +
  15. 5 files changed, 10 insertions(+), 8 deletions(-)
  16. --- a/docs/libcurl/opts/CURLOPT_HEADEROPT.3
  17. +++ b/docs/libcurl/opts/CURLOPT_HEADEROPT.3
  18. @@ -5,7 +5,7 @@
  19. .\" * | (__| |_| | _ <| |___
  20. .\" * \___|\___/|_| \_\_____|
  21. .\" *
  22. -.\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
  23. +.\" * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
  24. .\" *
  25. .\" * This software is licensed as described in the file COPYING, which
  26. .\" * you should have received as part of this distribution. The terms
  27. @@ -31,10 +31,10 @@ CURLcode curl_easy_setopt(CURL *handle,
  28. Pass a long that is a bitmask of options of how to deal with headers. The two
  29. mutually exclusive options are:
  30. -\fBCURLHEADER_UNIFIED\fP - keep working as before. This means
  31. -\fICURLOPT_HTTPHEADER(3)\fP headers will be used in requests both to servers
  32. -and proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP will not
  33. -have any effect.
  34. +\fBCURLHEADER_UNIFIED\fP - the headers specified in
  35. +\fICURLOPT_HTTPHEADER(3)\fP will be used in requests both to servers and
  36. +proxies. With this option enabled, \fICURLOPT_PROXYHEADER(3)\fP will not have
  37. +any effect.
  38. \fBCURLHEADER_SEPARATE\fP - makes \fICURLOPT_HTTPHEADER(3)\fP headers only get
  39. sent to a server and not to a proxy. Proxy headers must be set with
  40. @@ -44,7 +44,7 @@ headers. When doing CONNECT, libcurl wil
  41. headers only to the proxy and then \fICURLOPT_HTTPHEADER(3)\fP headers only to
  42. the server.
  43. .SH DEFAULT
  44. -CURLHEADER_UNIFIED
  45. +CURLHEADER_SEPARATE (changed in 7.42.1, ased CURLHEADER_UNIFIED before then)
  46. .SH PROTOCOLS
  47. HTTP
  48. .SH EXAMPLE
  49. --- a/lib/url.c
  50. +++ b/lib/url.c
  51. @@ -605,6 +605,7 @@ CURLcode Curl_init_userdefined(struct Us
  52. set->ssl_enable_alpn = TRUE;
  53. set->expect_100_timeout = 1000L; /* Wait for a second by default. */
  54. + set->sep_headers = TRUE; /* separated header lists by default */
  55. return result;
  56. }
  57. --- a/tests/data/test1527
  58. +++ b/tests/data/test1527
  59. @@ -45,7 +45,7 @@ http-proxy
  60. lib1527
  61. </tool>
  62. <name>
  63. -Check same headers are generated without CURLOPT_PROXYHEADER
  64. +Check same headers are generated with CURLOPT_HEADEROPT == CURLHEADER_UNIFIED
  65. </name>
  66. <command>
  67. http://the.old.moo.1527:%HTTPPORT/1527 %HOSTIP:%PROXYPORT
  68. --- a/tests/data/test287
  69. +++ b/tests/data/test287
  70. @@ -28,7 +28,7 @@ http
  71. HTTP proxy CONNECT with custom User-Agent header
  72. </name>
  73. <command>
  74. -http://test.remote.example.com.287:%HTTPPORT/path/287 -H "User-Agent: looser/2007" --proxy http://%HOSTIP:%HTTPPORT --proxytunnel
  75. +http://test.remote.example.com.287:%HTTPPORT/path/287 -H "User-Agent: looser/2015" --proxy http://%HOSTIP:%HTTPPORT --proxytunnel --proxy-header "User-Agent: looser/2007"
  76. </command>
  77. </client>
  78. --- a/tests/libtest/lib1527.c
  79. +++ b/tests/libtest/lib1527.c
  80. @@ -83,6 +83,7 @@ int test(char *URL)
  81. test_setopt(curl, CURLOPT_READFUNCTION, read_callback);
  82. test_setopt(curl, CURLOPT_HTTPPROXYTUNNEL, 1L);
  83. test_setopt(curl, CURLOPT_INFILESIZE, strlen(data));
  84. + test_setopt(curl, CURLOPT_HEADEROPT, CURLHEADER_UNIFIED);
  85. res = curl_easy_perform(curl);