EHLO response from mail server for starting encrypted TLS protocol when connecting to SMTP to send mail appears modified from STARTTLS to AUTH PLAIN when sent through tor instead of plain TCP.
In consequence, email account credentials can only be sent in easily interceptable plain text when tor is used.
Basic problem: Thunderbird suddenly (around 08.2015) cannot connect to postfix/smtp by STARTTLS any more through tor, complaining STARTTLS would not be advertised.
Another MUA can connect to postfix/smtp by STARTTLS in plain TCP without tor without problems.
postfix is configured to advertise STARTTLS.
So I telnetted postfix/smtp twice,
- directly from localhost or from another remote ip,
- through tor by proxychains.
telnet directly from localhost or from remote ip:
> telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 x.y.com ESMTP EHLO a.b.com 250-x.y.com 250-PIPELINING 250-SIZE 10485760 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN QUIT 221 2.0.0 Bye Connection closed by foreign host.
In plain TCP, STARTTLS is advertised OK, both for connections from localhost and from remote.
Consequence: The MUA (mail user agent) initiates a TLS session to send credentials and email encrypted to the server, man in the middle (rsp. tor exit node) sees only an encryted stream.
telnet through tor by proxychains:
> proxychains telnet x.y.com 25 ProxyChains-3.1 (http://proxychains.sf.net) |DNS-response|: .... |S-chain|-<>-127.0.0.1:9050-<><>-X.X.X.X.-<><>-OK |DNS-response| x.y.com is XX.XX.XX.XX Trying XX.XX.XX.XX.... |S-chain|-<>-127.0.0.1:9050-<><>-XX.XX.XX.XX:25-<><>-OK Connected to x.y.com. Escape character is '^]'. EHLO a.b.com 220 csds.local ESMTP 250-csds.local 250-8BITMIME 250-AUTH PLAIN LOGIN 250-XCLIENT NAME HELO 250-XFORWARD NAME ADDR PROTO HELO 250-ENHANCEDSTATUSCODES 250 quit 221 Bye Connection closed by foreign host.
I get a different answer through tor, and the STARTTLS advertisement is missing. Instead 250-AUTH PLAIN LOGIN appears.
Consequence: The MUA either complains that TLS is not possible and nudges the user to fall back to plain text credentials or falls back to plaintext authentication and transmission automatically, in the latter case eventually without notifying the user, thus leaking the users credentials.
In both cases email content and USER CREDENTIALS would be revealed in plaintext to a man in the middle (rsp. the tor exit node).
I tried this with different tor identities.
To acertain whether this behaviour is indeed a function of the tor network, it is neccessary to exclude any other source. These are predominantly postfix, proxychains and any software run on my server.
If it is tor, the culprit is most probably the exit server. So: does the tor exit server used by proxychains change with a tor identity change?
But I suspect a misbehaviour of postfix in the first place.
How can I determine if this behaviour is dependent on postfix configuration or a function of tor, filtering STARTTLS?
Or something else?
If it is postfix, how can I fix it?