Skip to content
Knowledge base

Firewall rule review: how to remove unused, overly permissive and duplicate rules

A firewall rule base grows with every project, and rarely does anything leave it. NIST recommends reviewing rules regularly, not only during an audit or an emergency. The review looks for unused, overly permissive and duplicate rules, but removes them carefully: zero hits in the last week does not always mean a rule is unnecessary.

A firewall rule that has outlived its purpose keeps working even though nobody looks after it any more. That is what happens to a rule added for a two-week migration of an accounting system: after the migration, and after the administrator who added it has changed jobs, it still allows traffic from the whole office network to an address where that server has long since ceased to exist. If someone ever puts a new machine there, it will receive access that nobody consciously granted.

Such rules are not exceptions; they are the natural result of a rule base that grows with every project and rarely shrinks. A firewall audit of the rule base is one of the cheaper ways to improve network cybersecurity, because it needs no new hardware, only order and decisions. It also needs caution: removing a rule that looked unnecessary can stop a process that runs once a quarter, exactly when it is needed.

Why does a firewall configuration age over time?

Because every change adds a rule, and no process forces its removal. NIST, in its SP 800-41 Rev. 1 guidelines from September 2009, says so directly: rulesets become increasingly complicated with age, and a new firewall that handles a few kinds of traffic at the start will likely contain far more rules by the end of its first year in production.

According to NIST, the changes are typically driven by new user or business requirements, but they can also reflect other influences within an organisation. Each individual change is justified when it is made. The problem appears later, when the application disappears but the rule stays, or when access opened in a hurry is never narrowed.

That is why a firewall with a well-designed policy at launch can protect worse after a few years than on its first day, even though nobody did anything clearly wrong. We cover how a firewall works and its types in our guide what is a firewall; here the subject is maintaining its rules.

Which rules should you treat as unused, overly permissive and duplicate?

An unused rule matches no traffic, an overly permissive rule allows more than needed, and a duplicate rule repeats what another rule already does. Each type calls for a different response.

An unused rule is usually a leftover from a retired system, a readdressing exercise or a finished project. On its own it allows no traffic, but it clouds the picture and can come back to life when a new service appears at the old address. An overly permissive rule uses the value “any” in the source, destination or service field where specific addresses and ports would do. NIST recommends that rules be as specific as possible with regard to the network traffic they control.

A duplicate rule comes in two forms. The first is an exact copy of another rule, usually the result of several administrators working without a shared description. The second is a shadowed rule: in firewalls that check rules in sequence, a rule placed below a broader rule with the same action will never be matched. NIST notes that automated review tools look for, among other things, redundant rules.

Key points:

  • The rule base grows with every change, and without a review nothing leaves it.
  • A review looks for unused, overly permissive and duplicate rules, including rules shadowed by broader ones.
  • Zero hits in a short observation window does not prove that a rule is unnecessary.
  • A rule is first disabled and observed, and only then removed.

What does NIST recommend in SP 800-41?

NIST recommends managing rulesets through a formal change management control process and reviewing or testing them periodically to ensure continued compliance with the organisation’s policies. The publication page on CSRC lists SP 800-41 Rev. 1 as a final document.

The guidelines contain several recommendations that help during a review. The default stance towards traffic should be to block everything that has not been expressly permitted. Verification of the ruleset should include both reviewing it manually and testing whether the rules work as expected. Rulesets and policies should be backed up regularly.

The most important point for a review concerns its scope. Each review should include a detailed examination of all changes since the last regular review, particularly who made the changes and under what circumstances. NIST adds that it is useful to occasionally have the whole ruleset audited by people who are not part of the normal policy review team, to get an outside view of how the policy matches the organisation’s goals.

How often should you review firewall rules?

Regularly, at a set rhythm, not only when an audit is due. NIST does not give a fixed period, but it recommends reviewing the firewall policy often and at regular intervals, so that reviews do not happen only during policy or security audits or, worse, only during emergencies.

