CPSA ยท Network protocols and filtering
Reviewing a firewall rule base or ACL
Rule order, implicit deny, overly broad any-any rules, shadowed rules and stateful vs stateless filtering.
Key points
- Rules are checked top to bottom and the first match wins, so order matters.
- No match: default policy or implicit deny.
- Look for: any-any permits, overly broad rules, shadowed rules (unreachable behind an earlier broader rule), missing logging.
- Stateless filter: judges each packet alone, needs rules both ways.
- Stateful firewall: tracks connections, lets return traffic through automatically.
Source: https://man7.org/linux/man-pages/man8/iptables.8.html
Practice questions
What happens to a packet that matches none of the rules in a chain whose default policy is DROP?
- It is accepted because no rule blocked it
- It is dropped by the chain policy
- It is logged and then accepted
- It is returned to the sender with a RST
Show answer
Answer: B. It is dropped by the chain policy
A packet that reaches the end of a built-in chain meets the chain policy, so with DROP it is discarded. It is not accepted by default or sent to the next rule, because none remains.
Which findings in a rule base are worth reporting as weaknesses?
- A permit any any rule above stricter rules
- A deny rule hidden behind an earlier broader permit
- SSH or telnet to a firewall allowed from any source
- A final deny-all rule with logging
- Specific rules placed above general ones
Show answer
Answer: A. A permit any any rule above stricter rules, B. A deny rule hidden behind an earlier broader permit, C. SSH or telnet to a firewall allowed from any source
An any-any permit, a shadowed rule and a management service open to every source are all weaknesses. A final deny-all and specific-before-general ordering are good practice, not findings.
True or false: the order of rules in a firewall rule base does not affect the outcome, because every rule is evaluated before a decision is made.
Show answer
Answer: False
False. Most firewalls and ACLs stop at the first matching rule, so a broad rule placed early can override or shadow narrower ones below it.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
