Skip to content
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

VMess Proposal AEAD Based Packet Length #940

Closed
wants to merge 5 commits into from
Closed

Conversation

xiaokangwang
Copy link
Contributor

@xiaokangwang xiaokangwang commented Apr 28, 2021

Currently, the Packet Length of VMess is masked but unauthenticated. This is not currently being used for attacking VMess based proxy, but could make it harder to diagnose issues in the other part of the project.
The design of the new AEAD Based Packet Length:
The previous Shake based packet length is replaced with:
Shadowsockets AEAD like AEAD Encrypted Length, with the key derived from traffic encryption key. The nonce for the AEAD Encrypted Length is same with the data key.

感谢 @RPRX 提供的问题报告。

@RPRX
Copy link
Contributor

RPRX commented Apr 29, 2021

稍等,还有其它一些问题,另外不建议继续 breaking,另外真就不提一下我吗

@xiaokangwang
Copy link
Contributor Author

xiaokangwang commented Apr 29, 2021

Currently, VMess protocol will send an empty packet to signal the graceful shutdown of the tunnel, this is used to support connection reuse, which do not exist anymore.

This signal is removed to prevent traffic length analysis.

感谢 @RPRX 提供的问题报告。

@xiaokangwang
Copy link
Contributor Author

xiaokangwang commented Apr 30, 2021

Currently, the vmess and shadowsocks client do not use the drain behavior on read. This means the message boundary information is not hidden. This can leak the identification information about the the protocol.
Drain will be used on client to prevent this issue.

感谢 @RPRX 提供的问题报告。

Update:
Without Mux, attacker can still approximate the message boundary information by observing the traffic pattern of the underlying transport.

感谢 @RPRX 提供的问题报告。

@xiaokangwang
Copy link
Contributor Author

The Previous VMess Packet Design:

  • Masked Length
  • Encrypted Payload
  • Padding

The Purposed VMess Packet Design:

  • Encrypted And Authenticated Length
  • Encrypted And Authenticated Payload
  • Padding

Masked Length is Length XOR with a procedurally generated masked value, which is malleable.
Encrypted And Authenticated Length is encrypted and authenticated with a key derivated from the Encrypted And Authenticated Payload's key, and sealed with the same IV with the Encrypted And Authenticated Payload.

@RPRX
Copy link
Contributor

RPRX commented Apr 30, 2021

OK,目前问题一二三均已解决,我吃完饭看下代码,之后还需要一个全局 error->drain

@xiaokangwang
Copy link
Contributor Author

xiaokangwang commented Apr 30, 2021

a generic fail then drain may have performance implication and is therefore not purposed as a part of this PR.

@Emmricjordans

This comment has been minimized.

@xiaokangwang
Copy link
Contributor Author

@RPRX 你想不想先发呢, 如果你能2天内发布的话我可以等你一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants