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

update WebRTC #1282

Closed
Thorin-Oakenpants opened this issue Nov 30, 2021 · 20 comments
Closed

update WebRTC #1282

Thorin-Oakenpants opened this issue Nov 30, 2021 · 20 comments
Assignees

Comments

@Thorin-Oakenpants
Copy link
Contributor

Thorin-Oakenpants commented Nov 30, 2021

with a lot of help from @fxbrit - this issue is to lay out the info for the changes for the commit to refer to

🔹 final patch

/* 2001: disable WebRTC (Web Real-Time Communication)
 * Firefox uses mDNS hostname obfuscation on desktop (except Windows7/8) and the
 * private IP is NEVER exposed, except if required in TRUSTED scenarios; i.e. after
 * you grant device (microphone or camera) access
 * [SETUP-HARDEN] Test first. Windows7/8 users only: behind a proxy who never use WebRTC
 * [TEST] https://browserleaks.com/webrtc
 * [1] https://groups.google.com/g/discuss-webrtc/c/6stQXi72BEU/m/2FwZd24UAQAJ
 * [2] https://datatracker.ietf.org/doc/html/draft-ietf-mmusic-mdns-ice-candidates#section-3.1.1 ***/
   // user_pref("media.peerconnection.enabled", false);

/* 2002: force WebRTC inside the proxy [FF70+] ***/
user_pref("media.peerconnection.ice.proxy_only_if_behind_proxy", true);

/* 2003: force a single network interface for ICE candidates generation [FF42+]
 * When using a system-wide proxy, it uses the proxy interface
 * [1] https://developer.mozilla.org/en-US/docs/Web/API/RTCIceCandidate
 * [2] https://wiki.mozilla.org/Media/WebRTC/Privacy ***/
user_pref("media.peerconnection.ice.default_address_only", true);

/* 2004: force exclusion of private IPs from ICE candidates [FF51+]
 * [SETUP-HARDEN] This will protect your private IP even in TRUSTED scenarios after you
 * grant device access, but often results in breakage on video-conferencing platforms ***/
   // user_pref("media.peerconnection.ice.no_host", true);

🔹 not in patch, just FYI

/* FYI: this is the pref for mDNS
 * [1] https://bugzilla.mozilla.org/1554976 <- BUGZILLA ***/
   // user_pref("media.peerconnection.ice.obfuscate_host_addresses", true); // [DEFAULT: true desktop]

🔹 logic/reasons

All desktop users (ignoring win7/8) will NEVER leak their private IP unless they grant access: i.e it is a TRUSTED scenario, and even then it may not be used (test): it's not as if you are providing that info for all sites you visit - i.e not a tracking vector or stable FP metric. And none of this makes any sense unless your are protecting your public IP

The API itself will be inactive: with a setup harden for win7/8 users, who should test first: and obviously they wouldn't be WebRTC users if they want to kill the API - but again, it's rather (I say completely) pointless if they're not masking their public IP

That leaves how to harden the private IP when using a proxy. Of the three prefs, one is likely to cause breakage, so that can be inactive with a setup harden. Again, this is only ever going to be in a few trusted scenarios - users can test first and harden if they wish

@crssi
Copy link

crssi commented Nov 30, 2021

[SETUP-WEB] If you are not hiding your public IP, this is pointless,

What exactly is pointless?

I am browsing behind the same public IP that about 3-5k users are.
Even being on DHCP, most of the time DHCP works like giving the same IP address to the same host if available at that moment... which mostly always is on some private networks, not like public WiFi spots or similar.
I am not so sure, but still I think that in this case hiding private IP is not pointless. Or is it?

@Thorin-Oakenpants
Copy link
Contributor Author

in a nutshell

here is a post from earlier: fxbrit said

most important references from this issue:

  • mDNS explained.
  • 2 yo mDNS ticket at bugzilla.
  • media.peerconnection.ice.obfuscate_host_addresses is the pref that controls mDNS. android is fucked
  • win7/win8.* doesn't support mDNS at all.
  • IP is still exposed in this case, see here. if you're sharing the screen I think it's fair to assume that using the private IP is not an issue.
  • media.peerconnection.ice.proxy_only_if_behind_proxy should stay imo, it only proxies webrtc inside the proxy / vpn. see this comment, although it is from the pre mDNS era.

@Thorin-Oakenpants
Copy link
Contributor Author

Thorin-Oakenpants commented Nov 30, 2021

I am not so sure, but still I think that in this case hiding private IP is not pointless. Or is it?

Sure, there will always be edge cases, But IF you leak a private IP address, that will add to fingerprinting - but leaking your public IP is going to be far more damaging IMO - it depends on how unique your private IP is vs your public one.

It's pointless in the context of being worried about leaking a private IP but not the public one - you've got your priorities back to front.

Edit: I changed the draft it to "mostly pointless". My point is that if you're trying to be anonymous, you need to protect the IP. Another example is what I said about FPing - you're still returning an IP, even if it's a large VPN and you constantly hop, they can still be linked

@fxbrit
Copy link
Collaborator

fxbrit commented Nov 30, 2021

