1. Home
  2. Explore
  3. Computer Science
  4. Networking Basics

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Networking Basics

Networking Basics for Cybersecurity

What Is a Network?

A network is a collection of devices connected so they can communicate and share information.

A useful analogy is a neighborhood:

  • Devices are like houses.

  • Cables and wireless signals are like roads.

  • Data is like a package traveling from one house to another.

Networked devices can include:

  • Laptops and smartphones

  • Servers and printers

  • Security cameras

  • Smart appliances

  • Traffic lights and other embedded systems

  • Any device with processing capability and a network connection

Networking is central to cybersecurity because most attacks involve communication across a network. Attackers commonly exploit:

  • Vulnerable protocols

  • Open ports

  • Misconfigured services

  • Weak authentication

  • Unencrypted traffic

  • Poorly secured network devices

Data breaches, ransomware, phishing, man-in-the-middle attacks, and many other threats rely on network access or network communication. Understanding networking therefore means understanding much of the environment that attackers target.


Three Fundamental Networking Terms

IP Address

An IP address identifies a device on a network and indicates where data should be delivered.

It serves two related purposes:

  • Identification: identifies a device.

  • Location: indicates where the device is located within a network structure.

For example, a device might have the IPv4 address 192.168.1.5. When another device sends data to that address, the network uses it to determine the destination.

An IP address is the network address of a device.

Port

A port is a numbered communication endpoint associated with a service or application running on a device.

The IP address identifies the device, while the port identifies the particular service that should receive the data.

For example:

  • Port 80: HTTP web traffic

  • Port 443: HTTPS secure web traffic

  • Port 25: SMTP email transfer

  • Port 22: SSH secure remote access

A single device can run many services simultaneously. Ports allow the operating system to direct incoming data to the correct application.

An IP address identifies the device; a port identifies the service on that device.

Protocol

A protocol is a defined set of rules that governs how devices communicate.

Protocols specify:

  • How communication begins

  • How data is formatted

  • How devices identify one another

  • How errors are detected and handled

  • When devices should send or wait

  • How communication ends

Examples include:

  • HTTP: rules for requesting and delivering web pages

  • DNS: rules for translating domain names into IP addresses

  • TCP: rules for reliable, ordered data delivery

  • UDP: rules for fast, connectionless data transmission

Communication works only when both devices follow compatible rules.


Network Types and Components

Types of Networks

Local Area Network

A LAN, or local area network, covers a relatively small geographic area, such as:

  • A home

  • A school computer laboratory

  • A small office

  • A single building

LANs are generally:

  • Fast, because devices are geographically close

  • Privately controlled

  • Managed by an individual, organization, or household

From a cybersecurity perspective, gaining access to one device on a LAN may expose other devices on the same network. Network segmentation reduces this risk by dividing a LAN into isolated zones.

Wide Area Network

A WAN, or wide area network, covers a large geographic area.

Examples include:

  • The global internet

  • A company network connecting offices in different cities

  • A bank’s private network connecting branches across a country

WAN traffic may pass through:

  • Internet service providers

  • Routers

  • Data centers

  • Multiple independent networks

Because traffic crosses many networks and devices, encryption is especially important when information travels over a WAN.

Metropolitan Area Network

A MAN, or metropolitan area network, spans a city or metropolitan region.

For example, a university might use a MAN to connect buildings distributed throughout a city.

Personal Area Network

A PAN, or personal area network, covers a very small area around an individual.

Bluetooth connections between a phone and wireless earbuds are examples of PAN communication.

Wireless LAN

A WLAN is a LAN that uses wireless communication, usually Wi-Fi, instead of or in addition to physical Ethernet cables.

A typical home Wi-Fi network is a WLAN.

Virtual Private Network

A VPN is a technology that creates an encrypted tunnel through a public network, usually the internet.

A VPN does not represent a separate physical network type. Instead, it provides a method for privately transmitting data across an otherwise public network.


Network Hardware

Router

A router connects different networks and forwards traffic between them.

For example, a home router connects:

  • The home LAN

  • The internet, which is a WAN

A router examines destination IP addresses and uses a routing table to determine where packets should go.

A switch connects devices within a network; a router connects different networks.

Cybersecurity considerations:

  • Routers are high-value targets because they control traffic entering and leaving a network.

  • Weak router passwords can allow attackers to redirect, monitor, or block traffic.

  • Compromising a router may expose every device behind it.

Switch

A switch connects multiple devices within the same local network.

Computers, printers, smart televisions, and servers can communicate through a switch.

A switch is more selective than a hub:

  • A hub broadcasts incoming data to every connected device.

  • A switch forwards data only to the intended device, based on MAC addresses.

MAC Flooding

In a MAC flooding attack, an attacker sends a large number of fake MAC addresses to overwhelm a switch’s address table.

If the switch can no longer keep track of individual devices, it may begin behaving similarly to a hub and broadcast traffic to many or all connected devices. An attacker may then capture traffic that was not intended for them.

Firewall

A firewall monitors and controls network traffic according to security rules.

