0% Complete
0/0 Steps
  1. About

    About Cyber School
  2. About BDO
  3. The CSRP program Syllabus
  4. Module 1
    The Cyber World and CIA Triad
    6 Topics
  5. The OSI Model and Network Layers
    6 Topics
  6. IP Addressing, Subnetting and Routing
    6 Topics
  7. DNS and DHCP
    6 Topics
  8. Windows Server Administration
    6 Topics
  9. Active Directory and Identity Management
    6 Topics
  10. Linux CLI Fundamentals
    6 Topics
  11. Linux Permissions and Hardening
    6 Topics
  12. Module 2 - Defense Technologies and Cyber Tools
    Firewall Architecture and Rule Design
    5 Topics
  13. NAT and Secure Traffic Mapping
    6 Topics
  14. Enterprise VPN Solutions
    6 Topics
  15. IDS and IPS
    5 Topics
  16. Identity and Access Management
    5 Topics
  17. Multi-Factor Authentication
    6 Topics
  18. Data Loss Prevention
    6 Topics
  19. Endpoint Security and EDR
    6 Topics
  20. Mail Security
    6 Topics
  21. Web Proxy and URL Filtering
    6 Topics
  22. Regulation and Compliance
    6 Topics
  23. Cloud Security
    6 Topics
    |
    1 Quiz
  24. Module 3 - Ai in security
    AI in Security
    5 Topics
  25. ML Anomaly Detection
    5 Topics
  26. AI Threats
    5 Topics
  27. LLM Defense
    6 Topics
  28. Module 4 - Offensive Cyber & Vulnerability Scanning
    Cyber Kill Chain and Attacker Mindset
    6 Topics
  29. OSINT and Public Intelligence Gathering
    6 Topics
  30. Network and Port Scanning with Nmap
    6 Topics
  31. Vulnerability Scanning
    6 Topics
  32. Exploitation Fundamentals
    6 Topics
  33. Web Application Security
    5 Topics
  34. Social Engineering
    5 Topics
  35. Password and Hash Cracking
    5 Topics
  36. Module 5 - SOC and Advance Cyber Analyst
    SOC Structure and Operations
    6 Topics
  37. SIEM Fundamentals with Splunk
    6 Topics
  38. Alerting and Dashboards
    6 Topics
  39. Incident Response
    5 Topics
  40. Basic Digital Forensics
  41. Capstone A - The Attack: Breaching Meridian
  42. Capstone B - The Defense: Defending Meridian
  43. ISC2 CC Mock Exam and CSRP Graduation
    2 Quizzes
Lesson Progress
0% Complete

CSRP  —  Cyber Security Responder & Practitioner

Lesson 9: Firewall Architecture and Rule Design

Textbook

Cyber School  ·  BDO Ziv Haft

TEXTBOOK — Lesson 9

Firewall Architecture and Rule Design

The deep-dive companion to Lesson 9. Read at your own pace, return to it as a reference.


Reading guide

This chapter has five sections matching the lesson’s five teaching chapters, plus a sixth for the Challenge approach. Within each section you’ll see four kinds of margin notes:

  • ▶ TIP — practical advice from defenders in the field.
  • ✎ TRY IT YOURSELF — a quick exercise you can do in Packet Tracer or on paper.
  • ◆ KEY TERM — a vocabulary word the ISC2 CC exam can ask about directly.
  • ✶ REAL-WORLD — a brief war story from industry.
  • ⚑ WATCH OUT — a common mistake or “gotcha.”

Time: 60–90 minutes to read through.


Section 1 — What a Firewall Is (and Isn’t)

A firewall is the most universally deployed network security control. Every enterprise has one; most have several. Yet ask ten engineers what a firewall is and you’ll get ten variations. We need a precise definition.

A firewall is a network policy enforcement point. Traffic flows past it; the firewall examines that traffic against a set of rules, and for each packet (or each connection, depending on the type) it makes one of two decisions: permit or deny.

◆ KEY TERM — Firewall: a network security device or software that monitors network traffic and decides to permit or deny it based on a configured policy. ISC2 CC frames this as a “perimeter control” but modern usage covers both perimeter and internal use.

That definition is deliberately narrow. A firewall is not an antivirus (which scans content for known malware signatures), not an intrusion detection system (which inspects traffic for attack patterns — Lesson 12), and not a VPN (Lesson 11). It is a policy device, full stop. It implements your policy. If your policy is wrong, the firewall faithfully enforces the wrong policy.

