Firewalls, services and configuration
Unit 4 of 5 in Testing networks and hosts.
You will be able to test a firewall policy against what you expected, read cleartext and exposed services as an assessor, and write each finding with its fix.
Lesson
Review the rules as well as the traffic
NIST's ruleset review looks at firewall and intrusion detection rulesets and router access control lists to find gaps, policy violations and unintended communication paths. For router access lists, its example checks are that each rule is still required, that rules added temporarily are removed when no longer needed, and that only traffic authorized by policy is permitted with everything else denied by default.
For firewalls, the same section lists checks such as: each rule is still required, rules enforce least privilege by naming only required addresses and ports, more specific rules are triggered before general ones, there are no unnecessary open ports and the ruleset does not allow traffic to bypass other defenses. The lab approach is to write the policy and the expected results first, then measure, then compare. A rule that is too broad shows up as a mismatch between the expected and the actual column.
Read the result, not the rule
A scan from each side of the firewall is how you see what the rules do. The Nmap guide says a closed port is reachable but has nothing listening, and that an administrator who blocks it with a firewall will see it appear as filtered. A filtered port gives so little information that the guide says it frustrates attackers: many filters drop probes silently, which makes Nmap retry and slows the scan down.
For an assessor that means the matrix has to record the state and where the probe came from, and a filtered result is the evidence that a rule is working. Network sniffing behind the firewall is a second check: NIST lists assessing that rulesets are accurately filtering traffic among the reasons for placing a sniffer behind a firewall.
Cleartext services are findings you can show
NIST describes network sniffing as a passive technique that monitors communication, decodes protocols and examines headers and payloads. Among its uses are identifying unsecured protocols such as telnet and collecting unencrypted usernames and passwords. It adds the limits: encryption hides the contents, and a sniffer sees only the segment it is connected to.
That is the evidence for a cleartext-login finding: a short capture of your own lab traffic, kept as a file, shows what anyone on the segment could read. The fix is to replace the service, not to hide it, and the proof is a re-scan showing the port closed. The telnet lab walks the whole path and uses only a documented account on a machine in your sealed lab.
System configuration review
NIST's system configuration review looks for security configuration weaknesses such as unnecessary services and applications, improper account and password settings, and improper logging and backup settings. Manual review compares a device's settings with a security configuration guide or checklist and flags what does not meet it. NIST says it is generally preferable to use automated checks where feasible, because they are fast and give consistent, repeatable results, whereas checking hundreds or thousands of settings by hand is tedious and error-prone, and that both approaches need administrator access to see some settings.
Remote exposure and weak accounts are separate questions and should be separate findings. A database that listens on every network interface and a database account with no password are two problems with two fixes: bind it to the loopback interface or block the port at the router, and give every account a real password and least privilege. The MySQL lab practises exactly that split, and the SSH and SNMP labs apply the same idea to remote login and device management: look at what is offered, rate it, change the configuration, and re-test with the same commands.
Key points
- Write the expected result of a policy before you test it; the mismatch is the finding.
- Closed means reachable with nothing listening; filtered means something is blocking the probe. Record where you probed from.
- A capture of cleartext traffic on your own lab is evidence; the fix is to replace the service and prove it closed.
- Exposure and weak accounts are separate findings with separate fixes; prefer repeatable automated checks.
Sources
- NIST SP 800-115: Technical Guide to Information Security Testing and Assessment (full text)
- Nmap Reference Guide: Port Scanning Basics
Lecture
Hardening baselines as code: Secure settings written down, applied and checked: the target state you compare services and configuration against.
Practice in the labs
Test a rule set against a written policy, show why a cleartext service is a finding, and assess and fix exposed services in your sealed lab.
- Test your lab firewall rules with an expected-versus-actual matrix: You write the policy and expected results first, test from both zones, find the too-broad rule in the ruleset and re-run the identical test after fixing it.
- Show why Telnet is unsafe in a capture, then replace it with SSH and prove it is closed: You capture your own cleartext login, rate the finding, replace Telnet with key-based SSH and prove it closed with a re-scan.
- Assess a MySQL server for weak accounts and remote exposure, then fix it: You separate remote exposure from weak accounts on a database you run in your sealed lab, fix both and re-test with the same commands.
- Enumerate SNMP with onesixtyone and snmpwalk: You open up an SNMP agent on your own machine, see what it gives away, then replace it with an authenticated SNMPv3 user and prove the old way is shut.
- Assess an SSH server's crypto with ssh-audit, harden it, and verify the fix: You grade a throwaway SSH server you own before and after hardening and use a policy file to catch drift.
Also try, in the simulators
- A firewall that allows one service (Network Builder exercise): You replace an allow-everything firewall rule with one that permits a single service, deny by default made visible.
- A router access list, and why replies matter (Network Builder exercise): You write a router access list and see why return traffic matters, which is the reading of a rule set this unit teaches.
Knowledge check
- Which of these is a ruleset-review check NIST lists for router access control lists? Answer: Only traffic authorized by policy is permitted and all other traffic is denied by default. NIST lists deny by default and removal of rules added for temporary purposes among its router ACL checks.
- A port that was closed now shows filtered after a firewall rule is added. What happened? Answer: The rule is blocking probes, so Nmap can no longer tell whether anything is listening. Nmap's guide says a filtered port is one where packet filtering prevents its probes from reaching it, and that blocking a closed port makes it appear filtered.
- Why is a short capture of your own Telnet login good evidence for a finding? Answer: It shows what anyone on the same segment could read, and it is a file you can keep with a hash. NIST lists collecting unencrypted usernames and passwords among uses of sniffing, and notes encryption is what limits it.
- Why should a database that listens on all interfaces and has an account with no password be two findings? Answer: They have different fixes: restrict where it listens, and give accounts passwords and least privilege. Exposure and weak accounts are separate weaknesses; fixing one does not fix the other, and each needs its own re-test.
Back to the syllabus or see all classes.
Related
- Testing networks and hosts
- Test your lab firewall rules with an expected-versus-actual matrix
- Show why Telnet is unsafe in a capture, then replace it with SSH and prove it is closed
- Assess a MySQL server for weak accounts and remote exposure, then fix it
- Enumerate SNMP with onesixtyone and snmpwalk
- Assess an SSH server's crypto with ssh-audit, harden it, and verify the fix
- All classes
- Free cyber labs