Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 36 ยท Port Scanning Techniques

ACK, Window and Maimon Scans

Map firewall rules with the Nmap ACK scan, learn what the Window and Maimon scans do, and see how unfiltered and filtered results reveal stateless and stateful filters.

The scans so far try to answer "is this port open?". The ACK scan asks a different question: "does a firewall block packets to this port?". It never reports a port as open. That makes it the right tool for mapping firewall rules, and for understanding whether a filter is stateful or stateless. Its relatives, the Window and Maimon scans, are oddities that work on a few systems. This lesson covers all three, and finishes the chapter on scan techniques.

Commands are read-only. Use them only to test firewalls you own or are authorized to assess. The Python editors simulate a firewall and a host with plain data, and no packets are sent.

The ACK scan: -sA

The ACK scan sends a TCP packet with only the ACK flag set. A real ACK belongs to an established connection, but here none exists. A host that receives an unexpected ACK on any port, open or closed, replies with a RST. So:

  • RST received: the packet got through. State: unfiltered (reachable, but Nmap cannot tell open from closed).
  • No reply or an ICMP unreachable: a firewall dropped or rejected it. State: filtered.
Terminal
sudo nmap -sA 192.0.2.10
TEXT
Not shown: 995 filtered tcp ports (no-response)
PORT    STATE      SERVICE
22/tcp  unfiltered ssh
80/tcp  unfiltered http

Example output (invented). Ports 22 and 80 returned RST: the firewall lets ACK packets to them. The other 995 were silent, so the firewall dropped them. Compare this with a SYN scan to see the full picture.

What the results tell you

The ACK scan reveals the firewall's behavior, not the services:

  • If all ports are unfiltered, there is likely no firewall, or only a stateless filter that allows ACKs.
  • If all ports are filtered, a stateful firewall drops ACK packets that do not belong to a known connection.
  • If some ports are unfiltered and others filtered, the rules differ per port.

A stateless packet filter often allows ACK packets everywhere because it assumes they belong to replies. A stateful one tracks connection state and rejects an ACK with no matching entry. The pairing of a SYN scan and an ACK scan makes the contrast clear.

SYN scan says ACK scan says Likely meaning
open unfiltered A service is reachable; the filter lets traffic through
closed unfiltered Reachable, nothing listens
filtered filtered A firewall blocks the port
open filtered Stateful firewall: SYN (new connection) allowed, stray ACK refused
filtered unfiltered A stateless filter blocks SYN but lets ACK through (weak rule)
flowchart TD
  A["Send TCP ACK"] --> R{"Reply?"}
  R -- "RST" --> U["unfiltered"]
  R -- "ICMP unreachable or silence" --> F["filtered"]

Figure: the ACK scan decision.

The last row of the table is a real finding: if a stateless filter drops SYN but lets bare ACKs through, an attacker can reach a port with crafted packets. Stateful firewalls prevent this.

The Window scan: -sW

The Window scan is the ACK scan with one more observation. On certain systems, the RST packets returned by open ports have a non-zero TCP window size, while those from closed ports have a window of zero. Nmap reads that field and can then label ports open or closed instead of just unfiltered.

Terminal
sudo nmap -sW 192.0.2.10

This is an implementation quirk of some operating systems, not a rule, and many modern systems return the same window for both. So the Window scan is unreliable and often reports every port as closed. It is mostly educational today.

The Maimon scan: -sM

Named for its discoverer, Uriel Maimon, this scan sends a FIN+ACK packet. RFC 793 says the target should reply with RST, but some BSD-derived systems drop the packet if the port is open, and respond with RST only if it is closed. When that behavior is present, the Maimon scan works like the FIN scan (silence means open|filtered). Most modern systems reset in both cases, so every port looks closed.

Terminal
sudo nmap -sM 192.0.2.10

Like the flag scans in Null, FIN and Xmas Scans, it is a probe of stack behavior rather than a dependable port scanner.

Custom flags: --scanflags

For experiments, --scanflags lets you set any TCP flags on the probe, by name or number:

Terminal
sudo nmap -sA --scanflags URGPSHFIN 192.0.2.10

This is how you test a firewall's response to unusual combinations. Combine with -sS, -sA, -sF and so on to choose how replies are interpreted. Use it only on systems you administer.

Comparing scan types

Which scan answers which question?

SYN / connect Is the port open?
ACK Does a firewall block it?
UDP Is a datagram service there?
NULL / FIN / Xmas Does the stack follow RFC 793?

Pick the scan that matches your question.

1 / 2

A stand-in: firewall and host simulation

This program builds a tiny world: a host with open ports 22 and 80, and two firewalls, one stateless (allows ACK everywhere, blocks SYN to port 22) and one stateful (allows SYN only to 22 and 80, drops stray ACKs). It runs a SYN and an ACK probe through each and prints the results as the table above would.

Python Map a firewall with SYN and ACK probes

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Look at port 22 behind the stateless firewall: the SYN scan says filtered while the ACK scan says unfiltered. That combination is the signature of a stateless filter, and a finding to fix. Behind the stateful firewall, port 22 is open to SYN and filtered to ACK, which is correct behavior.

A stand-in: reading the window field

This model shows the Window scan's idea: an RST from an open port carries a non-zero window (on the quirky systems), and one from a closed port carries zero.

Python Window scan logic on RST replies

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Putting chapter 4 together

You now know the main scan types:

Scan Option Question it answers Needs root
TCP connect -sT Open or closed (OS call) No
SYN -sS Open or closed (half-open) Yes
UDP -sU UDP services Yes
NULL / FIN / Xmas -sN -sF -sX Does the stack follow RFC 793 Yes
ACK -sA Is the port filtered Yes
Window -sW ACK scan plus window quirk Yes
Maimon -sM FIN+ACK quirk Yes

A sensible routine on an authorized assessment: SYN scan for the truth about open ports, an ACK scan to understand the firewall, a UDP scan of a short port list, then version detection on what you found, which comes in the next chapter (Service and Version Detection).

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. An ACK scan receives a RST from a port. What state does Nmap report?

    The packet reached the host, which reset it. Nmap cannot say if the port is open or closed, only that it is not filtered.
  2. 2. What is the main purpose of the ACK scan?

    It shows which ports are filtered, so it reveals firewall behavior.
  3. 3. SYN scan says a port is filtered, but the ACK scan says unfiltered. What does this suggest?

    A stateful firewall would drop the stray ACK too; letting it through is the sign of stateless filtering.
  4. 4. Which flags does a Maimon scan send?

    The Maimon scan sends FIN+ACK.
  5. 5. Why is the Window scan unreliable today?

    The window difference is an old implementation quirk that few systems still show.

Summary

  • The ACK scan (-sA) reports filtered or unfiltered, never open: it maps firewall rules.
  • Compare a SYN scan with an ACK scan to tell stateless from stateful filtering.
  • The Window scan (-sW) and Maimon scan (-sM) exploit stack quirks and are mostly of historical interest.
  • --scanflags lets you craft custom flag combinations for testing firewalls you administer.
  • Choose the scan that matches your question; keep to your authorized scope.

Next: Service and Version Detection (-sV)