UnixDroid

Lesson 2 of 5 · 6 min

The OSI model, made simple

Seven layers, one real example, and a table of which attacks happen at which layer.

The OSI model splits networking into seven layers, each with one job. You don't need to memorise it like a textbook. You need it because security people use it as shorthand: "that's a layer 2 attack" tells you a lot in three words.

The seven OSI layers and the four-layer TCP/IP model
The seven OSI layers and the four-layer TCP/IP model

One example, all seven layers

You open https://unixdroid.com on your laptop:

LayerWhat happens
7 ApplicationYour browser makes an HTTP request
6 PresentationTLS encrypts it
5 SessionThe connection to the server is kept open
4 TransportTCP splits it into segments, to port 443
3 NetworkIP adds the source and destination addresses
2 Data linkYour Wi-Fi card adds MAC addresses for the next hop
1 PhysicalIt leaves as radio waves to your router

At the server, it all runs in reverse, from layer 1 back up to 7.

TCP/IP: the model the internet really uses

In practice, networks follow the simpler TCP/IP model with four layers: Application (OSI 5–7), Transport (4), Internet (3) and Link (1–2). Both describe the same thing. OSI is just more detailed, which is why it's used for teaching and troubleshooting.

Attacks by layer

LayerExample attack
7 ApplicationSQL injection, XSS, phishing pages
4 TransportSYN flood, port scanning
3 NetworkIP spoofing, ICMP floods
2 Data linkARP spoofing, MAC flooding
1 PhysicalPlugging a rogue device into an office port

A firewall that only checks ports (layer 4) won't stop SQL injection (layer 7). That's why companies also use web application firewalls.

Memory trick, from layer 1 up: Please Do Not Throw Sausage Pizza Away.

Try it yourself
  1. Write the seven layers from memory, using the memory trick.
  2. For each of these, name the layer: an IP address, a MAC address, port 22, an HTTP cookie, an Ethernet cable.

Quick check

At which OSI layer number do TCP and UDP work?

Need a hint?

It is called the Transport layer.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →