i want to understand more about WebRTC security when using vpn. id like to know if it is more secure with VPN than without… or even if its recommended to use WebRTC with VPN.

i created a webrtc demo: https://chat.positive-intentions.com/#/webrtc (the corresponding code its created with: https://github.com/positive-intentions/chat/blob/staging/src/components/pages/webrtc/WebRTC.jsx)

if i generate a “WebRTC offer” then i see a bunch of information including my IP address.

if i do the same with VPN, i see that my ip address isnt in that payload.

following the information here: https://thehackernews.com/2015/02/webrtc-leaks-vpn-ip-address.html?m=1

and using the demo here: https://ipleak.net/

it seems even with vpn, the local ISP ip seems detected.

a recurring concern ive had on reddit about the security of my app is that webrtc exposes ip addresses. im investigating using the app with vpn. it seems to work like normal.

in the example details given above, i see while the local ISP IP is exposed, the personal ip address is still hidden. im sure what is exposed there is not worthless, but it could help users with privacy and security.

on the back of this investigation id like to see if i can add something like a toggle in my app called “enforce VPN” which will first check to see if you are on a vpn, and if you are, open the rest of the app.

my app is using peerjs-server as the connection broker. this is a third party i have no contractual agreement to provide me with a service. it could help to hide your IP from this service.

  • refalo@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    2 months ago

    Why the IP leaks or not is entirely dependent on each user’s individual opsec… how you are connecting to the VPN, potentially your firewall/routing table setup, how the browser interacts with it etc.

    You said “if I do the same with VPN, i see that my ip address isnt in that payload”, but then you said ipleak.net does leak, but that you “followed information” from thehackernews.com before using ipleak.net, which from what I read seemed to just say “connect to expressvpn and run the test”… is that actually what you were doing? Were you using expressvpn the whole time or did you switch to just that one for the ipleak.net test or something? It’s not clear to me.

    The bottom line is that the IP can only leak if you let it. Regardless of how the VPN is accessed, whether that’s via a browser configuration (extension or proxy setting) or an OS-level layer3 tunnel (managed by a separate app or the OS itself), a misconfiguration or misunderstanding of how those work could cause the leak and there’s no fool-proof way for a web page to do anything about that. If you really want no leaks, then the user must actively choose to block all internet connections to anything BUT the VPN (and regularly test/verify that it works), some call this a “kill switch” although I really dislike the term.

    As for the “enforce VPN” option… depending on your definition of “VPN” in the context of your app, IMO you simply can’t do anything reasonably useful here. There are so many ways to mask your IP that there is no definitive way for a web page to know with any certainty that the user is “connecting via a VPN”, which some might say is impossible to quantify anyways. At best you might be able to use very flawed methods like scanning known IP ranges of well-known VPN providers, which IMO does not count as “detecting a VPN”, and even worse, doesn’t help with any sort of leak. I could be tunneling through tor, a neighbor’s wifi, ssh, or remote desktop or something for all you know. Does any of that count to you?

    • xoron@programming.devOP
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      “connect to expressvpn and run the test”… is that actually what you were doing?

      i tried with a different VPN provider but yeah. understandable for people to not go to an unknown websites like the demo i posted, so a link to the code on github is provided.

      IMO you simply can’t do anything reasonably useful here

      i agree… im stretching the definition of what is “reasonable”. id settle some something clunky likes a popup for the user to remind them to be on VPN. its important to understand im putting efforts in determining what the safest and securest way is to use my app. i think it has the potential to be a private and secure chat app. the app works with webrtc, the key attack-surface is individuals and their peers not applying good security practices.

      in traditional centralized chat system the central server will typically take responsibility for proxying request and consequently, the personal IP addresses are not needed to be shared. so having something like a toggle for “enforce VPN” might do nothing more than remind the user to turn on their VPN. but sometimes a reminder is what someone needs to use good security practices.