so it works like this:

  • whether you use a VPN or not, mDNS always kicks in and it protects your private IP by returning N/A.
  • after you allow mic OR camera access, it will however need a private address.
    • if you have a VPN it will grab two -> yours and the other one is probably at the VPN provider (not sure).
    • if you have a VPN and you use media.peerconnection.ice.default_address_only it will grab one -> the VPN provider one (again not sure).
    • if you do NOT have a VPN it will grab one -> yours.
    • if you do NOT have a VPN media.peerconnection.ice.default_address_only does nothing and it will grab one -> yours.
    • media.peerconnection.ice.no_host always returns N/A, whether you have a VPN or not -> it causes breakage and it often needs to be reverted for webrtc to work.

@Thorin-Oakenpants
Copy link
Contributor Author

.until you allow mic OR camera access, then it will need a private address.

shouldn't that be AFTER you allow .... it then needs a private address

@fxbrit
Copy link
Collaborator

fxbrit commented Nov 30, 2021

  • media.peerconnection.ice.default_address_only: "limit ICE candidates to the default interface only" according to mozilla, but it's not that good lol. this might also help you with wording. btw reading that link, do you want to mention something about within-LAN calls potentially going through TURN servers? in theory a non issue as long as the call is encrypted and the server isn't malicious, but I'm not super familiar with TURN.
  • media.peerconnection.ice.no_host: "eliminate all local addresses from the candidates" (from same link as above) sounds good. I would write:

    [SETUP-HARDEN] This will protect your private IP address even when you allow microphone or camera access, which often results in breakage on video-conferencing platforms.

@fxbrit
Copy link
Collaborator

fxbrit commented Dec 2, 2021

what's not so good about it? can you elaborate

it isn't a very understandable description, but it could be passable for lack of a better one I guess.

@msoxzw
Copy link

msoxzw commented Dec 2, 2021

I suggest media.peerconnection.ice.relay_only: only generate relay (TURN) candidates for ICE, so neither private IP nor public IP will be leaked.
It seems that many popular WebRTC based applications support TURN servers.
I have ever observed that some websites abuse WebRTC STUN servers to occupy upload bandwidth, ads delivery, etc. without user consent.

@rusty-snake
Copy link
Contributor

rusty-snake commented Dec 2, 2021

/* 2005: only generate relay (TURN) candidates for ICE
 * [SETUP-HARDEN] Not all WebRTC services support this
 * ^^ but you can set your own with
 *  media.peerconnection.use_document_iceservers=false media.peerconnection.default_iceservers=… AFAIK
 * [1] https://wiki.mozilla.org/Media/WebRTC/Privacy ***/
   // user_pref("media.peerconnection.ice.relay_only", true); // [FF42+] <- confirm

@msoxzw
Copy link

msoxzw commented Dec 2, 2021

Indeed, not all WebRTC services support this, but a lot of web conferencing services support this, e.g. Google Meet

@Thorin-Oakenpants
Copy link
Contributor Author

https://gitlab.com/librewolf-community/settings/-/issues/108

I'm proposing zero breakage and that media.peerconnection.ice.no_host be inactive - WbeRTC requires user permissions

@fxbrit
Copy link
Collaborator

fxbrit commented Dec 2, 2021

I'm proposing zero breakage

it would fuck over win7 and 8.x users.

@fxbrit
Copy link
Collaborator

fxbrit commented Dec 2, 2021

we cater to the majority to reduce friction

would you really want to leave these users out of this protection for one pref flip tho? we also don't have a clear indication of how much breakage that causes in the real world, maybe it's only a zoom/meet thing.

@Thorin-Oakenpants
Copy link
Contributor Author

@fxbrit do we need to change the win7/8 info (see last PR edit) based on that comment .. and looking at sparkling glitter-gitter disco LW room -> is this what you're referring to ? https://searchfox.org/mozilla-central/source/dom/media/webrtc/transport/mdns_service/src/lib.rs#447

@fxbrit
Copy link
Collaborator

fxbrit commented Jan 2, 2023

yes, that's the mDNS implementation in Firefox which covers the fact that older Win versions do not support mDNS natively. so we can remove the (except Windows7/8) bit since Android is the only platform without proper obfuscation and you documented that by adding desktop.

edit: forgot to mention that the above was confirmed on Mozilla's Matrix room so I 100% trust they are correct and my initial assumption was wrong.

@Thorin-Oakenpants
Copy link
Contributor Author

  • Firefox desktop uses mDNS hostname obfuscation on desktop (except Windows7/8)

if I remove the (except Windows7/8) part it's not strictly true, is it? Win7/8 does not use mDNS, it uses a built in FF fallback obfuscation

@Thorin-Oakenpants
Copy link
Contributor Author

^ just want to get the wording correct, suggest away

@fxbrit
Copy link
Collaborator

fxbrit commented Jan 2, 2023

it uses Firefox's own implementation of mDNS, so it's still correct. I would write:

/* 2001: disable WebRTC (Web Real-Time Communication)
 * Firefox desktop uses mDNS hostname obfuscation and the
 * private IP is NEVER exposed, except if required in TRUSTED scenarios; i.e. after
 * you grant device (microphone or camera) access
 * [TEST] https://browserleaks.com/webrtc
 ...

so remove the win7/8 bit and the [SETUP-HARDEN] tag.

the other webrtc prefs descriptions still apply.

@Thorin-Oakenpants
Copy link
Contributor Author

fuck, I added desktop when it was already there ... this is what happens when you snort sugar

@Thorin-Oakenpants
Copy link
Contributor Author

4d81df8

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

No branches or pull requests

5 participants