SEC101/Advanced Topics
ENUA

Advanced Networking

Understand how the internet really works under the hood. Optional deep dive — skipping it won't hurt your everyday safety.

How DNS Works

When you type 'google.com', your computer needs to find the actual server address. DNS (Domain Name System) is like the internet's phone book - it translates human-readable names into IP addresses.

DNS Resolution

DNS Resolution visualization. Review the labels and use the controls, when present, to step through the diagram.

Where is google.com?
12345678Your DeviceDNS ResolverRoot ServerTLD ServerAuth Server
Question: where is google.com?
Step 1 of 5

Your device asks its helper

Computers need numbers, not names

You typed google.com, but computers find each other by number (an IP address). Your device asks its helper — the resolver — “what number is google.com?”

The resolver is like a helpful librarian: it doesn’t know every answer, but it knows exactly where to look.
Technical Details

DNS usually uses UDP port 53 for queries, but TCP port 53 is also part of DNS. The TTL (Time To Live) determines how long a result is cached. DoT uses TLS on port 853; DoH sends DNS over HTTPS on port 443. Encrypted DNS protects the client-to-resolver hop, but the resolver still sees the query.

DNS is why changing one setting — your DNS provider — can block many unwanted domains network-wide. Devices or apps can bypass it if they use their own DNS settings.

The OSI Model

The OSI model breaks down network communication into 7 layers. Each layer has a specific job, making troubleshooting and understanding easier. It is a way of thinking about the journey, not a literal list of programs — real networks blur the lines. Remember: 'Please Do Not Throw Sausage Pizza Away'.

OSI Model

OSI Model visualization. Review the labels and use the controls, when present, to step through the diagram.

Sending...
7
ApplicationHTTP, DNS
Data
6
PresentationTLS, JPEG
5
SessionConnections
4
TransportTCP, UDP
3
NetworkIP, Routing
2
Data LinkMAC, Ethernet
1
PhysicalCables, Wi-Fi
Step 1 / 14
You press Send

A message starts in an app — your browser, email, or chat. This is the only layer you ever see.

You never see these layers, but they explain tech-support logic: “Is Wi‑Fi on?” is layer 1, “does the site load?” is layer 7. Finding the broken layer is how network problems get fixed.

Understanding Ports

Think of your computer as an apartment building. The IP address is the building address, and each port is a different apartment number where different services live.

Ports: The Apartment Building

Ports: The Apartment Building visualization. Review the labels and use the controls, when present, to step through the diagram.

Your ComputerIP: 192.168.1.100
Visitor:80
:80
HTTPWeb (unencrypted)
Resident
:443
HTTPSWeb (secure)
:22
SSHRemote access
:25
SMTPEmail
:53
DNSName lookup
Step 1 / 5
Door 80: the old web

A visitor knocks on door 80 — plain web pages (HTTP). It works, but conversations through this door aren’t private.

One building (your computer, one IP address) hosts many services — the port number is just which door to knock on. A firewall protects you by keeping unused doors shut. Any service can sit behind any door number, so the number is a habit, not a guarantee.

Network Protocols

Protocols are the rules computers use to talk to each other. Different protocols serve different purposes - some prioritize speed, others reliability or security.

Protocol Comparison

Protocol Comparison visualization. Review the labels and use the controls, when present, to step through the diagram.

HTTP (postcard)
You
Hello!
“Hello!”Visible to hackers
Website
HTTPS (sealed)
You
•••••
?????Encrypted
Website
Step 1 / 4
Sending a postcard

Over plain HTTP, your message travels like a postcard — words out in the open.

You don’t choose these — apps do. But the padlock (HTTPS) is yours to check before typing a password.

How Firewalls Work

A firewall is like a security guard for your network. It can check incoming and outgoing traffic and decides, by its rules, what to let through and what to block.

Firewall Protection

Firewall Protection visualization. Review the labels and use the controls, when present, to step through the diagram.

Internet
:443 ✓secure web:80 ✓web:23 ✗old remote control
Your Network
Allowed Blocked
Step 1 / 5
The doorman

A firewall stands between networks or apps, checking traffic against its rules.

Your router and your computer each run a firewall. You rarely notice them — that’s the point.

SSL/TLS Handshake

Before your browser can securely communicate with a website, they perform a 'handshake' to establish trust and agree on encryption. This happens when a secure session is established (for example, first connection or session renewal).

TLS Handshake

TLS Handshake visualization. Review the labels and use the controls, when present, to step through the diagram.

Browser
Server
1Hello!
2Here’s my ID
3Secret agreed
4Private channel
Step 1 of 4

Hello, let’s talk privately

Your browser makes contact

Your browser calls the site: “I’d like a private line. Here are the secret-code styles I can speak.”

Ways to scrambleA random number
Like greeting a bank teller and asking for a private room

Without TLS or another protective layer, passwords and personal data can travel in readable plain text. The padlock means the connection is encrypted, not that the site is honest.

Technical details

The steps above simplify the TLS 1.3 handshake. ClientHello offers versions, cipher suites, and a key share. ServerHello chooses parameters; later encrypted handshake messages carry the certificate and authentication. Ephemeral Diffie-Hellman plus HKDF derives traffic keys, and records are protected with AEAD ciphers such as AES-GCM or ChaCha20-Poly1305. A full handshake usually takes one round trip.

