Thread View: linux.kernel.netdev
3 messages
3 total messages
Started by Eugene Siegel
Mon, 23 Nov 2026 00:48
tcp: question about RST at SACK right-most edge
Author: Eugene Siegel
Date: Mon, 23 Nov 2026 00:48
Date: Mon, 23 Nov 2026 00:48
37 lines
13042 bytes
13042 bytes
Hi, I think because a TCP RST is accepted if sequence number matches the right edge of right-most SACK block (introduced in e00431bc93bb), it is easier for an off-path attacker to forge a TCP RST since they don't need to guess RCV.NXT. If the attacker gets a forged out-of-order segment queued, then they can also send a RST with sequence number at the end of the segment and cause disconnect. To forge, the attacker needs to guess the sequence in window, ack in acceptable range and know the 4-tuple. The application I work on is a distributed network and it is possible to know the IP addresses as well as the listening port. Finding the ephemeral port is discussed in https://www.cs.ucr.edu/~zhiyunq/pub/ccs19_tcp_model_checking.pdf; the SYN half-open queue side-channel they mention is still present in Linux 7.4-rc3 (aebb72744764). Our application periodically sends and receives up to 4 MB so the window size can be large and makes it easier for an attacker to guess acceptable sequence and ack numbers. The attacker's guesses consist of two packets: one packet guessing the sequence + ack numbers, followed by a RST. With our window sizes this is a few million packets compared to up to 2^32 packets when the sequence number has to match RCV.NXT exactly. I tested against two computers running our application and it worked as described. Is this something that Linux would consider hardening (perhaps by fixing the ephemeral port side-channel or by constraining the RST if possible)? If not, I'd appreciate any advice on what our application should do. I don't think we can use TCP-AO for all nodes in our network because some nodes are behind NAT. Thanks.
Re: tcp: question about RST at SACK right-most edge
Author: Eric Dumazet
Date: Mon, 23 Nov 2026 09:44
Date: Mon, 23 Nov 2026 09:44
86 lines
12459 bytes
12459 bytes
Le lun. 23 nov. 2026 à 01:49, Eugene Siegel <elzeigel@gmail.com> a écrit : > > Hi, > > I think because a TCP RST is accepted if sequence number matches the > right edge of right-most SACK block > (introduced in e00431bc93bb), it is easier for an off-path attacker to > forge a TCP RST since they don't > need to guess RCV.NXT. If the attacker gets a forged out-of-order > segment queued, then they can also send > a RST with sequence number at the end of the segment and cause > disconnect. Your description of the mechanism is correct. But note the precondition: the attacker must first get a forged segment accepted in the out-of-order queue. This is the blind data injection case of RFC 5961 section 5.2, and its cost does not depend on the SACK rule at all. > To forge, the attacker needs to > guess the sequence in window, ack in acceptable range and know the > 4-tuple. The application I work on is a > distributed network and it is possible to know the IP addresses as > well as the listening port. Finding the > ephemeral port is discussed in > https://www.cs.ucr.edu/~zhiyunq/pub/ccs19_tcp_model_checking.pdf; the > SYN > half-open queue side-channel they mention is still present in Linux > 7.4-rc3 (aebb72744764). Our application > periodically sends and receives up to 4 MB so the window size can be > large and makes it easier for an attacker > to guess acceptable sequence and ack numbers. The attacker's guesses > consist of two packets: one packet > guessing the sequence + ack numbers, followed by a RST. With our > window sizes this is a few million packets > compared to up to 2^32 packets when the sequence number has to match > RCV.NXT exactly. I do not think 2^32 is the right baseline. An attacker able to queue a forged segment can already corrupt the byte stream, for the same number of packets. If your application authenticates its data (TLS or similar), the corruption is detected when the hole is filled and the connection is closed anyway. If it does not, the attacker has something much better than a RST. So what e00431bc93bb gives the attacker is an immediate and clean reset instead of a delayed one. That is a small increment. The weak part is the RFC 5961 5.2 ACK check, which only requires the ACK to be in [SND.UNA - MAX.SND.WND, SND.NXT]. With 4 MB windows, this is about 10 bits for the ACK and 10 bits for the sequence, as you found. > I tested against two > computers running our application and it worked as described. Is this > something that Linux would consider > hardening (perhaps by fixing the ephemeral port side-channel or by > constraining the RST if possible)? For the RST part, I do not see a useful constraint. Anything we could check on the RST (sequence, ACK, timestamps) is either already guessed by the attacker at this point, or optional: segments without a timestamp option skip PAWS, and RST are accepted even if they fail PAWS. Reverting e00431bc93bb would bring back the problem it solved, without changing the cost of killing the flow. The port side-channel is more interesting, since it is a prerequisite for all off-path attacks. >If not, > I'd appreciate any advice on what our application should do. I don't > think we can use TCP-AO for all nodes in our > network because some nodes are behind NAT. TCP by itself does not protect against an attacker who knows the 4-tuple and can spoof the source address, especially with large windows. If this matters for you, the transport needs to be authenticated: WireGuard, IPsec with NAT-T, or QUIC all work across NAT. Your application should also be able to reconnect and resume. Thanks. > > Thanks.
Re: tcp: question about RST at SACK right-most edge
Author: Eugene Siegel
Date: Tue, 24 Nov 2026 13:59
Date: Tue, 24 Nov 2026 13:59
125 lines
17799 bytes
17799 bytes
> But note the precondition: the attacker must first get a forged segment accepted in the out-of-order queue. This is the blind data injection case of RFC 5961 section 5.2, and its cost does not depend on the SACK rule at all. After reading the RFC, I understand this better now. So the SACK rule is not the issue. > The port side-channel is more interesting, since it is a prerequisite for all off-path attacks. Is the half-open queue side-channel known but a wontfix? I saw it mentioned in the linked paper (it is 9-B in Table 3) and decided to go digging. Basically the off-path attacker fills the half-open queue of a host to 1 entry from full and can figure out whether the queue was filled (or not) by their port guesses. First, they send unspoofed SYN to fill the queue. Then, they send a spoofed SYN to the host for a known connection the host has and try to guess the ephemeral port of the other side. If the port guess is right, the host sends a challenge ACK to its peer and the queue is untouched. If it's wrong, the queue is now full and SYN-ACK is sent to the host's peer who might send RST back to the host (and remove the queue entry). If the attacker can send an unspoofed SYN (with window scaling, but without the timestamp option) to the host before the potential RST arrives, they will either fill the queue and receive a normal SYN-ACK (either the guess was correct or RST arrived first) or they will receive cookie SYN-ACK (either the guess is wrong or an unrelated entry was added to the queue). The attacker sets no timestamp option so they can distinguish which one is the cookie SYN-ACK. It would be nice if the side-channel was fixed, but I can't think of how without causing other problems. We can deal with this in our application by reconnecting as suggested. On Mon, Nov 23, 2026 at 4:44 AM Eric Dumazet <edumazet@kernel.org> wrote: > > Le lun. 23 nov. 2026 à 01:49, Eugene Siegel <elzeigel@gmail.com> a écrit : > > > > Hi, > > > > I think because a TCP RST is accepted if sequence number matches the > > right edge of right-most SACK block > > (introduced in e00431bc93bb), it is easier for an off-path attacker to > > forge a TCP RST since they don't > > need to guess RCV.NXT. If the attacker gets a forged out-of-order > > segment queued, then they can also send > > a RST with sequence number at the end of the segment and cause > > disconnect. > > Your description of the mechanism is correct. > > But note the precondition: the attacker must first get a forged > segment accepted in the out-of-order queue. This is the blind data > injection case of RFC 5961 section 5.2, and its cost does not depend > on the SACK rule at all. > > > To forge, the attacker needs to > > guess the sequence in window, ack in acceptable range and know the > > 4-tuple. The application I work on is a > > distributed network and it is possible to know the IP addresses as > > well as the listening port. Finding the > > ephemeral port is discussed in > > https://www.cs.ucr.edu/~zhiyunq/pub/ccs19_tcp_model_checking.pdf; the > > SYN > > half-open queue side-channel they mention is still present in Linux > > 7.4-rc3 (aebb72744764). Our application > > periodically sends and receives up to 4 MB so the window size can be > > large and makes it easier for an attacker > > to guess acceptable sequence and ack numbers. The attacker's guesses > > consist of two packets: one packet > > guessing the sequence + ack numbers, followed by a RST. With our > > window sizes this is a few million packets > > compared to up to 2^32 packets when the sequence number has to match > > RCV.NXT exactly. > > I do not think 2^32 is the right baseline. > > An attacker able to queue a forged segment can already corrupt the > byte stream, for the same number of packets. If your application > authenticates its data (TLS or similar), the corruption is detected > when the hole is filled and the connection is closed anyway. If it > does not, the attacker has something much better than a RST. > > So what e00431bc93bb gives the attacker is an immediate and clean > reset instead of a delayed one. That is a small increment. The weak > part is the RFC 5961 5.2 ACK check, which only requires the ACK to be > in [SND.UNA - MAX.SND.WND, SND.NXT]. With 4 MB windows, this is about > 10 bits for the ACK and 10 bits for the sequence, as you found. > > > I tested against two > > computers running our application and it worked as described. Is this > > something that Linux would consider > > hardening (perhaps by fixing the ephemeral port side-channel or by > > constraining the RST if possible)? > > For the RST part, I do not see a useful constraint. Anything we could > check on the RST (sequence, ACK, timestamps) is either already guessed > by the attacker at this point, or optional: segments without a > timestamp option skip PAWS, and RST are accepted even if they fail > PAWS. Reverting e00431bc93bb would bring back the problem it solved, > without changing the cost of killing the flow. > > The port side-channel is more interesting, since it is a prerequisite > for all off-path attacks. > > >If not, > > I'd appreciate any advice on what our application should do. I don't > > think we can use TCP-AO for all nodes in our > > network because some nodes are behind NAT. > > TCP by itself does not protect against an attacker who knows the > 4-tuple and can spoof the source address, especially with large > windows. If this matters for you, the transport needs to be > authenticated: WireGuard, IPsec with NAT-T, or QUIC all work across > NAT. Your application should also be able to reconnect and resume. > > Thanks. > > > > > Thanks.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads