samuong / alpaca

A local HTTP proxy for command-line tools. Supports PAC scripts and NTLM authentication.
Apache License 2.0
184 stars 31 forks source link

Error decoding NTLM Type 2 (Challenge) message: illegal base64 data at input byte 8 on currently unkown Proxy-Authenticate header #90

Open atbostudio opened 2 years ago

atbostudio commented 2 years ago

Hello @samuong,

i tried to the latest release of alpaca up and running. it detects the proxy pac due -C command correctly and direct calls are working fine. call through the external proxy are giving us following error message:

2022/04/29 16:32:12 proxyfinder.go:125: [1] CONNECT //www.google.com:443 via "PROXY proxy.domain.com:8080"
2022/04/29 16:32:12 proxy.go:153: [1] Got "407 Proxy authentication required" response, retrying with auth
2022/04/29 16:32:12 authenticator.go:56: Error decoding NTLM Type 2 (Challenge) message: illegal base64 data at input byte 8

image

we are using alpaca on windows 10 (Version 20H2)

it seems like our proxy does not return any valid Proxy-Authenticate header... i will try to get more informations together on monday with the help of our proxy admins. maybe you already got an idea whats the problem.

is there any way to give more detailed informations about the response of the proxy?

kind regards, julian

samuong commented 2 years ago

Do you have (or are able to install) curl? If so, you can use something like this to see the Proxy-Authenticate header at each step of the NTLM handshake:

curl --proxy proxy.domain.com:8080 --proxy-ntlm --proxy-user $your_username -v https://www.google.com

You should see three lines like this, which are the type 1, 2 and 3 messages:

< Proxy-Authenticate: NTLM TlRMTVNTUAA...
> Proxy-Authenticate: NTLM TlRMTVNTUAA...
< Proxy-Authenticate: NTLM TlRMTVNTUAA...

The value in the header should start with NTLM and then have a base64-encoded message afterwards. Is this what you see or do you see something else?

trite2k3 commented 1 year ago

No you just get HTTP 407 as you described in issue https://github.com/samuong/alpaca/issues/44