It can permit or block traffic based on:

  • Source or destination IP address

  • Port number

  • Protocol

  • Connection state

  • Application characteristics

  • More complex patterns of behavior

A firewall functions like a security guard checking a guest list. It is one of an organization’s first lines of network defense.

Firewalls are not automatically sufficient. Attackers may attempt to:

  • Use allowed ports

  • Exploit permitted protocols

  • Hide malicious content inside legitimate traffic

  • Exploit firewall misconfigurations

  • Compromise systems from inside the network

Wireless Access Point

A wireless access point, or WAP, broadcasts a Wi-Fi signal that allows devices to connect to a network.

Home routers commonly contain built-in access points. Larger buildings may use multiple dedicated access points to provide coverage.

Wireless networks require strong protection because signals travel through the air. Nearby attackers may attempt to capture or interfere with wireless traffic.

Important Wi-Fi security technologies include:

  • WPA2

  • WPA3

  • Strong wireless passwords

  • Proper access-point configuration

Network Interface Card

A network interface card, or NIC, is the hardware that allows a device to communicate over a network.

A NIC may be:

  • A physical Ethernet adapter

  • A built-in Wi-Fi radio

  • Another wired or wireless network interface

Each NIC has a unique MAC address, which is used for local network communication.


Packets and Packet Switching

Large files are not normally sent as one enormous block. Instead, they are divided into smaller units called packets.

A packet generally contains:

  • A portion of the original data

  • Source IP information

  • Destination IP information

  • Sequencing or reassembly information

  • Error-checking information

A large file may be divided into thousands of packets. The packets can travel independently and may take different routes through the network before reaching the destination.

At the destination, the receiving system:

  1. Receives the packets.

  2. Checks them for errors.

  3. Uses sequencing information to arrange them.

  4. Requests missing or damaged pieces when the transport protocol supports recovery.

  5. Reassembles the original data.

This process is called packet switching and forms the basis of modern internet communication.

Packet Sniffing

A packet sniffer captures and inspects network packets. Wireshark is a common analysis tool.

Packet capture can be legitimate and useful for:

  • Troubleshooting

  • Incident response

  • Network monitoring

  • Protocol analysis

  • Security testing

However, if traffic is unencrypted, an attacker who captures the packets may read sensitive information such as credentials, messages, cookies, or session data. This is known as a sniffing attack or packet capture attack.


Client–Server and Peer-to-Peer Models

Client–Server Model

In a client–server model, devices have distinct roles:

  • A client requests a service or resource.

  • A server processes the request and provides a response.

For example:

  1. A browser acts as a client.

  2. It requests a web page.

  3. A web server receives the request.

  4. The server sends back the requested content.

Most major internet services use this model, including web search, video streaming, and online applications.

Security implications:

  • Servers often store data for many users.

  • A successful attack against a server can affect thousands or millions of clients.

  • Servers therefore require strong authentication, patching, monitoring, access control, and segmentation.

Peer-to-Peer Model

In a peer-to-peer, or P2P, model, each device can act as both client and server.

BitTorrent is an example:

  • A device downloads pieces of a file from multiple peers.

  • At the same time, it uploads pieces to other peers.

  • There is no single central server controlling the entire exchange.

Security implications:

  • P2P networks can be more difficult to monitor and control.

  • Malware may use peer-to-peer communication to spread between devices.

  • Decentralized malware can avoid reliance on one command server that defenders could disable.


Bandwidth and Latency

Bandwidth

Bandwidth is the maximum amount of data that a connection can transfer per unit of time.

It is commonly measured in:

  • Bits per second

  • Megabits per second, or Mbps

  • Gigabits per second, or Gbps

Bandwidth is similar to the number of lanes on a highway. More lanes allow more data to travel simultaneously.

A connection rated at 100100100 Mbps can theoretically transfer up to 100100100 megabits per second under ideal conditions. Actual performance may be lower because of congestion, hardware limitations, protocol overhead, or signal problems.

Latency

Latency is the time required for data to travel from its source to its destination.

Latency is commonly measured in milliseconds. Lower latency generally produces a faster-feeling connection, especially for:

  • Online games

  • Voice calls

  • Interactive remote access

  • Real-time applications

Bandwidth describes how much data can move at once; latency describes how long a particular piece of data takes to arrive.

Security Relevance

Unusual bandwidth use or sudden latency changes may indicate an attack.

A denial-of-service attack can flood a network or server with traffic until available bandwidth and processing resources are exhausted. Legitimate users are then unable to access the service.

Monitoring bandwidth, latency, and traffic patterns is an important part of intrusion detection.


The OSI Model

Purpose of the OSI Model

The OSI model, or Open Systems Interconnection model, is a conceptual framework for describing network communication.

Before standardized models, different vendors often built incompatible networking hardware and software. The OSI model divided communication into seven layers, each with a specific responsibility.

Each layer:

  • Performs a distinct task

  • Communicates with the layer above and below it

  • Can be developed independently

  • Helps different systems interoperate

The model is similar to an assembly line: each station performs one function, and the combined functions produce the final result.

The OSI model is useful for:

  • Learning networking

  • Troubleshooting

  • Categorizing technologies

  • Identifying where attacks occur

  • Describing security controls


