Open martinduke opened 6 years ago
Kazuho raises the point that it is likely that the total set of server id codepoints is not likely to create a precisely uniform distribution of bit settings.
For example if there are three routing bits with server IDs 000 and 010, and a divisor of 3, the codepoints are: 000, 010, 110, 011, 101. If the non-routing bits are completely random, after collecting a large number of connection IDs we'll see that the leftmost bit is 1 40% of time, the second bit 60%, and the third 40% while all the other bits are at about 50%. In this toy example, the routing bits will be clear after only a few observed CIDs.
Some mitigating circumstances:
All that said, at the very least there should be some additional text about these problems. Better yet, some new language providing recommendations. At worst, a conclusion that this is unworkable and abandoning PCID.
Also, even a single server entering or leaving the pool will cause the statistics to change.
Upon further discussion with Kazuho, making routing bits xor out to 1s won't even work -- even if you could, which you probably can't, if you make the probabilities even across all CIDs through the load balancer, you almost certainly are not balancing them for every server. So the attacker would just open a connection, get a bunch of new connection IDs, and see the statistics.
A much more profitable approach is to introduce a little weighting in the non-routing bits, which totally frustrates this kind of attack.
We have discussed the observation angle previously on the mailing list.
In the absence of a demonstrable weakness, we should run the numbers and have our findings documented and available online. The question is: how to run the numbers.
While the consensus in Bangkok was that no one was super enthusiastic about PCID (though @dtikhonov said he would implement it), everyone was comfortable with sending it to the WG and letting them ultimately decide.
Consider this issue a forum to discuss potential attacks against the PCID algorithm.
The routing bits are secret, which is what protects the server mapping. To crack this, the attacker's first task is to discover the routing bits.
The two possible ways to obtain attack information are to (1) passively observe all (or a portion of) all CIDs coming out of a load balancer or (2) Open a connection and get many CIDs from one server, ostensibly for migration purposes.
There are basically two defenses: