Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 3 min read

FortiGate config audit: ten lines to check before an attacker does

Most FortiGate reviews start in the web console and end as a spreadsheet. There is a quicker way to find the settings that matter: open the exported configuration file and search it. The file is plain text, and the lines

Most FortiGate reviews start in the web console and end as a spreadsheet. There is a quicker way to find the settings that matter: open the exported configuration file and search it. The file is plain text, and the lines below take a few minutes to find.

Start by exporting the file: in the console, the admin menu at the top right, Configuration, Backup. Open the .conf file in any text editor.

1. Admin access on an internet-facing interface

Search for set allowaccess. Each interface lists the services it answers on:

config system interface
    edit "wan1"
        set allowaccess ping https ssh

If an interface that faces the internet lists https, http, ssh or telnet, the admin login page can be reached from outside. This is the setting behind many of the FortiGate break-ins that made the news. On an outside interface the line should be ping at most.

2. Admin accounts with no trusted hosts

Under config system admin, each account can be limited to the addresses it may log in from:

edit "admin"
    set trusthost1 10.10.20.0 255.255.255.0

An account with no trusthost line accepts logins from anywhere the admin page can be reached.

3. The default admin account

In the same block, look for edit "admin". If the default account is still there under its default name, anyone guessing passwords already has half of what they need. Create named accounts and remove or rename the default one.

4. Admin accounts without a second factor

Each admin entry should carry a line like set two-factor fortitoken. No two-factor line means a password is all that stands between the internet and the firewall's settings.

5. Rules that allow everything

Search for set srcaddr "all". A policy that also has set dstaddr "all", set service "ALL" and set action accept allows any traffic between its two interfaces:

edit 47
    set name "temp-vendor-access"
    set srcintf "wan1"
    set dstintf "internal"
    set srcaddr "all"
    set dstaddr "all"
    set service "ALL"
    set action accept

Rules like this are usually added for a test or a supplier and then forgotten. Note the name: "temp".

6. Rules whose name promises more than the rule does

Read the set name line of each policy next to its addresses. A rule called "vendor-restricted" or "restricted-db" with set srcaddr "all" is doing something other than what its name says. These are easy to miss in the console and easy to see in the file.

7. SSL-VPN open to every address

Under config vpn ssl settings:

set source-interface "wan1"
set source-address "all"

all means the VPN login answers the whole internet. If your users connect from known countries or ranges, list those instead.

8. SSL-VPN login limits

In the same block, check set login-attempt-limit and set login-block-time. With no limit, a password-guessing run can go on for as long as it likes.

9. Port forwards that cover a whole range

Under config firewall vip, look at set mappedip. A single address is a deliberate publication of one server. A range such as 10.0.5.1-10.0.5.254 publishes every host in it.

10. Rules that log nothing

In each policy, set logtraffic disable means that when something does come through that rule, there will be no record of it. For rules that face the internet, use set logtraffic all.

What the file will not tell you

The export does not hold hit counts, so it cannot show which rules are unused. It also cannot show whether a rule matters: an any-any rule between two lab networks is untidy, and the same rule between the internet and the server network is the way in. That depends on what sits behind the rule and what else it connects to.

That second question is the one we work on at CyberTwin. We read the exported config, run 55 checks like the ten above, and trace which rules let the internet reach internal systems and which single change closes the most routes. If you want to see it on a policy block of your own, there is a box on our sample page that runs in your browser, and the file stays on your machine:

https://cybertwin.io/sample#your-config

The full list of what we read from a FortiGate export, and what we do not, is here:

https://cybertwin.io/guides/fortinet-fortigate

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.