Perimeter vs internal segmentation

Historically, firewalls lived at the perimeter — the boundary between your organization’s network and the public internet. This is the classic “castle and moat” model: the firewall is the moat, and everything inside the wall is trusted.

That model broke. Once an attacker phishes one employee and gets onto the internal network, they can move freely from machine to machine because there is nothing between them. So we add internal segmentation firewalls: firewalls that sit between trust zones inside the network. HR doesn’t need to reach the production database; the firewall between them prevents lateral movement.

✶ REAL-WORLD — In the 2013 Target breach, attackers entered via an HVAC contractor’s stolen credentials and moved from the HVAC vendor portal to the payment systems, eventually exfiltrating 40 million credit cards. Internal segmentation between vendor portals and payment systems would have stopped this.

The modern answer to “perimeter or internal?” is both. This is layered defense — what the industry calls defense in depth. You met it in Lesson 1; now you start building it.

▶ TIP — When you join a new defender role, the first question to ask is: “How many firewalls do we have, and what’s between them?” If the answer is “one, at the perimeter,” you have work to do.

Firewalls and the CIA triad

A firewall touches all three CIA pillars:

  • Confidentiality — by blocking unauthorized access to sensitive resources (e.g., the database is reachable only from specific application servers, not from the internet).
  • Integrity — by blocking unauthorized inbound modification paths (e.g., management ports closed to the internet, so no remote tampering).
  • Availability — by blocking traffic-flood patterns and giving SRE teams the ability to rate-limit or geofence under attack.

✎ TRY IT YOURSELF — Write three sentences. In each, name a service in your own life (Netflix, your bank, your email). For each, describe which CIA pillar a firewall protects, and how.


Section 2 — Stateless vs Stateful, and the Anatomy of a Rule

The single most important architectural distinction between firewalls is whether they are stateless or stateful.

Stateless firewalls

A stateless firewall examines each packet on its own merit. It has no memory of prior packets. It looks at headers — source IP, destination IP, source port, destination port, protocol — and applies its rules.

◆ KEY TERM — Stateless firewall (packet filter): A firewall that makes its allow/deny decision for each packet independently, based purely on packet header fields. No connection tracking.

Cisco router ACLs (Access Control Lists) are the canonical stateless firewall. They’re simple, fast, and ubiquitous — and they are what you’re using in today’s labs.

But statelessness is a tradeoff. Consider TCP: a client makes an HTTPS request to a server. The client sends a packet to the server on port 443 (the SYN packet); the server replies from port 443 to the client on the client’s ephemeral port (e.g., 51234). With a stateless firewall, if you only have a rule allowing client→server traffic, the return packet from server→client will be DENIED unless you write a second, mirror rule.

⚑ WATCH OUT — On a stateless firewall, every “permit” rule for outbound traffic needs a mirror rule for the return traffic. Forgetting this is the most common reason “the rule isn’t working.”

Stateful firewalls

A stateful firewall maintains a connection table — a memory of every connection currently in progress. When the client’s SYN packet goes out, the firewall records: “outbound TCP, src=client:51234, dst=server:443.” When the return packet arrives, the firewall looks it up in the table, recognizes it as the return half of an existing conversation, and permits it automatically — no second rule needed.

◆ KEY TERM — Stateful firewall: A firewall that tracks the state of network connections and uses that state to make decisions. Return traffic for established connections is permitted without an explicit reverse rule.

Modern firewall appliances — Cisco ASA, Palo Alto, FortiGate, Check Point — are stateful. So is the Windows firewall, and so is Linux iptables/nftables when configured statefully. Stateful is the default in 2026 industry practice; stateless ACLs remain in use mostly on routers (which are doing forwarding as their primary job and adding ACLs as a side task).

▶ TIP — On the ISC2 CC exam, “stateful” and “stateless” are favored multiple-choice answers. If the question mentions “tracks connections” or “permits return traffic automatically,” the answer is stateful.

The 5-field rule anatomy

Whether stateless or stateful, every firewall rule has the same five fields:

  1. Source — where the traffic comes from. An IP, a range, a subnet, or any.
  2. Destination — where it’s going.
  3. Port — usually the destination port (443 for HTTPS, 22 for SSH, 3389 for RDP). Some firewalls also let you scope the source port — rarely needed.
  4. Protocol — TCP, UDP, ICMP, or any.
  5. Action — permit / allow, or deny / drop. Some firewalls add a “log” attribute as well.

