learn/phase-2/p2-w5/lesson 03
Week 5 · lesson 3

Firewalls: Stateless, Stateful & WAF

Conceptual lesson, no terminal needed.

What you'll learn

  • Explain what a firewall does and the layers it can inspect.
  • Tell stateless and stateful firewalls apart.
  • Say where application firewalls (WAFs) and host-based firewalls fit.

Firewalls: Stateless, Stateful & WAF

A firewall controls traffic flow between networks or hosts based on rules.

It is the checkpoint that decides which packets pass. There are four kinds worth knowing.

Stateless

A stateless firewall checks each packet on its own, with no memory of what came before. It permits or denies based on Layer 3 / Layer 4 details: IP address, port, protocol.

ALLOW TCP 80 from 10.0.0.0/24 to 10.0.1.10

Example use: an admin blocks port 25 (SMTP) from a specific workstation to stop it blasting out email viruses. Simple and fast, but it cannot tell a legitimate reply from an unsolicited packet, because it remembers nothing.

Stateful

A stateful firewall keeps a session table (IP addresses, ports, TCP state) and tracks the TCP handshake. Because it remembers connections, it can allow return traffic for sessions you started and block everything else. It decides based on Layers 3, 4, and 5.

Example: a FortiGate next-generation firewall (NGFW).

Application (WAF)

An application firewall understands the application layer. A WAF (Web Application Firewall) protects web apps specifically, it can read HTTP and block things like SQL injection or XSS payloads that a packet-level firewall would wave straight through.

Host-based

A host-based firewall is firewall software running on an individual machine (your laptop's built-in firewall), protecting just that host rather than a whole network.

Putting it together

Stateless   → judges each packet, no memory          (fast, blunt)
Stateful    → tracks connections via a session table  (smarter)
Application → understands HTTP, blocks web attacks     (WAF)
Host-based  → runs on one machine                      (last line)

Real networks layer these: a stateful firewall at the edge, a WAF in front of the web app, and host firewalls on the servers. Defense in depth.

Check your understanding

3 questions

Type an answer and press Check. Grading is keyword-based and forgiving, so short answers are fine.

  1. 1

    A stateless firewall's only rule is ALLOW TCP 80 from 10.0.0.0/24. A packet arrives on port 443. Allowed or blocked?

  2. 2

    Which firewall type can read an HTTP request and block a SQL injection payload inside it?

  3. 3

    A firewall that keeps a session table and tracks the TCP handshake is which type?