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

The wireguard_write encryption result is different from the official one #353

Open
zxcvbnmkl112 opened this issue Jul 21, 2023 · 5 comments

Comments

@zxcvbnmkl112
Copy link

zxcvbnmkl112 commented Jul 21, 2023

Hi!

client: windows 10
server : centos 9

I used wireguard.exe and the allowed IP is 8.8.8.8.When I ping 8.8.8.8, I find that the original ICMP packet size is 60bit. 64bit after being encrypted by wireguard.

企业微信截图_16899020368439
企业微信截图_16899018169422
When I use wireguard_write, I find that it is still 60bit after encryption, and my server is not responding to the package.
企业微信截图_16899037372229

My IP packet processing flow:
1.use windivert to get the IP package (60bit)
2. changed the sending address of the IP packet to 10.66.66.2 and recalculated the checksum
3. use wireguard_write to encrypt
4. udp socket send the result of step 3.
Is there anything else I need to do?

@zxcvbnmkl112
Copy link
Author

This is my code about the handshake:
企业微信截图_16899041984883
企业微信截图_16899042328973

企业微信截图_16899042452466
企业微信截图_16899042768453

@zxcvbnmkl112
Copy link
Author

@alanesmizi
Copy link

It could be related to the size of the packet not being 100% Wireguard spec:

encrypted_static: &src[40..88],

encrypted_static: &src[40..88], // SIZE u8;32, 88-40 = 48 bytes, seems too big for the spec (32)
encrypted_timestamp: &src[88..116], // SIZE u8;12, 116-88 = 28 bytes, seems too big for the spec (12)

@zxcvbnmkl112
Copy link
Author

It could be related to the size of the packet not being 100% Wireguard spec:

encrypted_static: &src[40..88],

encrypted_static: &src[40..88], // SIZE u8;32, 88-40 = 48 bytes, seems too big for the spec (32) encrypted_timestamp: &src[88..116], // SIZE u8;12, 116-88 = 28 bytes, seems too big for the spec (12)

Is there something wrong with my handshake data? How do I deal with this? Thank you for your reply。
企业微信截图_16901664847924
企业微信截图_16901664951175

@alanesmizi
Copy link

I am afraid you need to do the analysis yourself. It may be related to handshake field length, but this is for you to find out...

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

No branches or pull requests

2 participants