In Cisco IOS, an extended ACL line looks like:

access-list 100 permit tcp 10.10.20.0 0.0.0.255 host 10.10.50.10 eq 443

Breaking that down: action=permit, protocol=tcp, source=10.10.20.0/24 (expressed with the wildcard mask 0.0.0.255), destination=10.10.50.10 (the host keyword means a single IP), port=443.

⚑ WATCH OUT — Cisco uses wildcard masks, NOT subnet masks. They are inverted. A /24 subnet mask is 255.255.255.0; the wildcard mask is 0.0.0.255. Mental rule: “0 = must match, 1 = don’t care.”

✎ TRY IT YOURSELF — Translate to Cisco ACL syntax: “Allow any host in 10.10.50.0/24 to reach 192.168.1.10 on TCP port 22.” Answer at the end of this chapter.

Allowlist vs Blocklist

Two opposite philosophies for a rule set:

  • Allowlist (allowlist + default-deny): Block everything by default. Add explicit rules only for traffic you have decided to permit.
  • Blocklist (blocklist + default-allow): Allow everything by default. Add explicit rules only for traffic you have decided to block.

◆ KEY TERM — Default-deny: A policy in which traffic not matching any explicit permit rule is denied. The opposite is default-allow.

The blocklist approach is operationally tempting (less to configure, fewer “broken” reports) but disastrous from a security standpoint. You cannot enumerate every bad source — the internet has 4 billion IPs. You can enumerate the legitimate sources for your services.

Best practice: default-deny + allowlist. Always. The ISC2 CC framework, NIST SP 800-41, PCI DSS, and every cyber framework worth listing all require default-deny.

✶ REAL-WORLD — In 2017 a regional bank reported a major incident where attackers exfiltrated 100GB of data over months. Root cause? Their perimeter firewall used default-allow + blocklists for outbound traffic. The exfiltration channel (a non-standard high port to a known-bad ASN) was never in any blocklist.


Section 3 — Rule Order, Default Deny, and the DMZ

You now know what a rule looks like. The next question: in what order does the firewall apply rules?

Top-down, first-match

Most firewalls — including Cisco ACLs and most enterprise firewalls — process rules top to bottom, first match wins. The firewall reads rule 1; if the packet matches, the firewall takes that rule’s action and stops. If not, rule 2; if not, rule 3; and so on until either a rule matches or the rule list runs out.

⚑ WATCH OUT — A correctly-written rule placed AFTER a broader rule may never match. This is shadowing, and it’s the most common firewall bug in the industry. Lab 9.2 is specifically about diagnosing this.

◆ KEY TERM — Rule shadowing: A condition in which an earlier (broader) rule prevents a later (more-specific) rule from ever matching, because firewall processing stops at the first match.

The implicit deny

What happens if a packet matches NO rule? On most firewalls, the answer is deny. This is called the implicit deny or default deny. Cisco ACLs have it built in; you don’t write it.

But some firewalls (and some platforms — including older Linux iptables defaults) come with default allow. On those, you must EXPLICITLY write a final deny all rule. Forgetting it = no firewall.

▶ TIP — Even on platforms with implicit deny, many engineers write an explicit deny ip any any log at the end. Why? Because the explicit version logs every blocked packet — the implicit deny is silent. Visibility matters.

Rule ordering best practice

Order your rules from most specific to most general. A typical perimeter rule set looks like:

  1. Allow specific management traffic (e.g., admin subnet → routers, SSH on a high port).
  2. Allow specific public-facing services (DMZ web on 443, mail on 25).
  3. Deny specific known-bad patterns (e.g., RFC1918 source from the internet — spoofing).
  4. Deny by default (terminator).

✎ TRY IT YOURSELF — Put these four rules in correct order: (a) deny ip any any, (b) permit tcp any host 1.2.3.4 eq 443, (c) permit ip 10.0.0.0/8 any, (d) deny ip 10.0.0.0/8 any. Answer: (c) before (d), (b) anywhere before (a). One acceptable order: c, b, d, a.

The DMZ pattern

The DMZ (DeMilitarized Zone) is the classic network architecture for hosting public-facing services without exposing internal networks.

◆ KEY TERM — DMZ (DeMilitarized Zone): A network segment that is reachable from the internet (for hosting public services) but is firewalled off from the internal corporate network. Compromise of a DMZ host should not give attackers internal access.

