RFC 5961: Hardening TCP against blind reset and SYN attacks

Summary

In August 2010, Anantha Ramaiah, Randall Stewart and Mitesh Dalal described in RFC 5961 how TCP can be hardened against RST, SYN and data segments injected by off-path attackers. Instead of accepting a suspicious segment immediately, the receiver answers with a challenge ACK that only the real peer can answer correctly. Of all things, the recommended throttling of these replies became a vulnerability itself in the Linux kernel in 2016.

Guessing is cheaper than expected

An attacker who cannot read the traffic has to hit source and destination address, both ports and a sequence number within the current receive window. For long-lived connections with fixed ports, such as BGP between routers, the first four values are often known, and large windows make guessing the sequence number easier.

RFC 5961 therefore tightens the rules: a RST only resets the connection if its sequence number exactly matches the expected one. If it merely lies somewhere in the window, TCP sends a challenge ACK; the real peer answers it with a correct RST, an attacker does not. A SYN in an existing connection is treated similarly.

Throttling as a side channel

So that challenge ACKs do not become a burden themselves, RFC 5961 recommends limiting their number, for example to ten in five seconds. The text adds that no case had been found in which the lack of such throttling could be exploited.

Linux implemented the limit as a global counter for all connections. In 2016 researchers at the University of California, Riverside showed (CVE-2016-5696) that an attacker could use this shared counter to detect whether two hosts were connected and to infer sequence numbers. Linux then changed the limit and randomised it.

Ideas

  • Off-path attackers must guess addresses, ports and sequence number.
  • Fixed ports, as with BGP, make guessing easier.
  • A RST only takes effect immediately with an exactly matching sequence number.
  • Challenge ACKs check whether the real peer is behind a segment.
  • A SYN in an existing connection also triggers a challenge ACK.
  • A global throttle can leak information between connections.

Insights

  • Shared counters are side channels; what is meant as protection can reveal the state of other connections.
  • Small, compatible checks make old protocols considerably more robust without breaking peers.

Facts

  • RFC 5961 appeared in August 2010.
  • As an example of throttling, the document gives ten challenge ACKs in five seconds.
  • The vulnerability in the Linux kernel has the identifier CVE-2016-5696.
  • RFC 9293 from 2022 updates RFC 5961.

References

Critique

  • RFC 5961 regarded the throttling recommendation merely as a risk-free precaution; the interaction of a shared limit with several connections was not considered.

Remarks

  • On Linux, net.ipv4.tcp_challenge_ack_limit controls the limit; older kernels from before the fix should be updated.

Recommendations

  • Keep kernels and network stacks up to date, because hardening such as RFC 5961 is implemented and corrected there.
  • Additionally secure long-lived router connections such as BGP with TCP-AO or at least TCP-MD5.
  • Treat unusually many challenge ACKs in monitoring as a sign of attacks.

Read the RFC at the RFC Editor

Search the Web Archive

Found a mistake or have something to add? Get in touch.