The Seven OSI Layers

Layer 1: Physical Layer

The physical layer transmits raw bits as physical signals.

Transmission media include:

  • Copper Ethernet cables

  • Fiber-optic cables

  • Radio waves

  • Wi-Fi signals

This layer defines physical characteristics such as:

  • Signal voltage

  • Radio frequencies

  • Transmission speeds

  • Cable types

  • Connectors

  • Representation of binary values

Security threats include:

  • Cutting or damaging cables

  • Tapping physical cables

  • Intercepting signals

  • Jamming wireless frequencies

  • Gaining unauthorized physical access to network equipment

Layer 2: Data Link Layer

The data link layer organizes raw bits into frames and manages communication across a local network.

It uses MAC addresses, which are hardware identifiers associated with network interfaces.

This layer also supports:

  • Local device identification

  • Frame delivery

  • Error detection

  • Communication through switches

ARP Spoofing

ARP, or Address Resolution Protocol, maps an IP address to a MAC address on a local network.

In an ARP spoofing attack, an attacker sends false ARP messages. Devices may then associate the attacker’s MAC address with another device’s IP address, such as the default gateway.

Traffic can be redirected through the attacker, creating a man-in-the-middle position.

Layer 3: Network Layer

The network layer handles logical addressing and routing between networks.

Its main responsibilities include:

  • Using IP addresses

  • Selecting paths

  • Forwarding packets between networks

  • Connecting geographically separated networks

Routers primarily operate at this layer.

IP Spoofing

In IP spoofing, an attacker forges the source IP address in a packet.

Spoofing can:

  • Hide the apparent origin of traffic

  • Impersonate another system

  • Support denial-of-service attacks

  • Make investigation more difficult

Layer 4: Transport Layer

The transport layer provides communication between applications running on devices.

Its responsibilities can include:

  • Dividing data into segments

  • Reassembling segments

  • Flow control

  • Error recovery

  • Retransmission

  • Port addressing

  • End-to-end delivery

TCP and UDP operate at this layer.

Security threats include:

  • Port scanning

  • TCP SYN flood attacks

  • Abuse of transport-layer connection behavior

Layer 5: Session Layer

The session layer manages the lifecycle of communication sessions.

A session has a beginning, an active exchange, and an ending. The layer may also support:

  • Session establishment

  • Session maintenance

  • Session termination

  • Authentication coordination

  • Synchronization

  • Checkpoints for long transfers

Session Hijacking

In session hijacking, an attacker steals an active session identifier or token.

The attacker may then impersonate an authenticated user without knowing the user’s password. Protecting session tokens, using encryption, and expiring inactive sessions help reduce this risk.

Layer 6: Presentation Layer

The presentation layer handles the representation and transformation of data.

Its responsibilities include:

  • Translating between data formats

  • Character encoding conversion

  • Encryption and decryption

  • Compression and decompression

Secure web communication uses TLS for encryption and authentication. Weak or outdated cryptography at this level can allow attackers to recover or inspect protected information.

Layer 7: Application Layer

The application layer contains the protocols used directly by network applications.

Examples include:

  • HTTP and HTTPS

  • DNS

  • FTP and SFTP

  • SMTP

  • SSH

The layer does not mean the graphical application itself. It refers to the communication protocols used by applications.

Many attacks occur at this layer because it is closely connected to user input and exposed services. Examples include:

  • SQL injection

  • Cross-site scripting

  • Phishing

  • Malware command-and-control communication

  • Application-layer protocol abuse

OSI Layer Memory Aid

The phrase “Please Do Not Throw Sausage Pizza Away” represents the layers from bottom to top:

  1. Physical

  2. Data Link

  3. Network

  4. Transport

  5. Session

  6. Presentation

  7. Application


Encapsulation and Decapsulation

When data moves down the OSI layers on the sending device, each layer adds its own control information.

This process is called encapsulation:

  1. The application layer creates application data, such as an HTTP request.

  2. The transport layer adds a TCP or UDP header containing port information.

  3. The network layer adds an IP header containing source and destination IP addresses.

  4. The data link layer adds a frame header containing local MAC addresses.

  5. The physical layer converts the result into electrical signals, light pulses, or radio waves.

At the receiving device, the process is reversed. Each layer removes and interprets its own information before passing the remaining data upward. This is called decapsulation.

Tunneling

Attackers can hide data inside traffic that appears legitimate. This technique is called tunneling.

For example, malware may encode stolen information inside DNS requests. Since many networks allow DNS traffic, the malicious data may leave the network without immediately attracting attention. This technique is called DNS tunneling.


Web Page Loading Through the OSI Layers

When a user enters a secure website address, communication involves all seven layers:

  • Application layer: The browser creates an HTTP request.

  • Presentation layer: TLS encryption is negotiated and applied.

  • Session layer: A communication session is established.

  • Transport layer: TCP divides the request into segments and uses port 443.

  • Network layer: Source and destination IP addresses are added.

  • Data link layer: MAC addresses support local delivery.

  • Physical layer: Bits travel as electrical signals, light pulses, or radio waves.

