Sending one hping3 SYN to a host's port, what do flags=SA, flags=RA, an ICMP unreachable and no reply each tell you about the rule?
answer
- each reply is evidence, not a verdict
- S and A together
- R and A together
- ICMP error names the sender
- silence has several causes
basics
~20 sflags=SA means the SYN was allowed and something listens; flags=RA means a stack or device reset it; an ICMP unreachable is an explicit refusal; silence suggests a drop but needs a control probe and the log.
solid answer
~40 sRead the reply as evidence about one packet. `flags=SA` (SYN plus ACK) means the SYN was allowed and a service answered. `flags=RA` (reset plus ACK) means it reached a TCP stack with nothing listening, or a device configured to reset; the ttl, id and win fields, compared with a reply from a known-open port, hint at which device answered. An `ICMP ... from ip=` line is an explicit refusal and names the sender, and hping3 prints `Packet filtered` for the administratively-prohibited code. No reply is consistent with a drop but also with a lost packet, a down host or a filtered return path, so repeat it, run a control probe to an open port from the same source, and check the firewall log before calling it a drop.
go deeper
Recall that SA means a service answered, RA means a reset, an ICMP line is an explicit refusal and silence is the ambiguous one.
Explain each outcome as allow, reject or drop, and read the ttl, id and win fields to guess which device replied.
Reconcile the probe with a control probe and the firewall log before concluding, and say which alternative explanations the silence still allows.
Decide what evidence standard a rule change needs before sign-off, and who owns the record that pairs each probe with its log line.
## The four outcomes When one hping3 SYN goes to a port, exactly one of four things is observed. None of them is the rule itself; each is evidence about it. | What hping3 shows | What it suggests | What to check before concluding | |---|---|---| | `flags=SA` | The SYN was allowed and a service accepted it | The listener is the intended one; compare with the rule's expected allow | | `flags=RA` | The packet reached a TCP stack with no listener, or a device that resets by policy | Which device sent the reset | | `ICMP ... from ip=X` | An explicit refusal from X | Whether X is the host, a router or the firewall | | Nothing, then 100% loss in the summary | A drop, or a lost probe or reply | A control probe and the firewall log | ## Reading the TCP line A reply looks like `len=46 ip=192.0.2.10 flags=RA DF seq=0 ttl=64 id=0 win=0 rtt=0.4 ms` (illustrative values). The `flags` letters are R reset, S SYN, A ACK, F FIN, P push, U urgent. `ip` is the sender of the reply, `ttl`, `id` and `win` are that sender's header values, and `rtt` is the round trip in milliseconds. `-V` adds `tos`, `iplen`, `seq`, `ack`, `sum` and `urp`. The manual page advises looking at the IP ID, window and TTL of replies, and that is how a reset is attributed: a firewall that generates its own reset usually produces a different ttl, id or window from the host's own stack. ## Reading the ICMP line ICMP errors print as text. The strings come from the source's `logicmp.c`: `ICMP Port Unreachable from`, `ICMP Host Unreachable from`, `ICMP Network Unreachable from`, and `ICMP Packet filtered from` for code 13. The `ip=` field is the sender of the error, which may be the target, a router in between or the firewall, and the line is the clearest "reject" you will see, because the device chose to tell you. What those codes mean as protocol messages belongs to the ICMP material; for a rule test, what matters is that a reject is observable and a drop is not. ## Why silence is the weakest answer A dropped probe and an unanswered probe look identical at the sender. Besides a deliberate drop, silence fits: - a lost packet on a busy or lossy link; - a host that is down, or whose own local firewall discards the packet; - a reply filtered on the way back, so the SYN arrived and the answer did not; - a probe that never left the sender because of a local rule or a route. The disciplined steps are numbered: 1. Repeat the probe a few times with `-c`, and read the loss percentage rather than one line. 2. Send a **control probe** to a port you know is open, from the same source: if it answers, the path and the host are alive and the silence is specific to the tested combination. 3. Open the firewall log for the probe's source, destination and time and find the line that names the rule. 4. Only then write "dropped by rule N" in the report. ## A worked reading Suppose the ticket says the new rule should allow 192.0.2.10 on port 443 and reject port 8443 from the guest zone. From a guest host, send `-S -p 443 -c 3` and `-S -p 8443 -c 3`. Three `flags=SA` lines for 443 confirm the allow. For 8443 the expectation was a reject, so a line such as `ICMP Packet filtered from ip=198.51.100.1` fits it and names the device, while three silent probes fit a drop. Both stop the traffic, but they are different actions from the one the ticket asked for, so record the reply and the action the rule log shows. ## Why one reply is an inference hping3 does not report port states; it prints what arrived. The same `flags=RA` can mean "closed port on the host" or "firewall policy resets", and the same silence can mean "dropped" or "never delivered". The firewall log and the control probe are what turn a reading into a finding, and a report that quotes only the hping3 line has not finished the job. ## Rules of engagement Run these probes only against hosts and paths your written scope covers, in the agreed window, from the source address the log owners expect, and keep `-c` small. The point is to confirm one expected behaviour, not to find out what else is open.
- What is the difference between a reject and a drop as seen from the hping3 side?A reject produces a visible reply: a reset or an ICMP unreachable that names its sender. A drop produces nothing. Rejects are easier to test because the device tells you; drops need repetition, a control probe and the log, since silence has several causes beyond the rule.
- How would you tell a firewall's reset from the host's own reset?Compare the ttl, id and win values of the reset with those of a reply from a known-open port on the same host. A reset from a different device usually differs in ttl or in id behaviour, and the firewall log may also show a reject action. It is a hint, not proof, so confirm in the log.
- A probe to port 443 is answered with flags=RA, but the change expected a drop. What do you do?Do not call the rule wrong yet. Check which device sent the reset, then read the firewall's log for the probe to see whether a rule matched and with what action. If the log shows no match, the packet reached the host, and the rule or its order is not doing what the ticket expected.
- flags=RA means the port is open and a service accepted the connection
- No reply proves the firewall dropped the packet by rule
- An ICMP unreachable means the target host is down
- hping3 labels ports open, closed or filtered in its output
- One probe line is enough evidence to sign off a firewall change