Chapter 3b - Protocols Flashcards
RTP and SRTP
RTP stands for Real-time Transfer Protocol and is used to deliver audio and video over IP networks. This include VoIP (Voice over Internet Protocol), streaming media, video teleconferencing and more.
SRTP stands for Secure Real-Time Transfer Protocol and provides secure transmissions by using encryption, authentication and integrity for RTP.
STRP protects against replay attacks, where an attacker intercept data between two parties, modifies it and attempt to impersonate of the parties by replaying the data.
Note: Session Initiation Protocol (SIP) is used initiate, maintain and terminate voice, video and messaging sessions. Their request and response messages don’t contain any data, just metadata.
FTP
FTP stands for File Transfer Protocol and is used to upload and download large files to and from an FTP server. It is one of the oldest protocols used to transfer files between computers over a network.
It transmits data in cleartext by default and is easy to read if captured by using a protocol analyzer.
FTP active mode uses TCP port 21 for control signals and TCP port 20 for data. FTP passive mode (PASV) uses TCP port 21 for control signals but a random TCP port for data, which can be blocked if going through a firewall, so it’s best to disable PASV in FTP clients.
SSH
SSH stands for Secure Shell and is a protocol that encrypts traffic in transit over TCP port 22. It can be used to encrypt other protocols such as FTP.
SSL
SSL stands for Secure Sockets Layer, is a protocol that was previously the primary method used to secure HTTP traffic as HTTPS.
It can also be used to encrypt other types of traffic such as SMTP and LDAP.
However, SSL has been compromised and is no longer recommend for use.
TLS has since been used as a replacement for SSL and is used to encrypt many different protocols, including browser-based connections using TLS.
TLS
TLS stands for Transport Layer Security. It is a protocol used as the designated replacement for SSL. Many protocols that use TLS use the STARTTLS command to upgrade an unencrypted connection to an encrypted connection on the same port.
What is the difference between SSH and TLS?
SSH (Secure Shell) and TLS (Transport Layer Security) are both cryptographic protocols used to provide secure communication over a network, but they serve different purposes and operate at different layers of the networking stack.
SSH (Secure Shell):
-Encrypts traffic in transit and can be used to encrypt other protocols such as FTP
-Primarily used for secure remote access to a computer or server over a network
-Provides encrypted communication between the client and the server, protecting sensitive information such as passwords, commands, and data transferred over the network.
-SSH operates at the application layer (Layer 7) of the OSI model.
-Typically uses port 22 for communication.
-SSH can also be used for secure file transfer (SFTP) and secure tunneling (SSH tunneling), among other purposes
*SSH tunneling works by forwarding network traffic from a local port on your computer to a specific destination port on a remote server through an encrypted SSH connection. This enables you to securely access services, resources, or devices on a remote network as if they were local to your computer.
- TLS (Transport Layer Security):
-TLS is a cryptographic protocol used to secure communication between two endpoints, such as a web browser and a web server, over a network.
-It ensures the confidentiality and integrity of data transmitted between the client and the server, protecting against eavesdropping, tampering, and forgery.
-TLS operates at the transport layer (Layer 4) of the OSI model.
-It is commonly used to secure HTTP connections (HTTPS) for secure web browsing, as well as other protocols such as SMTP (for secure email transmission), IMAP, and POP3.
-TLS typically uses port 443 for communication (for HTTPS), but it can also use other ports depending on the application.
In summary, SSH is primarily used for secure remote access and secure file transfer, while TLS is used for securing communication between client-server applications, particularly over the web. They are complementary technologies that provide encryption and security for different types of network communication.
SFTP
SFTP is secure implementation of FTP and is an extension of SSH, using SSH to transfer files in an encrypted format. SFTP transfers data using port 22.
FTPS
FTPS is a secure implementation of FTP using TLS to encrypt FTP traffic.
Some implementations of FTPS use TCP ports 989 and 990, though TLS can also encrypt traffic over the FTP ports of 20 and 21.
SMTP
SMTP stands for Simple Mail Transfer protocol. It is used to transfer email between clients and SMTP servers.
SMTP uses port 25 for unencrypted email and port 587 email encrypted using TLS. It can also use the STARTTLS command to initialize a secure connection. It used to use port 465 for emails encrypted with SSL but that has been reassigned by IANA (Internet Assigned Number Authority).
IMAP4 And Secure IMAPnt
IMAP stands for Internet Message Access Protocol and is used to store email in an email server. It allows users to organize and manage email folders on the server.
Gmail for example uses IMAP4 via TCP port 143 for unencrypted connections and TCP port 993 for encrypted connections with Secure IMAP.
POP3 and Secure POP
POP3 stands for Post Office Protocol v3 and is used to transfer emails from servers down to clients. POP3 uses TCP port 110 for unencrypted connections and TCP port 995 for encrypted connections using Secure POP.
HTTP and HTTPS
HTTP stands for Hypertext Transfer Protocol, and transmits web traffic over the internet and in intranets. Web servers use HTTP to transmit web pages to clients’ web browsers, and Hypertext Markup Language (HTML) is the common language used to display web pages. HTTP uses port 80.
HTTPS uses SSL/TLS to encrypt web traffic to ensure it is secure while in transit. Web browsers often now display “not secure” next to the URL if not using HTTPS. HTTPS uses TCP port 443.
LDAP
LDAP stands for Lightweight Directory Access Protocol and represents the formats and methods to query directories such as Microsoft AD DS (Active Directory Domain Services). LDAP uses TCP port 389, and LDAP Secure (LDAPS) encrypts data with TLS using TCP port 636.
Note: Directory services like AD DS provide authentication services for a network.
RDP
RDP stands for Remote Desktop Protocol to connect to other systems from remote locations (they also use SSH). RDP typically uses TCP port 3389 or same UDP port.
Port 3389 is commonly blocked on firewalls, and another use case for remote access can be within a VPN.
OpenSSH
OpenSSH is a suite of tools that simplifies the use of SSH to connect to remoter servers securely.
You can use the ssh-keygen command to create a public/private key pair, and the ssh-copy-id command to copy the public key to the remote server in order to authenticate a passwordless SSH login.
NTP and SNTP
Network Time Protocol is the most commonly used protocol for time synchronization, allowing systems to synchronize their time within tens of milliseconds.
Simple NTP (SNTP) can be used for time synchronization but does not use the same complex algorithms and may not be as accurate as NTP.
DHCPex
Dynamic Host Configuration Protocol dynamically assigns IP addresses to hosts within a network. It also assigns other TCP/IP information such as subnet masks, default gateways, DNS server addresses and more.
IPv4
Uses 32 bit IP addresses (4 octets) expressed in dotted decimal format.
Public IP addresses are tightly controlled and you can’t just use any public address. They are purchased or rented from ISPs (Internet Service Providers), who purchase entire ranges of IP addresses and issue them to customers.
Private IP addresses are commonly 10.x.y.z, 172.16.y.z and 192.168.y.z. These are the only IPv4 addresses that should be allocated within a private network.
IPv6
IPv6 provides significantly larger address space than IPv4, and uses 128 bit IP addresses expressed in hexadecimal format, ie. 0-9 + A-F.
Instead of private IP addresses it used unique local addresses beginning with fc00, and not assigned to systems on the public internet.
DHCP snooping
This is a preventative measure designed to prevent unauthorized DHCP servers (rogue DHCP servers) from operating on a network. You enable it on Layer 2 switch ports.
DHCP clients and servers normally send 4 packets back and forth:
- DHCP Discover (DHCP client sends broadcast message asking a DHCP server for a lease)
- DHCP Offer (DHCP server answers and offers a lease, including an IP address, subnet mask, default gateway + more)
- DHCP Request (DHCP client responds by requesting the offered lease)
- DHCP Acknowledge (DHCP allocates the offered IP address to the DHCP client who sends back an Acknowledge).
Normally a switch will send all broadcast traffic it receives to all ports, but with DHCP snooping enabled the switch will only send DHCP broadcast traffic (the DHCP discover message) to trusted ports.
DNS
DNS stands for Domain Name System and is used for resolving host names to IP addresses. Systems are constantly querying DNS servers, which either knows the response or queries other DNS servers for a site’s IP address. Both the DNS server and the client will both put the answers in their cache so they don’t have to repeat the query.
DNS servers host data in zones, which you can think of as databases. Zones include multiple records including:
-A. Also called a host record, it records the hostname and the IPv4 address and is the most commonly used record in a DNS server. DNS client queries DNS using a forward lookup request.
-AAAA. This record holds the hostname and IPv6 addresses.
-MX records identity mail servers and if there is more than one mail server, the one with the lowest preference number in the MX record is the primary mail server. The higher number is the backup server.
*DNS uses TCP port 53 for zone transfers (when DNS servers share information with each other) and UDP port 53 for DNS client queries
**DNSSEC adds Resource Record Signature (RRSIG) which provides validation for DNS responses. It adds data integrity and authentication to DNS replies and helps prevent DNS poisoning attacks. If a DNS server receives a DNSSEC-enabled response with digitally signed records the DNS server knows the response is valid.
DNS Poisoning
Also known as DNS cache poisoning, this is when attackers modify the DNS cache with a bogus IP address. For example, an attacker could send users to a malicious site every time they want to go to espn.com.
One way is to modify the A or AAAA record in the DNS cache for espn.com, which will send users to the IP address used by the malicious site instead.