The server’s response travels back through the same layers in reverse order.


The TCP/IP Model

Purpose and Structure

The TCP/IP model is the practical networking model used by the internet.

It originated during the development of ARPANET and is commonly represented using four layers:

  1. Network access

  2. Internet

  3. Transport

  4. Application

Some versions divide the network access layer into two layers, producing a five-layer version.

TCP/IP and OSI Mapping

TCP/IP Application Layer

This combines the responsibilities of the OSI:

  • Application layer

  • Presentation layer

  • Session layer

TCP/IP Transport Layer

This corresponds to the OSI transport layer.

TCP/IP Internet Layer

This corresponds to the OSI network layer.

TCP/IP Network Access Layer

This combines the OSI:

  • Data link layer

  • Physical layer

The OSI model is useful for conceptual thinking and troubleshooting. The TCP/IP model more closely reflects actual internet implementation. Both are valuable because cybersecurity professionals need to understand both abstract organization and real-world protocols.


TCP/IP Layers

Network Access Layer

The network access layer manages local network communication, including:

  • Ethernet

  • Wi-Fi, including IEEE 802.11

  • Physical signaling

  • Data-link framing

  • MAC addressing

  • Local delivery

Internet Layer

The internet layer manages logical addressing and routing between networks.

Important protocols include:

  • IPv4

  • IPv6

  • ICMP

  • ARP

ICMP supports diagnostic and control messages. The ping utility commonly uses ICMP to test whether a device is reachable.

ARP maps local IP addresses to MAC addresses.

Security relevance:

  • Ping can help analysts and attackers identify active devices.

  • Network scanners use ICMP and TCP techniques to discover hosts and services.

  • IP spoofing and routing attacks target this layer.

Transport Layer

The transport layer provides end-to-end communication between applications.

Its major protocols are:

  • TCP: reliable, ordered, connection-oriented delivery

  • UDP: fast, connectionless delivery without a guarantee of arrival

Port numbers also operate at this layer and identify the receiving application.

Application Layer

The TCP/IP application layer contains the protocols used by network applications, including:

  • HTTP and HTTPS for web browsing

  • DNS for name resolution

  • SMTP, IMAP, and POP3 for email

  • FTP and SFTP for file transfer

  • SSH for secure remote access

  • DHCP for automatic IP configuration

  • Telnet for older remote access

Security weaknesses vary by protocol:

  • FTP sends credentials and data in plaintext.

  • Telnet sends commands and passwords in plaintext.

  • DNS can be spoofed or abused for tunneling.

  • SMTP can be abused for spam and phishing.

  • Unsecured application protocols expose sensitive data to interception.


IP Addressing

Purpose of IP Addresses

An IP address is a logical address assigned to a device connected to a network.

It provides:

  • Device identification

  • Network location

  • A destination for packet delivery

The two major versions are IPv4 and IPv6.


IPv4

An IPv4 address contains 323232 bits and is written as four decimal numbers separated by periods.

Example:

192.168.1.100

Each section, called an octet, contains 888 bits and ranges from 000 through 255255255.

IPv4 provides approximately 4.34.34.3 billion possible addresses. This was once considered sufficient, but the number of internet-connected devices eventually exceeded the available address space.

IPv4 exhaustion became a major issue around 2011. Technologies such as NAT have extended IPv4’s usefulness, but they do not eliminate the underlying limitation.

IPv6

IPv6 uses 128128128-bit addresses and is written in hexadecimal groups separated by colons.

Example:

2001:0db8:85a3:0000:0000:8a2e:0370:7334

IPv6 provides an extremely large address space and is designed to eliminate the shortage associated with IPv4.

Many networks currently use dual stack, meaning IPv4 and IPv6 operate simultaneously.

Cybersecurity controls must protect both protocols. If firewalls, monitoring systems, or filtering rules support IPv4 but ignore IPv6, attackers may use IPv6 as a security blind spot.


Public and Private IP Addresses

Public IP Addresses

A public IP address is globally unique and reachable across the internet.

Examples include:

  • The public address assigned to a web server

  • The public address assigned to a home router by an ISP

This is generally the address visible to external websites when devices behind the router connect to the internet.

Private IP Addresses

A private IP address is used within a local network and is not directly routable across the public internet.

The main private IPv4 ranges are:

  • 10.0.0.0/8

  • 172.16.0.0/12

  • 192.168.0.0/16

For example, devices on a home network might use:

  • Laptop: 192.168.1.5

  • Phone: 192.168.1.6

  • Router: 192.168.1.1

Private addresses are meaningful within the local network but cannot independently identify a device on the public internet.


Network Address Translation

NAT, or network address translation, allows multiple devices with private IP addresses to share one public IP address.

A typical process is:

  1. A local device sends a request using its private IP address.

  2. The router replaces the private source address with its public IP address.

  3. The router records the translation, often including port information.

  4. The request travels across the internet.

  5. The response returns to the router’s public address.

  6. The router consults its translation table.

  7. The router converts the destination back to the appropriate private address.

  8. The response is delivered to the original device.

