How does a "What is my IP" site know my internal LAN address?

It uses a WebRTC method to gather your local ip:

Firefox and Chrome have implemented WebRTC that allow requests to STUN servers be made that will return the local and public IP addresses for the user. These request results are available to javascript, so you can now obtain a users local and public IP addresses in javascript.

Source: https://github.com/vitalets/webrtc-ips
PoC: https://vitalets.github.io/webrtc-ips/demo/

08/2019 update: Currently PoC don't fully works because Chrome added mDNS support to increase anonymity.

Tags:

Networking