Skip to contentSkip to conversation

#172: NTLM auth does not work with SQUID proxy server

Openvpn-devel Joerg Willmann 2 participants 3 messages Jan 29, 2013 – Mar 7, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

I was just faced with the problem described in trac issue #172.
I was trying to use ntlm authentication against a bluecoat proxy server.
Since the reply string of the bluecoat proxy was too long the same problem occurred as described in #172:

"NTLM Proxy-Authorization phase 3 failed: received corrupted data from proxy server"

The patch attached to #172 solved my problem and seems to be reasonable.

I'm just wondering what it takes to make this issue being accepted. (Sorry I didn't find a description of this process in wiki/DeveloperDocumentation). Does it just take time or is some input required?

Best regards,
Joerg

#1 lore raw

Hi,

Quoted 8 lines · Joerg Willmann

I was just faced with the problem described in trac issue #172. I was trying to use ntlm authentication against a bluecoat proxy server. Since the reply string of the bluecoat proxy was too long the same problem occurred as described in #172:

"NTLM Proxy-Authorization phase 3 failed: received corrupted data from proxy server"

Quoted 6 lines

The patch attached to #172 solved my problem and seems to be reasonable.

I'm just wondering what it takes to make this issue being accepted. (Sorry I didn't find a description of this process in wiki/DeveloperDocumentation).
Does it just take time or is some input required?

Thanks for bringing this to our attention again. We've seemed to be a bit lazy on going through trac tickets...

Anyway, for the sake of the archives, I'll append the patch below, and if nobody NACKs it, I'll take Joerg's comment here and Chris' ack in the trac ticket as "sufficient ACKs to go forward".

I won't claim to understand NTLM auth, but the explanation given makes sense and the patch is harmless enough - the buf2 buffer is only used in one other place, called "phase_2" there, and being base64-decoded into a new buf2 which is char[128], so the extra byte is guaranteed not to overflow anything.

inside ntlm_phase_3():

char buf2[128]; /* decoded reply from proxy */ ret_val = openvpn_base64_decode( phase_2, (void *)buf2, -1);

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
proxy.c +2 -2
@@ -519,7 +519,7 @@
 {
   struct gc_arena gc = gc_new ();
   char buf[512];
-  char buf2[128];
+  char buf2[129];
   char get[80];
   int status;
   int nparms;
@@ -642,7 +642,7 @@
 
               openvpn_snprintf (get, sizeof get, "%%*s NTLM %%%ds", (int) sizeof (buf2) - 1);
               nparms = sscanf (buf, get, buf2);
-              buf2[127] = 0; /* we only need the beginning - ensure it's null terminated. */
+              buf2[128] = 0; /* we only need the beginning - ensure it's null terminated. */
 
               /* check for "Proxy-Authenticate: NTLM TlRM..." */
               if (nparms == 1)
Acked-by Joerg Willmann
#2 lore raw
In reply to Joerg Willmann

Hi,

Quoted 6 lines · Joerg Willmann

The patch attached to #172 solved my problem and seems to be reasonable.

I'm just wondering what it takes to make this issue being accepted. (Sorry I didn't find a description of this process in wiki/DeveloperDocumentation).
Does it just take time or is some input required?

Thanks for your patience. I have now committed this to master and release/2.3, and will push ASAP.

commit f8ac53b98ed2513f1d80363b6fd2351f1b4ae511 (master) commit 55058d4f96dfec96e9f0cad7802a5eaaf9a3301f (release/2.3)

Author: Christian Niessner <[email protected]...>
Date:   Thu Mar 7 19:37:58 2013 +0100

Fix corner case in NTLM authentication (trac #172)

The problem is located in the file proxy.c within "establish_http_proxy_passthru": To keep buffers small long base64-encoded NTLM-Strings are truncated.

But the truncating is done on a wrong place: base 64 strings can be cut every 4 chars. the buffer is 128 bytes - including the terminating \0, so the usable data is only 127 bytes. And decoding a 127 char base64 string fails... this is why the ntlm authentication fails in certain cases (long strings)...

URL: https://community.openvpn.net/openvpn/ticket/172

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...