Thirty days to Halcyon · Case 1: Four seconds at 03:12 · Episode 4 of 18

Priya Nair, Propulsion Lead, puts a printout on your desk. It says that the new inline intrusion prevention system (IPS) for the Station North update server can fail open or fail closed.

"One sentence, please," she says. "If it fails closed, what does that cost me in days?"

Vera Vance, your mentor, stirs her cold coffee. "And what does it cost if it fails open?"

Interactive lesson · stateful firewall · 3D

A reply needs a reason.

Get an update through the firewall. Follow the request out, then discover why its reply gets in and a stranger does not.

Press Play to follow the story. Pause any time to read the packet.

Internet → firewall → update serverDrag to look around
Try a different outcome Experiments & playback options

Rules · first match wins

    Connection memory

    Illustrative network with one firewall and TCP only. NAT, UDP and ICMP state, exact timeouts, and how real products order state and rule checks are left out. When the rules change, the bench starts a fresh run and clears its rows; many real firewalls keep existing connections. Encrypted Client Hello would hide the server name shown here. Neither the IDS nor the IPS here decrypts TLS; some real products do. Packet timing is slowed down so you can follow each decision.

    The next lesson follows that traffic into the proxy.

    Same steps without the 3D view

    The 3D view needs JavaScript and WebGL. This text gives the same steps.

    Read. A rule matches some of five values: source address, source port, destination address, destination port, and protocol. The firewall reads its four rules from the top, and the first match decides.

    Remember. The update server at 192.0.2.10 acts as a client and sends a SYN to a download mirror at 203.0.113.80 port 443. Rule 1 allows it, and the firewall writes a row. The SYN-ACK matches the row, so it passes with no rule. The server's ACK completes the handshake, and the row changes to Established. The firewall can read the server name in the ClientHello, but not the path inside TLS. The row ends when the connection closes.

    Refuse. An outside host at 198.51.100.20 gets in to port 443 through rule 2. Its SYN to port 22 matches only rule 4, and the firewall drops it. Its packet with the ACK flag matches no row, so the firewall drops it too. With drop, the sender waits and retries the SYN. With reject on, the firewall instead sends a TCP reset with the server address as its source, so the sender stops at once.

    Order. A SYN from 198.51.100.66 to port 443 matches rule 2 before rule 3, so it gets in. When rule 3 moves to the top, the firewall drops the next SYN. The bench starts a fresh run when the rules change, so the old row is gone; many real firewalls keep existing connections.

    Watch and block. An IDS on a mirror port sees a path attack in plain HTTP and sends an alert, but the server gets the request. An inline IPS stops it. A real user's request that contains ../ matches the same signature: the IDS sends an analyst a wrong alert, and the IPS blocks the user's page. When the IPS gets too much traffic, fail open lets the attack pass and fail closed stops all traffic. Neither device can read the attack inside TLS.

    Read the lesson, check your judgment, and explore sources

    Helpful first: How one request crosses the network

    By the end you can

    • Match a packet to the first rule that fits its five values, and let the last rule deny the rest
    • Let a reply through a state row, and drop a stranger that matches no row and no allow rule
    • Explain how an intrusion detection system (IDS) that alerts on a copy differs from an intrusion prevention system (IPS) that can drop the packet

    A rule matches five values

    A firewall stands between two networks. It looks at each packet and decides if the packet can go through. On this bench the firewall sits next to the internet router. The update server is on the inside at 192.0.2.10. The internet is on the outside. This bench gives the server a public address, so the firewall does not translate addresses.

    The firewall reads five values in each packet. We call these five values the 5-tuple.

    • the source address
    • the destination address
    • the source port
    • the destination port
    • the protocol, for example the Transmission Control Protocol (TCP)

    A rule names the values that it matches and the direction of the packet. A rule can use "any" for a value.

    The first match decides, and the last rule says no

    The firewall reads its rules from the top of the list. The first rule that matches the packet decides the result. The firewall does not read the rules below it. Many firewalls work this way, but some use a different order. This bench uses the first match.

    If no other rule matches, the last rule decides. That rule is the default deny. It blocks all traffic that no rule above it allows. The National Institute of Standards and Technology (NIST) calls this deny by default. Its guide SP 800-41 Rev. 1 (September 2009) tells organizations to block all traffic that the firewall policy does not permit.

    A firewall can block a packet in two ways. When it drops the packet, it sends nothing back. The sender waits and sends the packet again. When it rejects the packet, it sends back a TCP reset or an Internet Control Message Protocol (ICMP) error. The sender learns at once that the connection failed.

    The state table lets the answer back in

    The update server sends a SYN from port 50514 to the update mirror at 203.0.113.80 on port 443. A SYN is the first TCP packet of a connection. It asks to open the connection. Rule 1 allows this packet. The firewall then writes a row in its state table. The row holds the 5-tuple of this connection and its state, Initiated.

    The mirror sends a SYN-ACK back. A SYN-ACK accepts the connection. No rule allows inbound traffic to port 50514. But the packet matches the row in the state table, so the firewall lets it through. Return traffic that matches a state row does not need its own rule.

    The update server then sends an ACK, which confirms the SYN-ACK. After this handshake, the row changes to Established. The firewall can often read the server name in the ClientHello, the first message of Transport Layer Security (TLS). It cannot read the encrypted records after the handshake. The row ends when the connection closes, or after a long time with no traffic.

    PUT IT IN ORDER

    The update server opens a connection to the mirror. Put the steps in order.

    1. Rule 1 allows it and the firewall writes a row
    2. The server sends a SYN from port 50514
    3. The mirror sends a SYN-ACK that matches the row
    4. The server sends an ACK and the row becomes Established

    Show the answer
    1. The server sends a SYN from port 50514
    2. Rule 1 allows it and the firewall writes a row
    3. The mirror sends a SYN-ACK that matches the row
    4. The server sends an ACK and the row becomes Established

    Rule 1 allows the SYN. The reply matches the row, so it needs no inbound rule. The row becomes Established after the ACK.

    A stranger finds no row

    An outside host at 198.51.100.20 sends a SYN to port 443. Rule 2 allows new inbound connections to port 80 and port 443 on the server. The firewall writes a new row, and the server can answer. An allow rule opens only the ports that it names.

    The same host then sends a SYN to the server on port 22. No rule allows port 22, and no state row matches. The default deny drops the packet. The server never sees it.

    Next, the host sends a packet with the ACK flag and no SYN before it. It looks like return traffic. A stateful firewall checks its table first. No row matches this conversation, so the firewall drops the packet.

    WORKED EXAMPLE

    Nyx sorts three inbound packets

    1. The table. Nyx starts with one row: 192.0.2.10 port 50514 and 203.0.113.80 port 443, Established. Rule 2 allows new inbound connections to ports 80 and 443 on the server.
    2. Packet A. Data from 203.0.113.80 port 443 to 192.0.2.10 port 50514. It matches the row, so it passes with no inbound rule.
    3. Packet B. Data from 203.0.113.80 port 443 to 192.0.2.10 port 50600. No row names port 50600, and no rule allows inbound traffic to it. The default deny drops it.
    4. Packet C. A SYN from 198.51.100.20 to 192.0.2.10 port 443. It is a new connection, so rule 2 allows it and the firewall writes a second row.

    Result: Two packets pass and one is dropped. The same sender, 203.0.113.80, gets one packet through and one dropped, because only A has a row. The table now holds two rows.

    A rule in the wrong place never runs

    Rule 3 blocks a known bad host, 198.51.100.66. But rule 3 sits below rule 2. A SYN from the bad host to port 443 matches rule 2 first, so the firewall allows it. Rule 3 never runs.

    Move the block rule above the allow rule, and the firewall drops the packet. On a first-match firewall, the position of a rule decides, not its action.

    Watch a copy, or stand in the path

    An intrusion detection system (IDS) watches a copy of the traffic. A mirror port on the switch or a network tap gives it that copy. The IDS compares the traffic to signatures and sends an alert. A signature is a pattern that matches a known threat. The real packet does not go through the IDS, so the IDS cannot reliably stop it.

    An intrusion prevention system (IPS) sits inline. Each packet must go through it. The IPS can drop a packet that matches a signature before the packet gets to the server. An IPS often sits next to the firewall, or it is part of the firewall.

    An IDS or IPS cannot read the contents of TLS traffic that it cannot decrypt. It can read the addresses, the ports, and often the server name. It can read a plain Hypertext Transfer Protocol (HTTP) request in full.

    IDS on a mirror port

    • Sees a copy of the traffic
    • Sends an alert when a signature matches
    • Cannot reliably stop the real packet

    IPS inline

    • Each packet goes through it
    • Can drop a packet that matches a signature
    • A false positive stops the connection of a real user
    A copy or the path. An IDS watches a copy. An IPS stands in the path.

    SPOT THE PROBLEM

    These notes are from the same bench. Flag every line that claims something that the device cannot see.

    Show the answers
    • firewall note claims it read the path inside TLS The path sits inside the encrypted records. This firewall cannot read it.
    • firewall note says the reply was allowed because port 443 is open inbound The reply matched a state row. It did not need an inbound allow rule.

    A false positive or a failure has a cost

    No IDS or IPS is fully accurate. A false positive is a harmless packet that the system marks as an attack. When an IDS makes this mistake, an analyst gets a wrong alert. When an IPS makes this mistake, a real user loses the connection. A false negative is an attack that the system misses. In most cases, fewer false positives mean more false negatives.

    An inline device can fail, or it can get too much traffic. If it fails open, traffic continues with no inspection. If it fails closed, traffic stops. Fail open keeps the service available. Fail closed keeps the check in place, but the service stops.

    SORT IT OUT

    The inline IPS at Station North has stopped inspecting. Which failure mode does each line describe?

    1. Traffic keeps flowing with no inspection.

    2. Nobody can reach the update server until the IPS is fixed.

    3. An attack packet passes without a signature check.

    4. The check stays in place, but the service stops.

    Show the answers
    1. Fail open. Fail open keeps the service available. The check is skipped.
    2. Fail closed. Fail closed stops traffic when the inline device cannot inspect it.
    3. Fail open. With no inspection, the IPS cannot drop a packet that matches a signature.
    4. Fail closed. Fail closed keeps the check in place. The cost is that the service stops.

    One way out for web traffic

    A firewall can also force all web traffic through one point. One rule allows only a web proxy to send traffic to port 80 and port 443 on the internet. A second rule blocks the same traffic from all other devices.

    The next lesson follows that traffic into the proxy.

    CHECK YOUR JUDGMENT

    Priya asks what it costs if the inline IPS fails closed, and Vera asks what it costs if it fails open. What do you tell them?

    CASE FILE · CASE 1 · ENTRY 4 OF 18

    Answer the closing question correctly to add this entry to your case file.

    Inline means it can stop you

    Replies reach the Station North update server because they match state rows, and an inline IPS there can stop an attack or stop the service.

    Next episode: The firewall forces all web traffic through one point. Next, you follow it into the proxy.

    Open the case file ↗

    Review sheet: exam notes and quick reference

    Find your next idea.

    Tip: press / to open search. Escape closes this window.