-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Keyed mKCP obfuscation #2253
Comments
+1,brilliant |
I have been planning to merge kcptun, but there are not enough people to do it |
@kslr |
Kcptun is a nice and more bullet-proof transport, but mKCP is not completely broken or something beyond repair, nor does kcptun have a useful length padding mechanism, which is trivial to implement in current mKCP. IMO mKCP and kcptun should be implemented as two distinct transports, one for desperate people under desperate censorship, the other for those who seek for smooth connection and low latency. mKCP obfuscation efforts can be done in a few days and then left to bit-rot (actually the mKCP code did not undergo much maintenance) and it would still work happily for very long, while it takes more resources to maintain a kcptun implementation. I would like to see a quick-and-dirty mKCP obfuscation implemented before the kcptun port. And my apologies here. I understand there are too few people working on this. Thank you for your dedication on this project. |
@xiaokangwang Are there any plans to fix the issue that ACK segments have an odd length? It is also an obvious passive fingerprint. Some short padding of random length (maybe a PKCS5-style padding before encryption?) should suffice. |
This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days |
Please describe the new feature you want in detail.
The current implementation of mKCP does VERY BADLY in hiding protocol fingerprint. Its obfuscation is solely based on the first four bytes (authentication tag) of a packet, which can easily be identified. Therefore, I propose the following changes to the mKCP transport.
key
toKcpObject
. Its value should be a valid UUID. Therefore, if aKcpObject
has a non-emptykey
property, we can assume it enables keyed obfuscation as described in this issue.For cryptographic soundness, we should use a KDF combined with a stream cipher to implement obfuscation. This could also fix #2131.
For superior speed, XORing the obfuscation key with the packet authentication tag, and then feed it into a plain LFSR should suffice. It runs at less than 3 cpb on modern CPUs, so it should not pose any extra performance issue.
EDIT: XORing the obfuscation key with the packet authentication tag will not work well with plain LFSRs. An extra hash invocation per packet is necessary to generate the LFSR internal state.
The bottom line is we should rely on both the 4-byte authentication tag and the obfuscation key for key stream generation, so that simply XORing two packets will not reveal a pattern.
Currently all ACK segments have a length of an odd number (the documentation is outdated:
Len
of an ACK segment is actually 1 byte long), and for heartbeat segments it is a fixed 16 bytes. I believe it should work well to append a few bytes of LFSR output to the end of a packet.The text was updated successfully, but these errors were encountered: