zaneschepke / wgtunnel

An alternative Android client app for WireGuard VPN
https://zaneschepke.com/wgtunnel-docs
MIT License
923 stars 47 forks source link

[BUG] - App crashes (and can't be re-started) when starting VPN with Junk Packet Count > 128 #410

Open bobpaul opened 1 month ago

bobpaul commented 1 month ago

Describe the bug I'm going to go on a limb and guess that maybe the Junk Packet Count is getting cast as a char somewhere instead of an unsigned char. I notice the Amnezia project's kernel module says Junk Packet Count must be <= 127 , but I don't really see why it couldn't be a million... The junk packet parameters are peer-specific settings that don't have to match other peers.

But once the app crashes it cannot be restarted because the app remembers the VPN was open and tries to start it again when the app opens, which causes it to crash again. So I see this as 2 bugs:

Smartphone (please complete the following information):

To Reproduce

  1. Create and test a Wireguard tunnel to verify it's working.
  2. Disconnect and edit the tunnel. Choose "Show Amnezia properties" and set
    • Junk Count: 128
    • Junk Min: 5
    • Junk Max: 20
    • Init Magic: 1
    • Response Magic: 2
    • Underload Magic: 3
    • Transport Packet: 4
    • leave init packet junk and response packet junk unset. Save
  3. Test the tunnel and confirm it works, but with some connection delay.
  4. Disconnect and edit the tunnel settings. Change Junk Count to 129 and save settings.
  5. Attempt to start the tunnel
  6. Notice the app crashes. If you have wireshark running, you'll notice no packets were sent.
  7. Attempt to open the app. Notice the app crashes. Sometimes the UI loads enough that you can see the broken tunnel link is active.
  8. Go to Android Settings -> Connections -> More Connection Settings -> VPN and delete the WG Tunnel VPN profile.
  9. You can now open WG Tunnel again.

Expected behavior

Additional Mitigations that might be good