Compare FIN scan with TCP scan in Xfce terminal
In this step, you will compare the results of a FIN scan with a TCP connect scan. This comparison will highlight the differences in how these scans identify open ports and how firewalls might treat them differently.
A TCP connect scan (-sT
) establishes a full TCP connection with the target, making it more reliable but also more easily detectable. A FIN scan (-sF
), on the other hand, sends a FIN packet, which is less likely to be logged by firewalls but may not always provide accurate results.
Open your Xfce terminal.
First, perform a TCP connect scan on localhost (127.0.0.1):
sudo nmap -sT 127.0.0.1
This command will attempt to establish a full TCP connection with each port on your local machine.
Next, perform a FIN scan on the same target:
sudo nmap -sF 127.0.0.1
Now, compare the results of the two scans. You may notice that the TCP connect scan identifies more open ports than the FIN scan. This is because some firewalls or systems may block or ignore FIN packets, leading to inaccurate results.
Example output of TCP connect scan:
Starting Nmap 7.80 ( https://nmap.org ) at 2023-10-27 10:20 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000026s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
22/tcp open ssh
631/tcp open ipp
3306/tcp open mysql
Nmap done: 1 IP address (1 host up) scanned in 0.12 seconds
Example output of FIN scan:
Starting Nmap 7.80 ( https://nmap.org ) at 2023-10-27 10:21 UTC
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000026s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
22/tcp filtered ssh
Nmap done: 1 IP address (1 host up) scanned in 1.89 seconds
In this example, the TCP connect scan shows ports 22, 631, and 3306 as open, while the FIN scan only shows port 22 as filtered. This demonstrates how different scan types can produce different results, and why it's important to use a variety of techniques when performing network reconnaissance. The filtered
state means that a firewall, filter, or other network obstacle is blocking the port, preventing Nmap from determining whether it is open or closed.