Cyberstudy
3.2 4.5 In progress

Layer 4 and Layer 7 Firewalls

12 flashcards

Summary

Firewalls differ in how much context they use. Stateless filters judge each packet alone, stateful firewalls track connections at layer 4, and layer 7 firewalls understand applications and can inspect content. More context allows finer control but needs more processing.

In plain words

A stateless firewall judges each packet on its own. A stateful firewall remembers connections in a state table, so replies to allowed sessions pass automatically. Layer 4 firewalls understand TCP handshakes and UDP flows and can spot flooding and sequence anomalies. Layer 7 (application-aware) firewalls read the application data itself. They check that traffic on a port really is the expected protocol and look for threats in the payload.

Detailed explanation

  • Stateless firewall: Checks each packet against rules without remembering earlier packets; fast but easy to fool and hard to configure for return traffic.
  • Stateful firewall: Tracks the state of connections in a state table and automatically allows return traffic that belongs to an established session.
  • Layer 4 firewall: Makes decisions using connection state, addresses and ports; can spot anomalies such as malformed TCP handshakes.
  • Layer 7 firewall: Inspects application data to confirm the protocol is what it claims and to filter by application, URL or content. Also called an application-aware firewall.
  • Deep packet inspection (DPI): Examining packet payloads, not only headers, to identify applications and threats.
  • TLS inspection: Decrypting and re-encrypting traffic so encrypted content can be inspected; it needs a trusted internal certificate and raises privacy considerations.

Important terms

taken from the text above
Stateless firewall
Checks each packet against rules without remembering earlier packets; fast but easy to fool and hard to configure for return traffic.
Stateful firewall
Tracks the state of connections in a state table and automatically allows return traffic that belongs to an established session.
Layer 4 firewall
Makes decisions using connection state, addresses and ports; can spot anomalies such as malformed TCP handshakes.
Layer 7 firewall
Inspects application data to confirm the protocol is what it claims and to filter by application, URL or content. Also called an application-aware firewall.
Deep packet inspection (DPI)
Examining packet payloads, not only headers, to identify applications and threats.
TLS inspection
Decrypting and re-encrypting traffic so encrypted content can be inspected; it needs a trusted internal certificate and raises privacy considerations.

Examples & real-world scenarios

  • A stateful firewall allowing return traffic for a user's web session.
  • A layer 7 filter spotting non-HTTP traffic on port 80.
  • Separate application filters for HTTP, SMTP and FTP.

Scenario

Some traffic uses TCP 443 to slip past a port-based rule set. Only a layer 7 (application-aware) firewall can notice that the traffic isn't really HTTPS.

Common mistakes

  • Assuming stateful means application-aware. Stateful tracks sessions (layer 4); application awareness is layer 7.
  • Forgetting the other names for layer 7 firewalls: application layer gateway, stateful multilayer inspection, deep packet inspection.

Practical skills

  • Explain stateless vs stateful filtering.
  • Choose a layer 4 or layer 7 firewall for a requirement.

What I should remember

  • Stateless: Each packet judged alone.
  • Stateful: Tracks connections and allows related return traffic.
  • Layer 7 firewall: Understands applications and content.
  • TLS inspection: Needed to inspect encrypted traffic.