Protocols and Servers
Telnet#
- Telnet ( an application layer protocol) is relatively simple.
- When user connects, asks for credentials. Upon authentication, the user will access remote system’s terminal. Unfortunately, all this communication between the client and telnet server is not encrypted, makingit an easy target for attackers.
- A telnet server uses Telnet protocol to listen for incoming connections on port 23.
- Its is no longer considered a secure option, expecially that anyone capturing your traffic will be able to discover your credentials which would grant them remote access to the system. The secure alternative is Ssh.
File Transfer PRotocol#
File Transfer Protocol (FTP) was developed to make the transfer of files between different computers with different systems efficient.
FTP also sends and receives data as cleartext; therefore, we can use Telnet (or Netcat) to communicate with an FTP server and act as an FTP client. Its default port is 21.
Please see below general commands in ftp server
ftp $FTP_SERVERUSER username - giving user name PASS pa$$word - giving password STAT - provide added info SYST - shows system type of target (eg: unix) PASV - switchs mode to passive TYPE A - switches the file transfer mode to ASCII TYPE I - switch the file transfer mode to the binary ls - to list the files get FILENAME - file transfer QUIT - quits the connection to the serverIts worth noting that there are two modes of operation.
Active- the data sent is over a seperate channel originating the FTP server’s port-20.Passive- data sent is over seperate channel originating form the FTP client’s port above port numver 1023.FTP server software that you can select from if you want to host ftp server. Example include
vsftpd,ProFTPD,uFTP.FTP clients, in addition to the FTP client commonly found on linux systems, you can use an FTP client with GUI such
FileZilla. Some web browsers also support FTP Protocol.
Simple File Transfer Protocol#
- There are various configurations for email servers; for instance, you may set up an email system to allow local users to exchange emails with each other with no access to the Internet. However, we will consider the more general setup where different email servers connect over the Internet.
- Email delivery over the Internet requires the following components:
Mail User Agent (MUA) # Simply an email client, has an email message to be sent. Connects to MSA to send message. Mail Submission Agent (MSA) # receives message from MUA, checks for errors before transferring it to MTA server Mail Transfer Agent (MTA) # will send email to the MDA of receipient. MTA can also funtion as a MSA. Mail Delivery Agent (MDA) #recipient will collect its email from the MDA using their email client. - We need to rely on email protocols to talk with an MTA and an MDA. They include
SMTPandPOP3orIMAP - SMTP is used to communicate with an MTA server. Because SMTP uses cleartext, where all commands are sent without encryption, we can use a basic Telnet client to connect to an SMTP server and act as an email client (MUA) sending a message.
- SMTP server listens on port 25 by default.
- Lets see the basic communication with SMTP protocol
telnet 10.49.186.90 25 >> heo telnet # once, we connceted, we start typing mail with helo >> mail from: sender@gmail.com >> rcpt to: receiver@gmail.com >> data # type the body >> subject: >> quit
Post Office Protocol 3 (POP3)#
- POP3 is a protocol used to download the email messages from a Mail Delivery Agent (MDA) server. The mail client connects to the POP3 server, authenticates, downloads the new email messages before (optionally) deleting them. Its defautl port 110.
telnet 10.49.186.90 110 >> USER username >> PASS pa$$word >> STAT # a positive response to stat is in format +OK nn mm, where nn is the number emails in inbox, and mm is size inbox (byte) >> LIST # list of new messages >> RETR 1 # retrive the first message >> QUIT # quit conncetions - In general, your mail client (MUA) will connect to the POP3 server (MDA), authenticate, and download the messages. Although the communication using the POP3 protocol will be hidden behind a sleek interface, similar commands will be issued, as shown in the Telnet session above.
Internet Message Access Protocol (IMAP)#
- IMAP is more sophisticated than POP3. IMAP makes it possible to keep your email synchronized across multiple devices (and mail clients). In other words, if you mark an email message as read when checking your email on your smartphone, the change will be saved on the IMAP server (MDA) and replicated on your laptop when you synchronize your inbox.
- Let’s take a look at sample IMAP commands.
telnet 10.49.186.90 143 >> c1 LOGIN username password #loggin in, imap required a random string before each command, so we added c1, c2 etc. >> c2 LIST "" "*" # listing mail folder using LIST >> c3 EXAMINE INBOX # checking for new messages in inbox >> c4 LOGOUT # logging out