It is worth linking the rhythm to the number of changes. An organisation where rules change several times a week needs more frequent reviews than one with a stable network and one change a month. A good reference point is the number of changes since the last review: if so many have piled up that nobody remembers the reasons for half of them, the interval is too long.

Beyond the rhythm, there are events that should trigger a review on their own: the retirement of a major system, readdressing, merging networks after an acquisition and migration to a new firewall. A review makes particular sense before migration, because carrying unused rules onto a new device carries the problem along with them.

Where do you get data on whether a rule is used?

From hit counters and firewall logs. A hit counter shows how many times a rule matched traffic, and logs let you check what that traffic was and where it came from.

Vendors expose this data in different ways. In the FortiOS 7.6.0 documentation, Fortinet describes a seven-day rolling counter: instead of a single number collected since the rule was created, FortiGate stores values for the last seven days plus an active counter for the current day, and the seven-day hit count is shown in the policy list. According to the documentation, the feature is supported in firewall and multicast policies, but not in security policies. The diagnostic command output on the same page also shows when the rule was first and last matched (the first and last fields).

Logs add context to the counters. A rule with thousands of hits may serve traffic from a single host only, in which case narrowing the source to that host will break nothing. Without logs you cannot draw that conclusion, so before a review it is worth checking whether the rules you want to assess log traffic at all.

Why does zero hits not always mean a rule can be removed?

Because the counter shows only an observation window, and some processes run less often. The seven-day window from the FortiOS documentation shows current traffic well, but it will not cover a quarter-end close, an annual synchronisation with a public authority or a disaster recovery test.

Emergency rules are a special case. A rule opening access to a backup data centre, or to a management console in case the main link fails, matches no traffic outside the day of an outage. Its removal comes to light only on the day of the failure, when there is the least time for fixes.

So zero hits is a reason to ask, not a reason to remove. The question goes to the owner of the application or service: does this rule serve something that happens rarely? If the owner cannot be identified, the rule goes down the careful path described below.

How do you remove and narrow rules safely?

In a few steps: back up the configuration, disable instead of deleting, observe and only then delete. NIST recommends regular backups of rulesets; before a clean-up, the backup is the fallback point if something stops working.

Disabling a rule instead of deleting it gives an easy way back: if a user reports a problem, the administrator re-enables the rule with one click and records what depends on it. Match the observation period to the rhythm of your organisation’s processes, so that it covers at least the end of a month. Every change goes through the change process, as NIST recommends.

Narrowing overly permissive rules requires log data. First you establish what traffic the rule actually allows, then you create a narrower rule above the broad one and disable the broad one. If, after the observation period, the traffic is handled only by the new rule, the broad one can be removed. The same path works for temporary rules someone left behind after a project: instead of deleting them straight away, it is better to narrow them to the traffic actually used, give them an expiry date and return to them at the next review. That way the clean-up does not turn into a series of outages, and every change leaves a trace in the log.

How does rule order affect security and performance?

In firewalls that check rules in sequence, the first matching rule decides, so order changes both behaviour and performance. NIST notes that in such firewalls, rules with the highest chance of matching traffic should be placed as high in the list as possible, while other firewalls process rulesets in more complex ways, for example checking deny rules first.

For security, shadowing matters more. A broad allow rule placed high up means that all narrower rules below it, including deny rules, stop mattering for the traffic it covers. A review should therefore read the ruleset from the top and, at every broad rule, ask what has stopped working below it.

The same principle applies when tidying up. Moving a rule higher for performance can change what the firewall allows, so a change of order is also a change in the process, not a cosmetic tweak.

How should you document rules so that the next review is faster?

With a description on every rule and a change log. NIST recommends that, wherever practical, every rule has a comment, because it helps others determine why the rule was made and is very useful to people auditing the ruleset.

According to NIST, at a minimum a log should be kept of all policy decisions and ruleset changes, associated with the firewall in question. The rule description is worth extending with the owner, the ticket number and an expiry date for temporary rules. A rule with an expiry date puts itself forward for review.