A two-firewall DMZ (screened subnet model) looks like:

Internet — [Firewall A] — DMZ — [Firewall B] — Internal

A single-firewall DMZ uses three interfaces on the same firewall (one to internet, one to DMZ, one to internal). The Meridian topology uses the single-firewall variant.

The DMZ rule pattern: – Internet → DMZ: tightly scoped (only published services). – DMZ → Internet: outbound usually permitted (for software updates). – Internet → Internal: denied entirely. – Internal → DMZ: permitted (for management and content publishing). – DMZ → Internal: denied (this is the critical defense — if a DMZ host is compromised, the attacker cannot reach internal systems).

✶ REAL-WORLD — The 2017 Equifax breach involved a vulnerable Apache Struts web server. The vulnerability was in the DMZ; if DMZ→Internal had been properly restricted, the attacker’s ability to enumerate and exfiltrate internal databases would have been dramatically reduced.


Section 4 — The Common Mistakes (and the Audit Mindset)

When auditors review firewall rule sets, they find the same five mistakes everywhere:

1. Any-any rules

A rule like permit ip any any anywhere in your list means “allow everything from everyone to anyone.” From that line onward, you have no firewall — every subsequent rule is shadowed by the any-any permit. Auditors call this an “any-any rule,” and finding one is an instant audit fail.

⚑ WATCH OUT — permit ip any any is sometimes added by an engineer doing testing, then forgotten. ALWAYS check for it at code review.

2. Overly broad source ranges

A rule like permit tcp 0.0.0.0/0 host 10.10.40.10 eq 22 allows SSH (port 22) from the entire internet to an internal server. Even if the password is strong, you’re inviting brute-force scanning 24/7.

Best practice: scope sources to known administrative networks (your office IPs, your VPN ranges, your jump-host’s IP).

3. Exposed management ports

The big four management ports that should NEVER be open to the internet:

PortProtocolUsage
22TCPSSH (Linux remote shell)
3389TCPRDP (Windows remote desktop)
5985 / 5986TCPWinRM (Windows remote management)
8443 / 9090TCPCommon admin web UIs

Exception: SSH may be open through a hardened bastion / jump host. RDP should NEVER be exposed; use a VPN or RD Gateway.

✶ REAL-WORLD — Search Shodan.io for “port:3389” and you’ll find millions of exposed RDP instances. The ransomware industry is built on this exposure. The 2020 ransomware survey by Coveware found RDP was the initial access vector in 50% of cases.

4. Missing logging

A firewall without logs is a wall with no eyes. You’ll discover an incident because of an alert, then look for the firewall log entry — and find nothing. Log everything that’s denied, plus matches on critical permits (management plane, sensitive databases), plus every rule change.

5. No rule documentation

Every rule should have a comment (Cisco: access-list 100 remark === purpose ===). The comment should say who asked for the rule, why, and the ticket number. Six months later when someone asks “do we still need this?”, that history is the only way to answer.

▶ TIP — Maintain a quarterly firewall rule review ritual. For each rule: is it still needed? Is the source still right? Is the destination still right? Is the port still right? Should it be tightened? Many SOCs find 15–30% of their rules are obsolete on first review.

The auditor’s mental model

When you read a rule set, walk it top to bottom and for each rule ask: – What does this rule actually allow? – Is the source as tight as possible? – Is the destination as tight as possible? – Is the port as tight as possible? – Does an earlier rule already cover this case? (= you might be able to delete this one) – Does this rule shadow a later, more-specific rule?

Five minutes per rule. That’s the job.


Section 5 — Logging, Monitoring, and the Defender’s Workflow

A firewall rule fires thousands of times per minute. You can’t review every match by hand. You need logs and a system to read them.

What to log

Minimum logging: – Every deny (this is your free intrusion detection — every blocked attempt is signal). – Every match against your critical permit rules — particularly management-plane permits. – Every rule change (audit trail of who modified what).

Don’t log every match of broad allow rules. The volume will overwhelm your storage and drown the signal.

Where logs go

  • Local firewall buffer. Convenient for live troubleshooting, lost on reboot. Small.
  • Syslog server. A dedicated server collecting logs from many devices. Standard since the 1980s. Better than local.
  • SIEM. Security Information and Event Management — the destination for any organization above ~50 people. Aggregates logs from many sources, normalizes them, and runs detection rules. You’ll meet SIEMs in Module 5.