NAT provides a degree of concealment because internal addresses are not directly exposed to the internet. However, NAT is not a complete security solution. It does not replace firewalls, authentication, patching, or access controls.

Forensic Relevance of NAT

A public IP address may represent many internal devices. If investigators see traffic from one public address, they may need NAT logs to determine which internal device generated the traffic.


Static and Dynamic IP Addresses

Static IP Address

A static IP address is manually assigned and remains unchanged.

Static addresses are useful for:

  • Servers

  • Network infrastructure

  • Printers

  • Services that must always be reachable at a known address

Dynamic IP Address

A dynamic IP address is assigned automatically, usually by a DHCP server, and may change over time.

Most home devices use dynamic addressing. An ISP may also periodically change a customer’s public IP address.

DHCP Attacks

DHCP starvation occurs when an attacker sends many fake address requests, exhausting the available pool of IP addresses.

Legitimate devices may then be unable to connect.

An attacker may follow this by deploying a rogue DHCP server that provides false network settings. This can direct traffic through the attacker and support a man-in-the-middle attack.


Special IP Addresses

Loopback Address

The IPv4 loopback address is 127.0.0.1, commonly associated with the hostname localhost.

It always refers to the local device itself. A connection to localhost does not travel onto the external network.

Malware may use localhost to operate hidden local services, so analysts must understand what processes are listening on loopback interfaces.

Default Gateway

The default gateway is usually the local router’s IP address.

When a device needs to communicate outside its local network, it forwards the packet to the default gateway. Common examples include:

  • 192.168.1.1

  • 192.168.0.1

Broadcast Address

A broadcast address sends data to all devices on a local network.

For a network such as 192.168.1.0/24, the broadcast address is commonly 192.168.1.255.

Some denial-of-service attacks, such as Smurf attacks, abuse broadcast behavior by causing many devices to send responses toward a victim.


MAC Addresses

A MAC address, or media access control address, is a hardware address associated with a network interface.

It is generally written as six pairs of hexadecimal characters, such as:

00:1A:2B:3C:4D:5E

MAC addresses:

  • Operate at the OSI data link layer

  • Support communication within a local network

  • Are associated with network interface hardware

  • Do not normally remain constant across routed networks

When a packet crosses a router, the local MAC addresses are replaced for the next network segment, while the end-to-end IP addresses generally remain the same.

MAC Spoofing

MAC spoofing changes the apparent MAC address of a network interface.

An attacker may use it to:

  • Impersonate another device

  • Bypass MAC-based access restrictions

  • Hide the identity of a device

  • Evade simplistic network controls

MAC addresses should not be treated as strong identity or authentication mechanisms.


Subnetting

A subnet is a smaller network created within a larger network.

Subnetting improves:

  • Organization

  • Network performance

  • Traffic management

  • Security isolation

For example, an organization might place:

  • Web servers in one subnet

  • Databases in another

  • Employee devices in a separate subnet

  • Administrative systems in another zone

Traffic between subnets can then be controlled with routers and firewalls.

If an attacker compromises one subnet, segmentation can prevent automatic access to every other system. This limits the blast radius of an intrusion.

Subnet Masks

A subnet mask identifies which part of an IPv4 address represents the network and which part represents the host.

Example:

  • IP address: 192.168.1.5

  • Subnet mask: 255.255.255.0

The first three octets identify the network, while the last octet identifies the host.

The corresponding network is:

192.168.1.0/24

A /24 network contains 256256256 total addresses, including the network address and broadcast address, leaving 254254254 commonly usable host addresses.

CIDR Notation

CIDR notation, or Classless Inter-Domain Routing notation, expresses the number of network bits using a slash followed by a number.

Examples:

  • /8: very large network

  • /16: large network

  • /24: relatively small network

  • /30: commonly used for point-to-point links

The number indicates how many of the 323232 IPv4 bits belong to the network portion.


Ports and Protocols

Port Numbers

A port is a communication endpoint represented by a number from 000 through 65,53565{,}53565,535.

The IP address directs traffic to a device, while the port directs the traffic to a particular service on that device.

For example:

  • Port 80 identifies HTTP.

  • Port 443 identifies HTTPS.

  • Port 22 identifies SSH.

Port Categories

Well-Known Ports

Well-known ports range from 000 through 102310231023 and are associated with standard services.

Examples:

  • HTTP: 80

  • HTTPS: 443

  • SSH: 22

  • DNS: 53

  • FTP: 21

Registered Ports

Registered ports range from 102410241024 through $49151 and are commonly assigned to particular applications or services.

Examples:

  • MySQL: 3306

  • PostgreSQL: 5432

  • RDP: 3389

  • Alternate HTTP: 8080

Dynamic or Ephemeral Ports

Dynamic, or ephemeral, ports range from 491524915249152 through 655356553565535.

They are temporary ports commonly used by clients. For example, a browser connecting to a server on port 443 may use a temporary source port so that responses can be directed to the correct browser process.