NIST also points to restricting change rights. According to the guidelines, firewalls usually allow restrictions on who can change the ruleset, and some also on the addresses from which administrators can do so; NIST recommends using such restrictions, and fewer people with rights means fewer undocumented changes.

Who should take part in a firewall rule review?

The firewall administrator, the person responsible for security and the owners of the applications the rules relate to. The administrator knows the configuration but does not know whether the accounting system still needs a connection to the bank on a given port. The application owner does.

NIST also suggests having the whole ruleset assessed from time to time by people outside the normal review team. A team that works with the rules every day gets used to them and stops seeing rules that have looked the same for years.

With network segmentation, the review has one more purpose: checking whether the rules between zones still match the design. We write more about limiting traffic between segments in our article on network microsegmentation.

What can a firewall rule review checklist look like?

A review checklist combines data, questions and decisions into one sequence that can be repeated at every review.

StepQuestionDataWho decidesDecision
1. BackupIs there a current backup of the configuration?Ruleset backupAdministratorFallback point before changes
2. Changes since the last reviewWho changed rules and under what circumstances?Change log, ticketsSecurityUnjustified changes to be explained
3. Rules with no hitsDoes the rule serve a rare process or an emergency scenario?Hit counters, application ownerApplication ownerDisable and observe, or keep with a description
4. Permissive rulesWhat traffic does the rule actually allow?Firewall logsAdministrator with the ownerNarrower rule above the broad one
5. Duplicates and shadowingWill the rule ever be matched?Rule orderAdministratorRemove or move
6. DescriptionDoes the rule have a reason, an owner and an expiry date?Rule commentsProcess ownerComplete the description

Step two is worth doing before the others, because unjustified changes may point not only to disorder but also to unauthorised interference with the configuration.

How can nFlo help with your firewall rule review?

nFlo carries out rule reviews as part of firewall implementations and maintenance. In FortiGate Next-Generation Firewall projects, the nFlo team inventories existing rules, zones and traffic to separate the rules that are needed from historical ones, and after go-live it maintains the platform, including rule reviews and FortiOS updates.

With Check Point Next Generation Firewall, the policy is managed centrally from the SmartConsole and the Security Management Server, and as part of maintenance the nFlo team reviews the rules and updates the policy together with the IT team. The Firewall and NGFW Implementation service covers requirements analysis and an audit of the existing architecture, rule migration and firewall maintenance under the terms of the contract.

If you want to tidy up your rules before a migration or the next audit, contact us.

What else is worth knowing about a firewall rule review?

Does changing the order of rules require change management?

Yes. In firewalls that check rules in sequence, the first matching rule decides, so moving a rule higher, even for performance, can change what the firewall lets through. That is why a change of order follows the same path as any other rule change.

Can a rule with no hits be removed straight away?

Not always. A hit counter mainly shows an observation window, for example seven days in FortiOS 7.6. A rule used once a month or only during disaster recovery will show zero hits even though it is needed. It is safer to disable it first and observe.

What is an overly permissive rule?

It is a rule that allows more traffic than the application needs: any source, any destination or any service instead of specific addresses and ports. NIST recommends that rules be as specific as possible with regard to the network traffic they control.

Can a firewall audit be automated?

Partly. NIST notes that some firewalls have tools for automated policy reviews that look for things such as redundant rules, and it recommends using them periodically as part of the regular review. The decision to remove a rule still needs a person and the application owner.

What should a firewall rule description contain?

At least the reason the rule was created, its owner, the change ticket number and, if the rule is temporary, its expiry date. NIST recommends a comment on each rule and a log of all policy decisions and rule base changes.

Share:

Talk to an expert

Have questions about this topic? Get in touch with our specialist.

Sales Representative
Grzegorz Gnych

Grzegorz Gnych

Sales Representative

Response within 24 hours
Expert consultation
Individual approach

Providing your phone number will speed up contact.

Want to Reduce IT Risk and Costs?

Book a consultation - we respond within 24h

Response in 24h Custom quote No obligations