IPv4 vs IPv6

The internet is running out of IPv4 addresses. IPv6 is its successor with virtually unlimited addresses, but the switch is still ongoing.

IPv4 vs IPv6

IPv4 vs IPv6 visualization. Review the labels and use the controls, when present, to step through the diagram.

IPv4
 |
4.3 billion
Running out
vs
IPv6
2001:0db8:85a3::8a2e:0370:7334
2^128 addresses
Virtually unlimited
Step 1 / 4
Every device needs a number

To talk on an IP network, devices use IP addresses — like phone numbers for computers.

Your devices switch between the two automatically — usually nothing to configure. It’s simply why internet addresses come in two shapes.

Web App Security Basics

These ideas explain many real website bugs. You do not need to memorize attack names first; focus on what the browser sends, what the server must check, and where untrusted input must stay as data.

ID

Cookies, sessions, and tokens

HTTP does not remember users by itself, so sites use cookies or tokens to recognize that the same browser is logged in. A session cookie is like a temporary badge, not a place to store a password.

Like a festival wristband: the gate checks it on every entry — and anyone wearing yours gets in as you.
  • HttpOnly keeps page JavaScript from reading a cookie.
  • Secure means the cookie is sent only over HTTPS.
  • SameSite limits when cookies are sent with cross-site requests.
WEB

Same-origin policy and CORS

A browser origin is protocol + domain + port. The same-origin policy usually stops JavaScript from one origin from reading private data from another origin.

Like hotel key cards: your card opens only your room — CORS is the front desk granting specific guests access to specific doors.
  • CORS is a server's controlled permission for selected cross-origin reads.
  • CORS is not login, authorization, or a firewall.
  • Some cross-site requests can still be sent, so servers still need CSRF defenses.
API

REST APIs

A REST API is a structured way for apps and servers to work with resources over HTTP. The method and status code should tell a clear story.

Like ordering through a waiter: a fixed menu of actions, and the kitchen checks every order before cooking.
  • GET reads; POST creates or performs an action; PUT/PATCH update; DELETE removes.
  • Every request must be checked: who is calling, what they may do, and whether the input is valid.
  • HTTPS protects API credentials while they travel over the network.
JS

XSS

Cross-site scripting happens when attacker-controlled content runs as JavaScript inside a trusted page. Then the page can act with the user's access.

Like slipping a fake announcement into the official PA system — everyone trusts it because of where it plays from.
  • Treat user input as data, not HTML or code.
  • Use safe output encoding, safe DOM APIs, and sanitizing for any allowed HTML.
  • Content Security Policy can reduce damage, but it does not replace fixing the bug.
REQ

CSRF

Cross-site request forgery abuses the fact that browsers may attach login cookies automatically. A malicious page tries to make the victim's browser send a real request.

Like a forged letter sent in your name — the bank recognizes your signature stamp, so it obeys.
  • Use anti-CSRF tokens for state-changing actions.
  • Set SameSite cookies where possible.
  • Re-check intent for sensitive actions like password, email, or payment changes.
DB

SQL injection

SQL injection happens when untrusted input is joined into a database command. The database may read it as instructions instead of plain text.

Like writing 'and hand me the keys' in the name field of a form — and the clerk actually does it.
  • Use parameterized queries or prepared statements.
  • Do not build SQL by joining strings with user input.
  • Least-privilege database accounts limit damage if a bug slips through.
HDR

Security headers

Security headers are instructions a server sends so the browser can enforce safer behavior. They are guardrails, not a replacement for server-side checks.

Like house rules posted at the door: the browser reads them and enforces them for that site.
  • HSTS tells browsers to use HTTPS for that site.
  • CSP limits where scripts and other content may load from.
  • Frame, referrer, and permissions policies reduce common browser-side risks.
FILE

Content types and file uploads

Content-Type tells the browser how to interpret a response, and file uploads bring untrusted bytes into the system. Names and extensions can lie.

Like package screening at reception: the label may say 'books', but you still scan what's inside.
  • Validate type, size, and content on the server.
  • Store uploads outside executable web paths when possible.
  • Return files with safe content types and download headers when needed.
URL

IDOR: changing the ID in a URL

Insecure Direct Object Reference: a page shows object number 1041, you change the address to 1042 and see someone else’s data. The server trusted the ID instead of checking who is asking.

Like a coat check: hand over ticket 42 and ask for coat 43 — a good attendant checks the ticket is yours, a bad one just hands over the coat.
  • Authorization must be checked on every object access, not just at login.
  • Random, unguessable IDs help, but they are not authorization.
  • If you stumble on this in a real site, stop and report it — don’t keep browsing others’ data.

How these ideas connect

  1. A user logs in; the server returns a session cookie or token.
  2. The browser includes that credential on later requests according to cookie and storage rules.
  3. Same-origin policy and CORS control which pages can read API responses in the browser.
  4. APIs check method, authentication, authorization, content type, and input.
  5. Security headers tell the browser how strictly to handle the response.
  6. Output encoding and parameterized queries keep user input as data, not code.

Advanced Networking Quiz

Question 1 / 15

Which OSI layer handles IP addresses and routing?

Complete the Quiz

Pass the quiz above (70%+) to unlock topic completion.