News for hackers. Stuff that matters.
Re:Why We Can Send to Gmail in China by yegle on Monday September 19, 2016 @04:22PM (#12534372)
EDIT: format

The post only tells part of the story. There are at least two places that GFW can (and does!) block email traffic as long as the traffic goes through GFW:

1. By DNS poisoning your domain name. There's nothing special, when GFW decide to DNS poisoning your domain, all query types will be poisoned, including your MX record.

2. By TCP reset your SMTP connection to MTA (or forge reply from the other end) if the sender or recipient is something special.

For #1, this is happening to my domain name yegle.net. This could be demonstrated via a DNS query sent from outside of China to any servers (even it's not a DNS server) in China (see examples in the end of this comment).

For #2, this is happening to my gmail account. Try connect to an MTA in China from outside of China, as soon as you type "MAIL FROM: MY_EMAIL_ADDRESS", you'll get a TCP reset. (see examples in the end of this comment). If you are sending email from China to my email address, you'll get a forged reply saying the email address doesn't exist (again see example in the end of this comment).

In order to make sure you can send/receive email from/to China, you need to make sure the sender and receiver's email service support [StartTLS](https://en.wikipedia.org/wiki/Opportunistic_TLS).

    // TEST FROM OUTSIDE OF CHINA
    $ dig MX yegle.net @54.222.60.218

    ; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> MX yegle.net @54.222.60.218
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9506
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

    ;; QUESTION SECTION:
    ;yegle.net.                     IN      MX

    ;; ANSWER SECTION:
    yegle.net.              2654    IN      A       8.7.198.45

    ;; Query time: 176 msec
    ;; SERVER: 54.222.60.218#53(54.222.60.218)
    ;; WHEN: Mon Sep 19 13:13:17 PDT 2016
    ;; MSG SIZE  rcvd: 43

    // TEST FROM OUTSIDE OF CHINA
    $ dig MX yegle.net @8.8.8.8

    ; <<>> DiG 9.9.5-3ubuntu0.8-Ubuntu <<>> MX yegle.net @8.8.8.8
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17621
    ;; flags: qr rd ra ad; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 1

    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 512
    ;; QUESTION SECTION:
    ;yegle.net.                     IN      MX

    ;; ANSWER SECTION:
    yegle.net.              299     IN      MX      10 aspmx.l.google.com.
    yegle.net.              299     IN      MX      20 alt1.aspmx.l.google.com.
    yegle.net.              299     IN      MX      30 alt2.aspmx.l.google.com.
    yegle.net.              299     IN      MX      40 aspmx2.googlemail.com.
    yegle.net.              299     IN      MX      50 aspmx3.googlemail.com.

    ;; Query time: 24 msec
    ;; SERVER: 8.8.8.8#53(8.8.8.8)
    ;; WHEN: Mon Sep 19 13:13:27 PDT 2016
    ;; MSG SIZE  rcvd: 171


    // TEST FROM OUTSIDE OF CHINA
    $ telnet mail.kingsoft.com 25
    Trying 219.141.176.248...
    Connected to telecom.mail.kingsoft.com.
    Escape character is '^]'.
    220 mail.kingsoft.com ESMTP
    EHLO gmail.com
    250-mail.kingsoft.com
    250-8BITMIME
    250 SIZE 52428800
    MAIL FROM: cnyegle-AT-gmail-com
    Connection closed by foreign host.

    // TEST FROM INSIDE OF CHINA
    $ telnet aspmx.l.google.com 25
    Trying 209.85.225.27...
    Connected to aspmx.l.google.com.
    Escape character is '^]'.
    220 mx.google.com ESMTP u6si11379881igw.58
    EHLO yegle.net
    250-mx.google.com at your service, [183.151.34.162]
    250-SIZE 35882577
    250-8BITMIME
    250-STARTTLS
    250 ENHANCEDSTATUSCODES
    MAIL FROM:<[email protected]>
    250 2.1.0 OK u6si11379881igw.58
    RCPT TO:<cnyegle-AT-gmail-com>
    551 User not local; please try <forward-path>
    Connection closed by foreign host.

There are no comments on this comment yet.