0

As I understand, in order to open a SSL tunnel between client and a server through a proxy:

  • we open a TCP socket with the proxy.
  • we make an HTTP CONNECT method, which basically makes the proxy only forwards request, without modifying them.
  • we then establish an SSL socket between the client and the server, without the proxy involved (since SSL is peer to peer).

Since this first request is made using a TCP request, how can I be sure that I am talking to the good proxy ?

Since SSL makes the communication secure, is there any drawbacks that the communication between the client and the server is through a bad proxy ?

Is there a benefit to open an SSL tunnel through a proxy, as it doesn't even hide the client identity (IP of the client is stored in the HTML header)?

2
  • 1
    "(IP of the client is stored in the HTML header)?" - 1. There is no "HTML" header, you probably mean HTTP header 2. The IP of the client is not stored in the HTTP header, unless it was specifically added to the header by the proxy. And the proxy cannot add this to the header for HTTPS, since HTTPS is end-to-end encrypted which means that the original HTTP header is protected by this encryption. Commented Jul 11 at 13:50
  • "we then establish an SSL socket between the client and the server": no we don't. The proxy uses the connection it already has with that server to forward the client's SSL directly to it, from the connection the client already has with the proxy, without decoding (which it cannot do, by design of SSL). Commented Jul 12 at 5:48

3 Answers 3

0

Since this first request is made using a TCP request, how can I be sure that I am talking to the good proxy ?

In situations where it matters the most (e.g. if the proxy itself requires authentication using clear-text Basic method), the connection to the proxy can also be TLS-protected. I'm not sure if web browsers support that, but some proxies certainly do.

Often it doesn't matter much. The proxy can be configured to use Digest or Kerberos authentication, and the inner TLS tunnel already protects communication with the final destination host.

Since SSL makes the communication secure, is there any drawbacks that the communication between the client and the server is through a bad proxy ?

If the client is configured to use proxy authentication, then a 'bad' proxy can steal HTTP Basic auth credentials.

The proxy also knows which hosts you are connecting to; it can log this information for various reasons.

It is also in position to attempt MITM attacks – even if they're not very likely to succeed with inner TLS connections, that won't stop a bad proxy from trying; and of course it can easily MITM plaintext connections (like HTTP), including 'sslstrip' style attacks that stop clients from doing "opportunistic" insecure-secure upgrades.

Sign up to request clarification or add additional context in comments.

6 Comments

So what's the benefit of using a proxy in HTTPS connections then ? It looks like it has quite important drawbacks.
Same reasons as why you'd use a VPN: either to borrow the proxy's IP address (due to access control or whatever other reasons) and/or to influence traffic paths (e.g. due to client–proxy–server resulting in a more reliable or lower latency route for whatever reason).
as I understand, you can't borrow the proxy's IP since the client IP is included in the HTTP request header (the proxy doesn't modify it).
"you can't borrow the proxy's IP" – no, you always borrow the proxy's IP address. That is literally why the header exists: because proxy connections can't preserve the original address so it has to be put somewhere else. It's not the client which adds the HTTP header; it is the proxy which does so.
But 1) the proxy can only add the header for plain HTTP connections, not for HTTPS – it can't change requests if they are inside TLS, 2) the proxy won't be adding any such headers for non-HTTP traffic e.g. IMAP or SSH; and 3) most websites will ignore the header as they can't tell whether it is true (added by a proxy) or just manually spoofed by a client.
"I'm not sure if web browsers support that" - both Chrome (and derivates) and Firefox support this but there is currently no easy way to configure it. One need to do this either as commandline argument or with a PAC file.
0

It is safe for HTTP CONNECT to open an SSL tunnel through proxy. The client starts a SSL/TLS connection to interact with the server. The proxy does not inspect encrypted traffic. The HTTPS is trusted site server in securing communications through intermediaries. It prevents potential risks as the proxy restricts hosts that can be tunneled.

1 Comment

In such case, what's the benefit of using a proxy to only restrict hosts ? A router can do the same thing safer
0

Since this first request is made using a TCP request, how can I be sure that I am talking to the good proxy ?

You can't be sure that you are talking to the correct proxy when just using plain HTTP.

You can be sure though that the proxy does not sniff or modify the content of the HTTPS communication with the server, since this communication is still end-to-end encrypted. A HTTP proxy just passes through this communication through a tunnel.

If the proxy would try to break this communication (SSL interception) the browser would complain about an untrusted certificate. This is true in the common case where the CA certificate used by the proxy is not explicitly trusted by the client. In case of trusted SSL interception like done in coporate firewalls or antivirus products the proxy CA certificate is explicitly imported as trusted into the client, so that it will not complain about a certificate issued by an untrusted CA.

5 Comments

So what's the benefit of using a proxy in HTTPS connections then ?
There are various use cases for proxies. In restrictive coporate environments a proxy is often the only way to connect to the internet and might also require authentication - thereby implicitly limiting malware communiction. Other use cases are proxies for privacy, since the source IP visible by the server is the IP of the proxy and not the original IP of the client. This can also be (misused) for so called "residential" proxies which by the use of browser extension or similar have a residential IP address as source which might make website scraping and other abuse easier.
The proxy can perform very limited sniffing: If TLS is used without header encryption (thus all versions before TLS 1.3) the TLS handshake usually contains in the SNI extension the plaintext host name. This is what a proxy can see.
"without header encryption" - there is no such thing. I assume you mean Encrypted Client Hello (ECH), and this is not even a thing with TLS 1.3 but only came later and is not universally supported even with TLS 1.3. If you mean encryption of HTTP headers - this is always done since all of HTTP is completely encrypted by TLS. But even with ECH the proxy could determine the target from the CONNECT request, since the target is explicitly specified in clear inside this request.
Yes, encrypted headers was the wrong term. In reality the CONNECT request isn't a privacy problem, as most devices only use the IP address instead of the host name (seen that way by mobile devices like Android). If the DNS resolving is performed using an encrypted channel or a local DNS without the proxy involved, then the proxy can also not see the host name the client wants to connect to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.