]> granicus.if.org Git - curl/commitdiff
http_done: close Negotiate connections when done
authorDaniel Stenberg <daniel@haxx.se>
Sat, 18 Apr 2015 21:50:16 +0000 (23:50 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 21 Apr 2015 21:20:37 +0000 (23:20 +0200)
When doing HTTP requests Negotiate authenticated, the entire connnection
may become authenticated and not just the specific HTTP request which is
otherwise how HTTP works, as Negotiate can basically use NTLM under the
hood. curl was not adhering to this fact but would assume that such
requests would also be authenticated per request.

CVE-2015-3148

Bug: http://curl.haxx.se/docs/adv_20150422B.html
Reported-by: Isaac Boukris
lib/http.c

index 4c1cfc5499a85386d6b0f482b7628f7119a17577..beab543eed262dd5410a3bce8a95313e2463eae6 100644 (file)
@@ -1435,8 +1435,14 @@ CURLcode Curl_http_done(struct connectdata *conn,
 
 #ifdef USE_SPNEGO
   if(data->state.proxyneg.state == GSS_AUTHSENT ||
-      data->state.negotiate.state == GSS_AUTHSENT)
+     data->state.negotiate.state == GSS_AUTHSENT) {
+    /* add forbid re-use if http-code != 401/407 as a WA only needed for
+     * 401/407 that signal auth failure (empty) otherwise state will be RECV
+     * with current code */
+    if((data->req.httpcode != 401) && (data->req.httpcode != 407))
+      connclose(conn, "Negotiate transfer completed");
     Curl_cleanup_negotiate(data);
+  }
 #endif
 
   /* set the proper values (possibly modified on POST) */