◆ KEY TERM — SIEM (Security Information and Event Management): A platform that ingests logs from network devices, servers, and security tools; normalizes them into a common format; and applies detection rules to surface incidents. Examples: Splunk, Elastic Security, Microsoft Sentinel.

The defender’s daily

A SOC analyst’s morning routine includes (among other things): 1. Review overnight firewall deny spikes — any unusual source IPs, unusual destinations, unusual ports? 2. Investigate the top 5 talker source IPs (legitimate or scanning?). 3. Cross-reference with threat intelligence feeds (is this source IP known-bad?). 4. Either: (a) confirm scanning noise and document, or (b) escalate to incident response.

You will do exactly this once you reach your first defender role. Today’s labs train the reading muscle.

✎ TRY IT YOURSELF — In Lab 9.1, after running your tests, type show access-list 100 again on R1. Each line should now have a hit counter. Are the hits where you expected? If yes, your rules are correct. If something has 0 hits where you expected hits, your rule’s source/destination/port doesn’t match the test you ran.


Section 6 — The Challenge: How to Think About “Close the Open Door”

The Challenge is your assessment. We won’t walk you through it. We can offer the mental approach of a defender facing this situation.

The defender’s question

You’re handed a firewall and told “something is exposed.” Where do you start?

  1. Inventory. What rules exist? show access-list 100 and read line by line.
  2. Risk-rank. Which rule allows the most? Look for any sources first.
  3. Specificity check. For each any source: what is it allowed to do? Is the destination/port sensitive?
  4. Crosscheck reality. What’s actually exposed to the internet right now? (In a real environment: scan from outside. In Packet Tracer: run the Simulation-Mode probe.)
  5. Fix. Tighten the source, or remove the rule entirely. Never weaken; always tighten.
  6. Verify. Re-run the external probe. Is the exposure closed? Re-run the management probe. Is legitimate access still working?
  7. Document. Log the change with a comment (Cisco: remark).

▶ TIP — The most senior people in the industry are excellent at step 5. They tighten just enough to close the exposure without breaking legitimate access. Practice this judgment now.

How the Meridian Challenge maps to that workflow

The exposure is on TCP/3389 (RDP). The bad rule allows any source to an internal RDP destination. Legitimate Management-segment access (10.10.10.0/24) must keep working. So the fix is to scope the source from any to the Management subnet.

When you submit the ULC{…} flag returned by the validation routine, you earn the [Firewall-Architect-Foundations] badge.


Answers to “Try It Yourself”

Section 2, Q1: access-list 100 permit tcp 10.10.50.0 0.0.0.255 host 192.168.1.10 eq 22

Section 3, Q1: An acceptable order is c, b, d, a. The crucial constraint is that the broad permit permit ip 10.0.0.0/8 any (c) must come before the broad deny deny ip 10.0.0.0/8 any (d), otherwise the deny shadows it.


Glossary

TermDefinition
ACLAccess Control List. The Cisco IOS name for an ordered list of firewall rules.
AllowlistDefault-deny policy plus explicit permits. The preferred model.
BlocklistDefault-allow policy plus explicit denies. Discouraged.
Connection tableThe data structure a stateful firewall uses to track existing connections.
Default-denyPolicy that denies traffic not matching any explicit permit.
DMZDeMilitarized Zone — a network segment hosting public-facing services, isolated from internal networks.
FirewallA network policy enforcement device that permits or denies traffic.
Implicit denyThe behavior of some firewalls (e.g., Cisco ACLs) to deny by default when no rule matches.
Rule shadowingAn earlier rule preventing a later, more-specific rule from ever matching.
SIEMSecurity Information and Event Management system.
Stateful firewallFirewall that tracks connection state and permits return traffic automatically.
Stateless firewallFirewall that examines each packet independently with no connection memory.
SyslogA standard protocol and server for collecting logs from network devices.
Wildcard maskThe inverted form of a subnet mask used in Cisco ACL syntax; 0 = must match, 1 = don’t care.

Further reading

  • NIST SP 800-41r1 — Guidelines on Firewalls and Firewall Policy. (The reference for firewall policy design.)
  • Network Security Essentials by William Stallings, Ch. 9.
  • Cisco IOS Security Configuration Guide — Access Control Lists.
  • ISC2 CC official self-study guide, Domain 4 (Network Security).