mobile wallpaper 1mobile wallpaper 2mobile wallpaper 3mobile wallpaper 4
651 words
3 minutes
Experiment 5: Email
2022-07-01

1. Objectives#

  • Understand the basic structure of email systems
  • Understand the client and server sides, and the communication between servers
  • Analyze and understand the SMTP and POP3 protocols

2. Experimental Environment#

  • Hardware requirements: One Alibaba Cloud ECS instance
  • Software requirements: Linux/Windows operating systems

3. Experimental Content#

3.1 Using a Mail Client to Send/Receive Mail#

Configure a mail user agent (for example, Windows, Outlook, Express, Thunderbird on Linux, etc.; you can use the one that comes with the system or download it yourself), to compose locally and receive your QQ Mail.

3.2 Local Email Sending/Receiving#

Use a local client to compose and send QQ emails. At the same time, use Wireshark to capture packets and analyze its communication process and protocols.

3.3 Web Mail#

Use a browser to log in to QQ Mail, compose and send QQ emails. Also use Wireshark to capture packets and analyze the communication process and protocols.

3.4 Telnet Email Sending/Receiving#

Use the telnet command to log in to the QQ Mail server and send emails. Also use Wireshark to capture packets to analyze the communication process and protocols.

Refer to online resources for the exact commands and port queries.

4. Results and Analysis#

4.1 Using a Mail Client to Send/Receive Mail#

  1. Open QQ Mail, enable POP3/SMTP services, and obtain an authorization code.

WAPvTMgEO7DYlX9.png

  1. Follow the instructions provided by QQ Mail to bind Outlook to QQ Mail

nyDNv6BM2EXT8W4.png

4.2 Local Email Sending/Receiving#

  1. Disable account SSL

pdY93TjtRnJUafk.png

  1. Use Wireshark to capture packets on the WLAN and send emails

e5dzHk21IfX4xBa.png

  1. Use Wireshark to trace SMTP

L83wZDIPviyQljA.png

  1. Analyze the communication process and protocols
C: telnet imap.qq.com 25 //Connect to QQ mail server via telnet
S: 220 newxmesmtplogicsvrszc10.qq.com XMail Esmtp QQ Mail Server. //Connection successful, 220 is the status code, followed by welcome message
C: EHLO DREAIFEDESKTOP //Identify to the server
S: 250-newxmesmtplogicsvrszc10.qq.com | PIPELINING | SIZE 73400320 | STARTTLS | AUTH LOGIN PLAIN XOAUTH XOAUTH2 | AUTH=LOGIN | MAILCOMPRESS | 8BITMIME //Success
C: AUTH LOGIN //Login
S: 334 VXNlcm5hbWU6
C: User: ODc3MjYxNzkzQHFxLmNvbQ== //Base64 of username and authorization code
S: 334 UGFzc3dvcmQ6
C: Pass: enVqbnVobWFhcnB5YmJiYg==
S: 235 Authentication successful
C: MAIL FROM: <[email protected]> //Sender email
S: 250 OK
C: RCPT TO: <[email protected]> //Recipient email
S: 250 OK
C: DATA //Email content
S: 354 End data with <CR><LF>.<CR><LF>.
C: DATA fragment, 2429 bytes
from: <[email protected]>, subject: , (text/plain) (text/html)
S: 250 OK: queued as.
C: QUIT //Send complete and exit
S:221 Bye

4.3 Web Mail#

  1. Use Wireshark to capture packets on the WLAN and send email

9yA3gaBJip5nZFx.png

  1. Use Wireshark to trace TLS/SSL

f56VQIEgGpxHtyr.png

  1. Analyze the communication process and protocols

Client Hello

SPGzmxOXKJpVorj.png

The first step of the TLS handshake is the client initiating the request, mainly including the random string generated by the client (session key), as well as the list of cipher suites supported by the client, random numbers, and other information.

MUh98dIWNmpn1Lc.png

  1. Server Hello && Certificate

Aa2ZoQi6EhGBbeR.png

After receiving the Client Hello data from the client, the server selects a cipher suite from the client’s list and generates a random string to return to the client. The key exchange algorithm chosen is ECDHE_RSA, the symmetric encryption algorithm uses AES_128_GCM_SHA256, and the server’s certificate information is also returned.

phEZKM1VHBfUAdt.png

  1. Server Key Exchange & Server Hello Done

3RYzrJUFaiPZKAM.png

The server returns a Server Key Exchange packet to exchange the keys used for data encryption with the client, and Server Hello Done to notify the client that the data for key exchange has been sent and to wait for the client’s response.

EvhOaj35WegzYoF.png

  1. Client Key Change & Change Cipher Spec & Encrypted HandShake Message

w1rncSCU9YBhsiR.png

The client uses the server-provided DH data to generate DH data and send it to the server to generate the final pre-master secret. As shown:

7GXgdnSAIuFOCfe.png

  1. Application Data

