Bạn đã bao giờ nhận spam/phishing từ email address không nhận ra? Ai đó mời trip miễn phí, yêu cầu gửi bitcoin đổi ảnh cá nhân, hoặc chỉ gửi marketing email không muốn?
Bạn tự hỏi email đó từ đâu? Thấy spammer spoof email bạn và thắc mắc họ làm thế nào?
Email spoofing (làm email xuất hiện như từ address khác thực tế - ví dụ: email có vẻ từ whitehouse.gov nhưng thực tế từ scammer) dễ dàng đáng kinh ngạc.
Core email protocols không có authentication method, nghĩa là 'from' address về cơ bản chỉ fill-in-the-blank.
Thường khi nhận email, trông như:
From: Name <name@gmail.com>
Date: Tuesday, July 16, 2019 at 10:02 AM
To: Me <Me@freecodecamp.com>Dưới đó là subject và message.
Nhưng làm sao biết email thực sự từ đâu? Có additional data để analyze không?
Chúng ta tìm full email headers — cái thấy trên là partial header. Data này cho thêm info về nguồn email và cách nó đến inbox.
Xem headers trên Outlook và Gmail tại đây. Hầu hết mail programs tương tự, Google search cho alternative mail services.
Bài này xem một set real headers (heavily redacted — đã thay hostnames, timestamps, IP addresses).
Đọc headers từ top xuống bottom, nhưng lưu ý: mỗi server mới thêm header của họ lên top của email body. Nghĩa là đọc từ final Message Transfer Agent (MTA) xuống first MTA accept message.
Internal Transfers
Received: from REDACTED.outlook.com (IPv6 Address) by REDACTED.outlook.com with HTTPS via REDACTED.OUTLOOK.COM; Fri, 25 Oct 2019 20:16:39 +0000Hop đầu tiên显示 HTTPS line, nghĩa là server không nhận message qua standard SMTP mà tạo message từ input nhận trên web application.
Received: from REDACTED.outlook.com (IPv6Address) by REDACTED.outlook.com (IPv6Address) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1358.20; Fri, 25 Oct 2019 20:16:38 +0000
Received: from REDACTED.outlook.com (IPv6Address) by REDACTED.outlook.office365.com (IPv6Address) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2385.20 via Frontend Transport; Fri, 25 Oct 2019 20:16:37 +0000
Authentication-Results: spf=softfail (sender IP is REDACTEDIP)smtp.mailfrom=gmail.com; privatedomain.com; dkim=pass (signature was verified)header.d=gmail.com;privatedomain.com; dmarc=pass action=noneheader.from=gmail.com;compauth=pass reason=100
Received-SPF: SoftFail (REDACTED.outlook.com: domain of transitioning gmail.com discourages use of IPAddress as permitted sender)Hai header blocks đầu là internal mail transfers. Nhận ra received bởi Office365 servers (outlook.com), routed internally đến recipient đúng.
Cũng thấy message sent via encrypted SMTP. Biết vì header liệt kê "with Microsoft SMTP Server" và chỉ định TLS version và specific cipher.
Header block thứ ba đánh dấu transition từ local mail server sang mail filtering service. Biết vì "via Frontend Transport" - protocol Microsoft-Exchange specific (không strictly SMTP).
Block này cũng include email checks. Outlook.com header chi tiết SPF/DKIM/DMARC results. SPF softfail nghĩa là IP này không authorized gửi emails thay mặt gmail.com.
"dkim=pass" nghĩa là email từ purported sender và (most likely) không bị altered in transit.
DMARC là rules bảo mail server interpret SPF/DKIM results. Pass có nghĩa email continue đến destination.
Đọc thêm SPF, DKIM, DMARC tại đây.
Internal/External Transition
Received: from Redacted.localdomain.com (IP address) byredacted.outlook.com (IP address) with Microsoft SMTPServer (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id15.20.2305.15 via Frontend Transport; Fri, 25 Oct 2019 20:16:37 +0000
Received-SPF: None (Redacted.localdomain.com: no senderauthenticity information available from domain ofsender@gmail.com) identity=xxx; client-ip=IPaddress;receiver=Redacted.localdomain.com;envelope-from="sender@gmail.com";x-sender="sender@gmail.com"; x-conformance=sidf_compatible
Received-SPF: Pass (Redacted.localdomain.com: domain ofsender@gmail.com designates sending IP as permittedsender) identity=mailfrom; client-ip=IPaddress2;receiver=Redacted.localdomain.com;envelope-from="sender@gmail.com";x-sender="sender@gmail.com"; x-conformance=sidf_compatible;x-record-type="v=spf1"; x-record-text="v=spf1ip4:35.190.247.0/24 ip4:64.233.160.0/19 ip4:66.102.0.0/20ip4:66.249.80.0/20 ip4:72.14.192.0/18 ip4:74.125.0.0/16ip4:108.177.8.0/21 ip4:173.194.0.0/16 ip4:209.85.128.0/17ip4:216.58.192.0/19 ip4:216.239.32.0/19 ~all"Đây là SPF record của Google - báo receiving server rằng email claim từ gmail.com, đến từ Google approved server.
Received-SPF: None (redacted.localdomain.com: no senderauthenticity information available from domain ofpostmaster@redatedgoogle.com) identity=helo;client-ip=IPaddress; receiver=Redacted.localdomain.com;envelope-from="sender@gmail.com";x-sender="postmaster@.google.com";x-conformance=sidf_compatible
Authentication-Results-Original: Redacted@localdomain.com; spf=Nonesmtp.pra=sender@gmail.com; spf=Pass smtp.mailfrom=sender@gmail.com;spf=None smtp.helo=postmaster@redacted.google.com; dkim=pass (signatureverified) header.i=@gmail.com; dmarc=pass (p=none dis=none) d=gmail.com
IronPort-SDR: IronPort-PHdr: =X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: =X-IronPort-AV: ;d="scan"
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: FalseHiển thị thêm SPF/DKIM/DMARC checks, và kết quả IronPort scan.
Ironport là email filter phổ biến dùng bởi corporations tìm spam, viruses, malicious emails. Scan links và attachments, xác định email malicious (drop), likely legitimate (deliver), hoặc suspicious (attach header cảnh báo user).
Received: from redacted.google.com ([IPAddress])by Redacted.localdomain.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; Fri, 25 Oct 2019 16:16:36 -0400
Received: by redacted.google.com with SMTP idfor recipient@localdomain.com; Fri, 25 Oct 2019 13:16:35 -0700 (PDT)
X-Received: by IPv6:: with SMTP id; Fri, 25 Oct 2019 13:16:35 -0700 (PDT)
Return-Path: sender@gmail.com
Received: from senderssmacbook.fios-router.home (pool-.nycmny.fios.verizon.net. [IP address redacted])by smtp.gmail.com with ESMTPSA id redacted IP(version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);Fri, 25 Oct 2019 13:16:34 -0700 (PDT)
Received: from senderssmacbook.fios-router.home (pool-.nycmny.fios.verizon.net. [IP address redacted])by smtp.gmail.com with ESMTPSA id redacted IP(version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);Fri, 25 Oct 2019 13:16:34 -0700 (PDT)Phần này show internal hops email đi từ sender's initial device qua routing system của Gmail đến outlook environment của recipient. Thấy initial sender từ Macbook, home router, Verizon Fios NYC.
Đây là cuối hops route email từ sender đến recipient. Sau này, thấy body email (và headers typical như "from:", "to:", v.v.), có thể formatting dựa trên media type và email client (MIME Version, content type, boundary...). Có thể chứa user-agent info (details thiết bị gửi).
Trong case này đã biết sending device là Macbook do Apple naming convention, nhưng có thể chứa details CPU type, version, browser và version installed.
Trong một số cases, không phải tất cả, cũng có thể chứa IP address sending device (dù nhiều providers hide info đó tanpa subpoena).
Email headers có thể cho bạn biết gì?
Email headers giúp identify khi emails không được sent từ purported senders. Cung cấp một số info về sender - nhưng thường không đủ identify true sender.
Law enforcement thường dùng data này subpoena info từ right ISP, nhưng chúng ta phần lớn chỉ dùng để inform investigations, generally phishing.
Quy trình khó hơn vì headers có thể faked bởi malicious servers/hackers. Không contact từng server owner verify headers trong email match SMTP logs của họ - quá tốn kém và tốn thời gian - bạn không chắc headers accurate (trừ headers attached bởi own mail servers).
Không contact từng server owner verify headers match SMTP logs - tốn kém, tốn thời gian - bạn không chắc headers all accurate.
DKIM, DMARC, SPF giúp process này, nhưng không hoàn hảo, và không có chúng, không verification at all.
Không muốn analyze headers? Site này làm giúp tại đây.