Common Ports to Know

  • FTP: 20 and 21

  • SSH: 22

  • Telnet: 23

  • SMTP: 25

  • DNS: 53

  • DHCP: 67 and 68

  • HTTP: 80

  • POP3: 110

  • IMAP: 143

  • HTTPS: 443

  • MySQL: 3306

  • RDP: 3389

  • Alternate HTTP: 8080

Port Scanning and Attack Surface

Attackers commonly perform port scanning to identify open ports and determine which services are running.

Open ports are not automatically vulnerabilities, but each exposed service increases the potential attack surface. A basic security principle is:

Close or restrict ports that are not required.

Reducing unnecessary services and ports makes it more difficult for attackers to find exploitable entry points.


DNS

The Domain Name System, or DNS, translates human-readable domain names into IP addresses.

It functions similarly to a telephone directory:

  • Input: google.com

  • Output: an IP address for Google’s server

DNS Resolution Process

A typical lookup follows these steps:

  1. The user enters a domain name.

  2. The browser or operating system checks its local DNS cache.

  3. If no cached answer exists, the device contacts a DNS resolver.

  4. The resolver may be operated by an ISP, router, organization, or public provider.

  5. If necessary, the resolver queries the DNS hierarchy.

  6. Root servers direct the resolver to the appropriate top-level-domain servers.

  7. The top-level-domain servers direct it to authoritative name servers.

  8. The authoritative server provides the domain’s IP address.

  9. The result is cached for future use.

  10. The browser connects to the returned IP address.

DNS commonly uses UDP port 53 for ordinary queries, although TCP and encrypted DNS technologies are also used in specific situations.

DNS Security Threats

DNS Spoofing

In DNS spoofing, an attacker causes a system to receive a false IP address for a legitimate domain.

A user may believe they are visiting a bank or other trusted service while actually connecting to an attacker-controlled site.

DNS Tunneling

In DNS tunneling, attackers encode data inside DNS queries or responses. This can be used to:

  • Exfiltrate data

  • Establish covert communication

  • Bypass network controls that permit DNS traffic

DNS security mechanisms and encrypted DNS technologies can reduce certain risks, but they must be correctly configured and monitored.


HTTP and HTTPS

HTTP

HTTP, or Hypertext Transfer Protocol, is used to request and deliver web resources.

A browser may send a request such as:

GET /index.html HTTP/1.1
Host: example.com

The server returns a response containing:

  • A status code, such as 200 OK

  • Headers

  • Content type

  • The requested page or resource

HTTP is unencrypted. Anyone able to capture the traffic may read:

  • Usernames

  • Passwords

  • Session information

  • Cookies

  • Page contents

  • Other transmitted data

HTTPS

HTTPS is HTTP protected by TLS encryption.

TLS provides:

  • Confidentiality through encryption

  • Integrity against unauthorized modification

  • Server authentication through digital certificates

The browser’s padlock indicator generally means that an authenticated TLS connection has been established, although it does not guarantee that the website itself is trustworthy.

Security threats include:

  • SSL-stripping attacks that attempt to downgrade HTTPS to HTTP

  • Fraudulent or improperly trusted certificates

  • Incorrect TLS configuration

  • Exposure through insecure page resources

HSTS, or HTTP Strict Transport Security, instructs browsers to use HTTPS and helps prevent downgrade attacks.

Security professionals commonly use web proxies such as Burp Suite in authorized testing environments to inspect and analyze HTTP and HTTPS requests.


Email Protocols

Email communication uses multiple protocols.

SMTP

SMTP, or Simple Mail Transfer Protocol, sends email.

It transports messages:

  • From a user’s device to a mail server

  • Between mail servers

  • Toward the recipient’s mail server

Common SMTP ports include:

  • 25

  • 587

  • 465

SMTP was designed when the internet was more trusted and has limited built-in identity verification.

IMAP

IMAP, or Internet Message Access Protocol, allows users to read and manage email while messages remain stored on the mail server.

This supports synchronization across multiple devices.

Common ports include:

  • 143

  • 993 for secure IMAP

POP3

POP3, or Post Office Protocol version 3, generally downloads email messages to a device.

Depending on configuration, messages may be removed from the server after download.

Common ports include:

  • 110

  • 995 for secure POP3

Email Security

Email is a major attack vector for phishing and fraud.

Technologies that help verify email origins include:

  • SPF: specifies which servers are authorized to send mail for a domain.

  • DKIM: adds a cryptographic signature to help verify message integrity and origin.

  • DMARC: allows domain owners to define how receiving systems should handle messages that fail authentication checks.

Understanding these protocols helps analysts investigate phishing messages and identify forged sender information.


SSH and Telnet

SSH

SSH, or Secure Shell, provides encrypted remote command-line access, usually over port 22.

SSH protects:

  • Commands

  • Passwords

  • Files

  • Session content

It also supports key-based authentication, in which cryptographic keys are used instead of passwords.

Security best practices include:

  • Prefer key-based authentication.

  • Disable password login where practical.

  • Use strong access controls.

  • Restrict which users may connect.

  • Monitor authentication logs.

  • Rate-limit or block repeated failed attempts.

  • Consider changing the default port as a supplementary measure, though this does not replace real security controls.