QZ9AqUsz3n7NGSw.png

  1. Change Cipher Spec & Encrypted HandShake Message

TjVrHfLqJBPXeYc.png

Session keys should be refreshed periodically

rwfkcnzlxQ1DBSL.png

4.4 Telnet Email Sending/Receiving#

  1. Enable Telnet on the computer and use Wireshark to capture packets

DldVe27vhCkrOQ4.png

  1. Open cmd to operate

Enter telnet imap.qq.com 25 to connect to the server and input the following commands

bOlcSHmnQYNGPyq.png

  1. Email sending completed

SGZ1ThwLfAgRnIU.png

  1. Analyze the communication process and protocols
C: telnet imap.qq.com 25 //Connect to QQ mail server via telnet
S: 220 newxmesmtplogicsvrszc10.qq.com XMail Esmtp QQ Mail Server. //Connection successful, 220 is the status code, followed by welcome message
C: helo qq.com //Identify to the server
S: 250-newxmesmtplogicsvrsza5.qq.com-9.22.14.83-57293480
S: 250-SIZE 73400320
S: 250 OK //Success
C: auth login //Login
S: 334 VXNlcm5hbWU6
C: User: ODc3MjYxNzkzQHFxLmNvbQ== //Base64 of username and authorization code
S: 334 UGFzc3dvcmQ6
C: Pass: enVqbnVobWFhcnB5YmJiYg==
S: 235 Authentication successful
C: MAIL FROM: <[email protected]> //Sender email
S: 250 OK
C: RCPT TO: <[email protected]> //Recipient email
S: 250 OK
C: DATA //Email content
S: 354 End data with <CR><LF>.<CR><LF>.
C: DATA fragment, 2429 bytes
from: <[email protected]>, subject: , (text/plain) (text/html)
S: 250 OK: queued as.
C: QUIT //Send complete and exit
S:221 Bye

5. Conclusions#

5.1 Problems and Solutions#

The issue when using Xftp to connect to the server: connection errors; the solution was to switch to campus network, after which it returned to normal. Investigation showed it was due to the server firewall.

5.2 Reflections#

  • This lab report familiarizes the actions of code and software involved in SMTP protocol analysis, as well as the analysis and extraction of SMTP messages, validating the knowledge learned in class. Through this experiment, I mastered the concrete process and steps of sending emails via Telnet, understood the basic usage of common SMTP protocol analysis tools, and improved my programming ability.
  • Through these common SMTP protocol analysis commands, tracking SMTP usage, and analyzing the structure of SMTP messages, I reinforced the knowledge taught in class.
Share

If this article helped you, please share it with others!

Experiment 5: Email
https://dreaife.tokyo/en/posts/email-experiment-2022/
Author
dreaife
Published at
2022-07-01
License
CC BY-NC-SA 4.0

Some information may be outdated

Related Posts Smart
1
Experiment 4: TCP Protocol Analysis
cs-base This experiment aims to understand the basic concepts of the TCP protocol and packet structure, analyze connection establishment and teardown, and master TCP protocol analysis using tcpdump and Wireshark. The experiment downloads a web page with wget and captures packets, analyzes TCP headers and fields, explores the three-way handshake and four-way termination processes, and summarizes issues and solutions encountered, improving understanding of IP protocols and TCP packet structure.
2
Experiment 2: IP Protocol Analysis
cs-base This experiment aims to understand the IP packet format and the meaning of its fields, and to master the use of tcpdump and Wireshark. The environment includes an Alibaba Cloud host and operating systems. Through packet capture with tcpdump and analysis with Wireshark, it studies the IP protocol structure and related commands, resolves traceroute and Xftp connection issues, and improves programming ability and understanding of IP.
3
Experiment 6: DNS Protocol Analysis and Measurement
cs-base This experiment aims to understand the DNS protocol and its basic concepts, including domain name structure, DNS servers, and the principles of domain name resolution. It covers DNS system configuration, DNS information measurement with the dig tool, and DNS query packet analysis using tcpdump and Wireshark. The results show the fields in DNS queries and their meanings, and the experiment concludes with issues encountered and solutions, improving understanding of DNS and programming skills.
4
Experiment 3: UDP Protocol Analysis
cs-base This experiment aims to master UDP protocol content and working principles and analyze UDP packets from DNS queries and QQ communication. It includes packet capture and analysis using tcpdump and Wireshark, and the results show that UDP datagrams consist of source port, destination port, length, and checksum. Through the experiment, traceroute and Xftp connection issues were resolved, and understanding of IP protocol analysis and programming ability were improved.
5
Experiment 8: Deployment and Application of a Web Server
cs-base This experiment aims to understand the structure of email systems, client-server communication, and SMTP/POP3 protocols. By installing and deploying Nginx and Apache on Alibaba Cloud, it demonstrates access to static and dynamic web pages, resolves dependency package installation issues, and improves understanding of Linux software configuration and programming ability.

Table of Contents