Pcornel
Security · Network Security

Stateful Inspection

Cheat sheet · https://pcornel.dk/topic.php?topic=4586

Back to the Topic

Answer

A stateful firewall remembers each connection it has allowed. Only the first packet is checked against the rules; the rest of the connection, including the replies, passes because it matches the stored session.

Remember

Replies need no rule — they need a session. If the request and the reply pass through different firewalls (asymmetric routing), the second one has no session and drops the reply. Idle sessions time out; long-lived quiet connections need keepalives. TCP is tracked by its flags; UDP and ICMP by timers.

First checks

  • conntrack -L | head — Linux connection table
  • show conn (ASA) / show session all (Palo Alto) — firewall sessions
  • Session timeouts — config

Verify in this order

first packet → policy → session created → return allowed

Where it usually breaks

First mismatch in endpoint/identity → path/reachability → policy selection → enforcement/session → protected flow → telemetry/detection; preserve identity/policy/pre-state before mutation.

Network Security → Stateful Inspection proof map

BoundaryEstablishDoes not establish
Scope and intentExact subjects, destinations, application, direction, trust zone and expected decisionDoes not prove effective path, identity, cryptography or enforcement
Effective control stateResolved rule/policy, session/SA, identity/posture, translation and selected pathObject/config presence does not prove a match or packet outcome
Runtime evidenceCorrelated client, authenticator/firewall/VPN, AAA and destination observations for one flow/timeA single log or success does not prove every packet, peer, path or failover state
ClosureOriginal allowed/denied operation behaves as intended and regression/failure tests passAdministrative commit or tunnel-up state alone is not closure

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4586

Confirmation

Confirm action

Continue?