SSH is frequently targeted by automated bots that scan for exposed port 22 services and attempt large numbers of login combinations.

Telnet

Telnet is an older remote-access protocol that transmits communication in plaintext.

Attackers who capture Telnet traffic may read:

  • Commands

  • Usernames

  • Passwords

  • Session content

Telnet should generally be replaced with SSH.


FTP, SFTP, and FTPS

FTP

FTP, or File Transfer Protocol, commonly uses ports 20 and 21.

Traditional FTP is insecure because it transmits credentials and file data without encryption.

An exposed FTP server is a potential security concern, particularly if it permits anonymous FTP, which allows users to connect without normal credentials.

SFTP

SFTP, or SSH File Transfer Protocol, transfers files through an SSH connection.

It provides encrypted communication and is generally preferred over traditional FTP.

FTPS

FTPS is FTP protected with TLS encryption.

SFTP and FTPS both provide secure file transfer, but they are different protocols with different implementations and operational requirements.


TCP and UDP

Why Two Transport Protocols Exist

Applications have different communication requirements:

  • Some require every piece of data to arrive correctly and in order.

  • Others prioritize speed and can tolerate occasional loss.

TCP emphasizes reliability. UDP emphasizes speed and low overhead.


TCP

TCP, or Transmission Control Protocol, is:

  • Connection-oriented

  • Reliable

  • Ordered

  • Error-aware

TCP Three-Way Handshake

Before sending application data, TCP establishes a connection through a three-step handshake:

  1. SYN: The client requests a connection.

  2. SYN-ACK: The server acknowledges the request and indicates readiness.

  3. ACK: The client acknowledges the server.

The connection is then established.

TCP also uses a controlled shutdown process involving FIN and ACK messages.

TCP Reliability Features

TCP supports:

  • Ordered delivery

  • Acknowledgments

  • Retransmission of missing data

  • Error detection

  • Flow control

  • Congestion management

TCP is appropriate when incomplete or out-of-order data would be unacceptable, such as for:

  • Web browsing

  • Email

  • File transfers

  • Database communication

  • Secure remote access

TCP Security Threats

SYN Flood

In a SYN flood, an attacker sends many TCP connection requests but does not complete the handshakes.

The server keeps partial connections open while waiting for final acknowledgments. A large number of half-open connections can consume server resources and prevent legitimate users from connecting.

Defenses include:

  • SYN cookies

  • Rate limiting

  • Connection thresholds

  • Filtering suspicious traffic

  • Adequate resource management

TCP Port Scanning

A scanner may send SYN packets to determine whether ports are open. If a service responds, the scanner may immediately terminate the connection rather than completing it.

This type of probing is commonly called a stealth scan because it may create fewer complete sessions and leave fewer obvious traces.


UDP

UDP, or User Datagram Protocol, is:

  • Connectionless

  • Fast

  • Lightweight

  • Unordered

  • Not guaranteed to deliver data

UDP does not perform a handshake, wait for acknowledgments, or automatically retransmit lost data. It sends datagrams and moves on.

UDP is useful when speed is more important than perfect delivery, including:

  • DNS queries

  • Video streaming

  • Voice calls

  • Online gaming

  • DHCP

  • SNMP network monitoring

  • TFTP

For real-time media, waiting for retransmission may be worse than losing a small amount of audio or video.

Application-Level Reliability

An application can use UDP while implementing its own reliability mechanisms.

QUIC, used by HTTP/3, runs over UDP but adds features such as:

  • Ordering

  • Error handling

  • Loss recovery

  • Secure connection establishment

This combines some of UDP’s speed and flexibility with reliability features traditionally associated with TCP.

UDP Security Threats

UDP’s lack of connection establishment makes source-address spoofing easier.

Reflection and Amplification Attacks

A reflection and amplification attack works as follows:

  1. The attacker sends a small UDP request.

  2. The attacker spoofs the victim’s IP address as the source.

  3. A server receives the request.

  4. The server sends a much larger response to the victim.

  5. Many servers repeat this process, flooding the victim.

It is called:

  • Reflection because third-party servers reflect traffic toward the victim.

  • Amplification because a small request produces a much larger response.

Examples include:

  • DNS amplification

  • NTP amplification

These attacks can generate massive denial-of-service traffic.


TCP and UDP Comparison

Connection

  • TCP: Establishes a connection before sending data.

  • UDP: Sends data without establishing a connection.

Reliability

  • TCP: Acknowledges delivery and retransmits missing data.

  • UDP: Does not guarantee delivery.

Ordering

  • TCP: Delivers data in order.

  • UDP: Does not guarantee order.

Speed

  • TCP: Slower because of handshakes, acknowledgments, and control mechanisms.

  • UDP: Faster because it has less overhead.

Error Handling

  • TCP: Handles recovery automatically.

  • UDP: Leaves recovery to the application.

Header Size

  • TCP: Uses a larger header.

  • UDP: Uses a smaller, lightweight header.

TCP is appropriate when data must arrive completely and correctly. UDP is appropriate when data must arrive quickly and occasional loss is acceptable.


The Complete Journey of a Web Request

