New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 797323 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug



Sign in to add a comment

TCPv4 ISN and IP ID leak 16 bit of jiffies

Project Member Reported by tnagel@chromium.org, Dec 22 2017

Issue description

Chrome Version: 65.0.3299.0
OS: Chrome

The way IP ID is set for TCP v4 connections ("write_seq" is the ISN)

  inet->inet_id = tp->write_seq ^ jiffies;

allows to reconstruct 16 bits of jiffies by reversing the calculation:

  jiffies = IP_ID ^ ISN;

This is bad because it provides lots of entropy to fingerprint devices.


According to RFC6864:
   >> Sources emitting non-atomic datagrams MUST NOT repeat IPv4 ID
      values within one MDL for a given source address/destination
      address/protocol tuple.

It is not clear to me that the current method of generating the IP ID does anything to meet this condition other than randomizing IP IDs. ISNs are chosen at random (for some definition of the word) and XORing with jiffies to obtain the IP ID does not seem to create an additional benefit, except that it also leaks jiffies.

Thus I propose to drop jiffies from the calculation and to simply set the IP ID as the low 16 bits of the ISN. (This does no better than the current implementation for satisfying RFC6864, but also no worse.)
 

Comment 1 by tnagel@chromium.org, Dec 22 2017

Description: Show this description
Cc: groeck@chromium.org cernekee@chromium.org

Comment 3 by groeck@chromium.org, Jan 16 2018

Cc: edumazet@google.com
Not sure I understand "This is bad because it provides lots of entropy to fingerprint devices"; it is not clear to me what "it" refers to. Assuming it refers to jiffies, I hope that jiffies is not used to provide entropy to anything. If it does, maybe the code relying on it should be changed.
Note that the value is set when the socket is created. As such, it does not leak a current value of jiffies, but the value of jiffies when the socket was created. I am not sure if I would call that a leak. Also note that this is not a tcp specific problem - other IP protocols do the same, sometimes even using jiffies directly.

Anyway, I am neither a security nor a networking expert; this should be evaluated by those who are. At the same time, I am wary of changing tcp code unilaterally, much less changing a field like this. The case for this change should be made upstream.

Comment 4 by edumazet@google.com, Jan 16 2018

This looks quite low entropy to me. Good luck exploiting this.

Real problem came with TCP TS option, which was clearly sending the 32bit jiffies on the wire.

This was fixed in linux-4.10


Comment 5 by groeck@chromium.org, Jan 16 2018

Cc: mnissler@chromium.org
+mnissler@ for feedback from security folks.


Comment 6 by tnagel@chromium.org, Jan 17 2018

Eric, thanks a lot for chiming in! I can see that the v4.12 kernel has 95a22caee396cef and 84b114b98452c43 -- does that mean that TCP timestamp fingerprinting is solved or are there remaining issues?

Concerning the exploitability of IPID^ISN: Assuming HZ=1000 (as is the case for Chromebooks) and attacker time resolution of 100ms (rather conservative) this means an attacker can distinguish 2**16/100=655 different states (~9 bits of entropy). The birthday bound of that is sqrt(pi/2*655)=32 which means that approximately 32 devices could be distinguished behind a NAT via IPID^ISN which likely in many cases is sufficient (together with the public IP address) to uniquely identify a device. Thus imho there would be significant merit in removing the jiffies contribution to the IP ID.

Comment 7 by edumazet@google.com, Jan 17 2018

v4.12 kernel being release after v4.10, it includes the fix on TCP TS randomization. (ie 32bit jiffies is no longer leaked)

Honestly I do not understand what you are referring to about distinguishing devices behind a NAT.
A NAT is not something that adds security.

If you have a known attack using 16bit of jiffies, please let us know, and make sure hundred of call sites in the kernel no longer uses jiffies.




Comment 8 by tnagel@chromium.org, Jan 17 2018

It's a fingerprinting issue: A passive observer on the network may learn how many devices operate behind a NAT and may group the observed network traffic by device. If a part of the grouped traffic can be associated with a person, the remainder of the traffic of that group may be associated with that same person, breaking plausible deniability ("somebody else on that wifi did it") for that person. In general we would like the network stack to reveal as little information about the identity of the user/device as possible, including correlations between traffic from the same device.

Comment 9 by edumazet@google.com, Jan 17 2018

But the presence of the NAT has nothing to do with IP ID generation of a particular host behind the NAT.

To my knowledge no firewall ever tried to rewrite IP ID.
Are they broken as well, considering most linux kernels are leaking 16 bits of jiffies ?


Cc: chromeos-security@google.com
Owner: tnagel@chromium.org
Status: Assigned (was: Untriaged)
Thiemo to follow up on the question in #9.
Components: -Privacy Privacy>Fingerprinting
Owner: ----
Status: Available (was: Assigned)
Re comment #9: This has nothing to do with NAT mangling the traffic. In fact it's a problem even without NAT. The offset of jiffies w.r.t. wall clock provides a certain amount entropy (up to 16 bits in this case, depending on measurement precision) that may be used to re-identify the device after it has changed IP address.

Sign in to add a comment