Improve the obfs4 obfuscation protocol
As part of our work for Sponsor 28, we will evaluate and improve the obfs4 obfuscation protocol, which may result in obfs5.
Roger started the discussion on our anti-censorship-team mailing list. Relevant reading is the CCS'15 paper Seeing through Network-Protocol Obfuscation and the S&P'16 paper SoK: Towards Grounding CensorshipCircumvention in Empiricism.
Let's use this ticket to keep track of this effort. Below is a list of ideas that we may or may not want to incorporate in obfs5.
== Randomisation
Obfs4 already implements randomisation for packet lengths and inter-arrival times but there are other protocol aspects that we can randomise. Note that the adoption of these strategies may complicate censorship analysis: if obfs5 instance X looks very different from obfs5 instance Y, then X may end up getting blocked while Y still works. Instead of saying "obfs5 is blocked," one may then have to be more specific and say "the obfs5 instances that rely on UDP are blocked."
-
Payload: All bytes that obfs4 writes to the wire are randomly distributed. These high-entropy packets may or may not be common on the Internet. We could evade a "high-entropy filter" by having obfs4 servers derive a formal language from the shared secret. This language could, say, use dummy clear-text headers. The LibFTE library may be helpful here.
-
Cover traffic: dcf explains that obfs4 only sends data when it's given data to send. To improve on this, as dcf suggests, we could make obfs5 send data even when the application has nothing to send.
-
Packet directions: An obfs4 flow begins with the client sending data to the server. We could randomise packet directions and have, say, the server talk first with a server-specific probability.
-
Transport protocol: An obfs4 server could talk either TCP or UDP or SCTP. This may very well not be worth the effort.
== Lessons learned from CCS'15 paper
-
DPI boxes tend to classify flows by only inspecting the first N packets of a flow. Keeping state is expensive, after all. We could exploit this by relaxing our obfuscation techniques after N packets to increase throughput.
-
The paper's data set may not be representative of what countries or ISPs would see:
- It's "only" a university uplink. Universities typically have policies that prohibit file sharing such as BitTorrent. BitTorrent's "message stream encryption" may look similar to obfs3 and obfs4.
- The data sets are from 2014, 2012, and 2010, respectively. That's a long time in Internet years.
- The detectors' false positive rates are non-trivial and, as the authors point out themselves, would be problematic for a censor given that non-obfuscated traffic significantly outweighs obfuscated traffic.
- Does the data set only contain one obfs4 server instance? This may have affected their results.
== Miscellaneous
-
yawning writes that obfs4 doesn't easily support backward incompatible protocol alterations.
-
yawning writes that the framing could use better cryptography.
-
Crazy idea: Use a modified TCP stack that ignores RST and FIN segments, so the GFW's on-path devices cannot tear down the connection. Instead, the obfs5 protocol could signal the end of the connection in an authenticated control frame. We could ignore RST and FIN segments by using firewall rules, or to get more crazy, by shipping a user space TCP stack (this may be easy to fingerprint, though).