Consider a user entering a secure website address into a browser.

1. The Browser Interprets the URL

The browser receives a domain name and determines that it needs to locate a server and request web resources.

2. DNS Resolution

The browser needs an IP address for the domain.

A typical process is:

  1. The browser checks its DNS cache.

  2. The operating system checks its local cache.

  3. The device sends a query to a configured DNS resolver.

  4. The resolver follows the DNS hierarchy if necessary.

  5. The authoritative DNS server returns the correct IP address.

  6. The result is cached.

  7. The browser now has a destination IP.

DNS commonly uses UDP port 53 for ordinary queries.

Security risks include:

  • DNS poisoning

  • DNS spoofing

  • DNS tunneling

  • Manipulation of resolver responses

DNSSEC and encrypted DNS technologies can help protect the integrity or privacy of DNS resolution, depending on deployment.

3. IP Routing

The device checks whether the destination IP is on the local network.

  • If it is local, the device can communicate directly.

  • If it is remote, the device sends the packet to its default gateway.

The router examines the destination IP and routing table, then forwards the packet to the next router. This process repeats across multiple networks until the destination is reached.

Security threats include:

  • IP spoofing

  • Routing manipulation

  • BGP hijacking

  • Large-scale traffic redirection

A routing misconfiguration can redirect substantial amounts of internet traffic through an unintended network.

4. TCP Handshake

Because HTTPS commonly uses TCP, the client connects to the destination on port 443.

The TCP handshake occurs:

  1. Client sends SYN.

  2. Server returns SYN-ACK.

  3. Client sends ACK.

The TCP connection is now established.

Although handshake packets do not contain the full application data, they can still reveal communication patterns and may be used for scanning or denial-of-service attacks.

5. TLS Handshake

Before protected application data is sent, the browser and server perform a TLS handshake.

They:

  • Negotiate cryptographic algorithms.

  • Exchange and validate certificates.

  • Establish shared encryption keys.

  • Create an encrypted communication channel.

Afterward, captured packets should contain ciphertext rather than readable web content.

Potential attacks include:

  • SSL stripping

  • Fraudulent certificates

  • Weak cryptographic configuration

  • Improper certificate validation

HSTS helps force browsers to use HTTPS rather than falling back to HTTP.

6. HTTP Request

The browser sends an HTTP request through the encrypted HTTPS connection.

A request may contain:

  • Request method, such as GET

  • Requested path

  • HTTP version

  • Host header

  • User-Agent header

  • Cookies

  • Session tokens

  • Other headers

The request is encapsulated:

  1. HTTP data is created.

  2. TCP adds transport information and segments it.

  3. IP adds source and destination addresses.

  4. The data link layer adds local MAC information.

  5. The physical layer transmits the bits.

HTTP headers can reveal information useful for reconnaissance. Security headers such as Content Security Policy and X-Frame-Options can help reduce risks such as cross-site scripting and clickjacking.

7. Server Processing and Response

The server receives and processes the request.

A response may include:

  • Status code such as 200 OK

  • Content-Type header

  • Additional security and caching headers

  • HTML content

  • Other requested resources

The response is divided into segments and packets for transmission back to the client. TCP reassembles the data and requests retransmission if necessary.

Network encryption does not guarantee that the server is secure. The server may still contain:

  • SQL injection vulnerabilities

  • Unpatched software

  • Weak permissions

  • Insecure application logic

  • Misconfigured services

8. Browser Rendering

The browser parses the returned HTML and begins constructing the page.

It may request additional:

  • CSS files

  • JavaScript files

  • Images

  • Fonts

  • API responses

  • Other web resources

Each additional resource can trigger more DNS lookups, TCP or other transport activity, TLS negotiation, and HTTP requests.


Defense in Depth

Every stage of network communication presents potential attack surfaces:

  • Physical layer: cables can be tapped or wireless signals jammed.

  • Data link layer: ARP spoofing and MAC flooding can redirect or expose local traffic.

  • Network layer: IP spoofing and routing attacks can manipulate packet paths.

  • Transport layer: port scanning, SYN floods, and UDP amplification can disrupt services.

  • Session layer: stolen tokens can enable session hijacking.

  • Presentation layer: weak encryption can expose protected data.

  • Application layer: phishing, injection, malware, and protocol abuse can compromise systems.

Because no single control is perfect, secure organizations use defense in depth. Multiple protections are deployed across layers so that the failure of one control does not cause the entire system to collapse.

Important defensive practices include:

  • Segmenting networks into controlled zones

  • Closing unnecessary ports

  • Encrypting data in transit

  • Securing routers and access points

  • Monitoring bandwidth, latency, and packet patterns

  • Patching servers and applications

  • Using strong authentication

  • Protecting both IPv4 and IPv6 traffic

  • Logging NAT and authentication activity

  • Inspecting suspicious DNS and email behavior

  • Using firewalls and access controls

  • Limiting administrative services

  • Monitoring for abnormal connections and traffic flows

Networking is the foundation of cybersecurity because attacks and defenses both depend on how devices identify one another, establish communication, move packets, expose services, and protect information during transit.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent