8 ms·
Show HN: Get your local and public IP addresses in JavaScript
- mtmail 12y ago"Additionally, these STUN requests are made outside of the normal XMLHttpRequest procedure, so they are not visible in the developer console or able to be blocked by plugins such as AdBlockPlus or Ghostery. This makes these types of requests available for online tracking [...]" So the extra effort to get around adblockers?
- hackcasual 12y agoYou can see it in: chrome://webrtc-internals/
- aikah 12y agoI hope webrtc isn't authorized by default by browsers.I want to give explicit consent.It should even have been that way for ajax requests.
- slang800 12y agoWhat makes AJAX requests dangerous?
- slg 12y agoSome people just want to know about any data their browser is sending server side. In the old days, your browser would not do anything without you making a conscious action. Widespread AJAX use changed that so your browser could be sending information to a server without any oversight. That lack of oversight isn't inherently dangerous, but certainly has potential for exploitation.
- eknkc 12y agoYou could always send information using javascript by loading images, hidden iframes etc. (You would not get a meaningful response though). This applies to dark old days even before JS..
- deleted 12y ago[deleted]
- hrjet 12y agoGreat point. Lately we have been reconsidering the request manager matrix shown in gngr. It was inspired by HTTPSwitchBoard's matrix, that has a separate column for XHR. However, like you pointed out, there are other ways than XHR to leak data if JS is enabled. If JS is not enabled, the kinds of data that can be leaked is fewer (perhaps screen resolution and size). Would welcome expert comments on our issue tracker: https://github.com/UprootLabs/gngr/issues/90 https://github.com/UprootLabs/gngr/issues/90
- ChrisAntaki 12y agoYou might be interested in NoScript. With this addon, JavaScript can be blocked by default, and allowed on pages of your choosing.
- throwaway125 12y agoThis can be disabled in firefox's about:config page by setting media.peerconnection.enabled to false. The problem with disabling all these features on a case by case basis is that you contribute to a richer fingerprint this way. Browsers will become increasingly more vulnerable to fingerprinting and there doesn't seem to be a way to stop it without going back to the dark ages of the web.
- 13 12y agoThere really needs to be a writeup of all the Firefox defaults to change to make your browser actually secure. That's one I didn't know about. I think that your local IP is actually going to be very unique for some people, more so than just having this "feature" disabled.
- yourad_io 12y ago> to make your browser actually secure To make it secure, disable all plugins. To make it more private, that's another story. Poor Firefox actually tries its best not to make you identifiable in some superficial ways - e.g. lying about user agent in "obscure" OSes. My FF reports 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/blah Firefox/blah', and I am not on Windows. I don't remember enabling anything like this in any way so I assume it is the default behaviour. This is with "nothing" as an option for DNT btw (neither yes nor no). Ultimately this is moot as you can't get around your font & rendering fingerprints that can be extracted from a hidden canvas element, but hey. Still better than serving it up in a platter. > your local IP is actually going to be very unique for some people, more so than just having this "feature" disabled. How so? It'll fall ion pretty standard ranges. I only find any use/value in it when combined with the remote IP + the rest of your env. characteristics. When you have to delve into about:config to disable it, 99.99% of people will have it enabled. This + your remote IP would pretty much identify you just fine. ${witty_double-edged_sword_quote}
- synunlimited 12y agoThe user agent string is just a convoluted mess because websites started displaying content based on that string so newer browsers had to fake it so they would still work with these websites. User agents don't mean much nowadays because of this.
- hbbio 12y agoThis was already shown January 7th by: http://jsfiddle.net/alokmenghrajani/0qo4kq7x/ http://jsfiddle.net/alokmenghrajani/0qo4kq7x/
- totony 12y agoDoes not work on Firefox Developer edition 37.0a2 media.peerconnection.enabled is set to true EDIT: hbbio's jsfiddle works
- deleted 12y ago[deleted]
- diafygi 12y agoWhat is in in the about:config for "media.peerconnection.default_iceservers"? They could have removed the default STUN server.
- abbeyj 12y agoThis error message in the console looks like it indicates the problem: TypeError: Not enough arguments to mozRTCPeerConnection.setLocalDescription. webrtc-ips:72:20 According to the docs, the error callback is not optional.
- donatj 12y agoIts particularly interesting in that it gets ALL my local ip addresses. This seems quite dangerous. Could they just start probing around my local network or does cross domain stuff kick in?
- doktrin 12y agoI don't see how. WebRTC may leak your local IP, but that doesn't mean someone outside your local network can interact with it (without compromising a machine on said network).
- tonyarkles 12y agoIf your router is vulnerable to XSS or something like it, an attacker can probably guess its IP pretty easily (x.x.x.1). Edit: I realized I didn't take this to its full conclusion. Guess the router's IP, exploit XSS to open ports on the router to your machine (JS knows your local IP already), carry on escalating from there.
- peteretep 12y agoGiven that ten IP values will cover 99% of routers, could as easily cycle through them all...
- doktrin 12y agoThat's a great point. You're 100% correct. Can you recommend any good reading on offensive security?
- bestham 12y agoYou could have a look at Samy Kamkars talk "How I met your girlfriend" at Blackhat 2010: https://www.youtube.com/watch?v=O5xRRF5GfQs&ab_channel=killab66661 https://www.youtube.com/watch?v=O5xRRF5GfQs&ab_channel=killa...
- deleted 12y ago[deleted]
- binwiederhier 12y agoHoly cow. Browser devs seem to become crazier by the minute. Combine this with the lack of a same-origin policy in the JavaScript websocket API and you can really poke around in the local network.
- wereHamster 12y agoWell, for websockets it's up to the server to check if the connection should be accepted or not. Same as in CORS whnere the server sais who is allowed to access the resources, not the browser.
- geofft 12y agoThere's no SOP in the JS websocket API because websockets are a newly-designed protocol specifically for the use case of being called from JS. If you have websocket servers on your local network (... although, why?) they know they should be checking origin.
- jessaustin 12y agoIf you have websocket servers on your local network... Maybe those aren't common, but it's very common to have something that looks just like one (speaks HTTP on port 80), which is called a web server. That might be embedded in your router or other device, or it may be a configuration interface for your POS, or it might be hiding in some other dark and unpatched corner that was formerly hidden behind a firewall. Of course it would be nice if the server simply doesn't respond (while writing alarms to the log) when it sees an Upgrade: websocket header, but can we be sure that all our hidden servers are so well-behaved?
- geofft 12y agoThe intention of the WebSocket protocol is that the handshake is sufficiently unlike HTTP that nobody could make a meaningful response to it by mistake. As for non-meaningful responses, isn't this equivalent to using <img src="http://192.168.1.1/admin?action=evil"> http://192.168.1.1/admin?action=evil"> to send an HTTP request? That's also not restricted by same-origin, and never has been and never will be. You get the same result -- you cause an HTTP request to be sent somewhere, and the response isn't useful to you nor is the contents of the response visible to you, but the request and its side effects still happen. I'm not super well-versed in websocket design, so I'm happy to be convinced I'm wrong, but that's my understanding of why it works the way it does.
- joshmn 12y agoI use this exact method for fraud detection. 99% of the time, carders " " will simply load up a proxy in Firefox/Chrome (usually a socks5) and fire away. They typically don't tunnel their whole connection through the proxy, just their browser. If their request IP doesn't match up with this IP, there's a very high chance that the order will is fraudulent.
- vld 12y agoedns-client-subnet (if present) can catch some frauds, too.
- joshmn 12y agoSh you'll ruin my startup!!!!!!! ;)
- sauere 12y agoNot that i'm a expert. But i think only amateurs would be so foolish. Nearly all open proxys out there forward the clients real IP in the HTTP X-FORWARDED-FOR header.
- zobzu 12y agonot really - theres a bunch of anonymous proxies. also socks proxy dont have any control over that anyway
- peteretep 12y ago> i think only amateurs would be so foolish When I think of people using stolen credit cards to buy goods, I'm not envisaging a `leet hacking squad... That there are highly sophisticated cyber criminals in no way implies that all - or even most - are.
- joshmn 12y agoIn a former life, I was an expert. HTTP proxy is not a SOCKS4 is not a SOCKS5. :) What they'll do is buy from a proxy shop " " - usually someone(s) with a botnet and a lot of clients on that botnet - so the IPs are residentials. vip72.com is a popular one. They do provide a client which will allow you to tunnel your entire system through the proxy, but it's not required for use (and some people are wary of it)
- trainbeeps 12y agoIf you use Chrome and a Tor SOCKS proxy, get ready for a big surprise. Edit: owfffjaqvllmh4zi.onion reveals true IP addresses when using Chrome through Privoxy and Tor chain.
- jwise0 12y agoThat is an important piece of information, but viewers be advised: that page has a non-work-safe background and is NOT exactly a copy of the GitHub demo page (and has other obfuscated JavaScript running on it).
- droithomme 12y agoThe concept is useful, but the API with its need for all these asynchronous callbacks, really sucks donkey balls.
- benmorris 12y agoThis is pretty good timing. I got an email from Braintreepayments this week that I needed to implement some code changes for fraud detection and paypal before march. Upon integrating this code I noticed some odd data being sent back: https://www.braintreepayments.com/docs/ruby/general/fraud_tools https://www.braintreepayments.com/docs/ruby/general/fraud_to... It turns out that this script must employ this techinque. After inspecting the requests in chrome Dev tools it appears all my private ips were being collected and sent over the wire back to Braintree (or whatever company is hosting their fraud detection).
- nfriedly 12y agoI set up http://ip.nfriedly.com/json?callback=foo http://ip.nfriedly.com/json?callback=foo a while ago - it's available if anyone is interested in a simpler version that also works for older browsers.
- madeofpalk 12y agoWhen you're on the command line: curl ifconfig.me
- nfriedly 12y agoNice! I didn't mention that http://ip.nfriedly.com/text http://ip.nfriedly.com/text works too, but I like the ipconfig.me domain name.
- mattaustin 12y agoThis is the bug from goole about a year ago saying it is by design. https://code.google.com/p/chromium/issues/detail?id=333752 https://code.google.com/p/chromium/issues/detail?id=333752
- olalonde 12y agoWow, seems like a big privacy issue. Does this mean that VPNs soon won't be effective for masking your IP?
- The_Fox 12y agoNo. Your public IP has always been available to a Javascript developer who knows enough to write a one-line PHP script that prints $_SERVER['REMOTE_ADDR'] (as an example). This just makes it available via another protocol. The new bit is that you can now get local IPs. But that doesn't help someone trying to figure out if you're using a VPN.
- olalonde 12y ago> Your public IP has always been available to a Javascript developer who knows enough to write a one-line PHP script that prints $_SERVER['REMOTE_ADDR'] (as an example). The demo shows both my USA VPN IP address and my China Telecom IP address under "public addresses" (I strongly doubt this was possible before WebRTC). This means that Hulu, YouTube, Netflix etc. can now start blocking me even when I'm behind a VPN.
- The_Fox 12y agoThe demo reported 192.168.56.1 as a local IP. Now they know I have VirtualBox installed. I wonder what other IPs can leak information about common apps and network configs.
- desdiv 12y agoLet's have a quick survey: 1. Are you currently using WebRTC in any projects? 2. Are you planning on using WebRTC in the future? 3. Do you think that WebRTC should be enabled by default in browsers?
- contingencies 12y ago1. No / 2. No / 3. Yes, with explicit permission and warnings every time.
- daGrevis 12y ago1. Yes, see https://github.com/daGrevis/hndrx https://github.com/daGrevis/hndrx 2. Obviously, 3. With explicit permit from user each time it's needed (like it's for webcam);
- xyby 12y agoWhy do I have two public IP addresses?
- jenscow 12y agoIt assumes anything other than 10.* and 192.168.* are public. https://github.com/diafygi/webrtc-ips/blob/master/index.html#L83 https://github.com/diafygi/webrtc-ips/blob/master/index.html...
- blueskin_ 12y agoDoesn't work for me, thankfully. The funny thing is, I have enough different privacy and security addons that I don't even know which one is protecting me here (best bet is possibly NoScript, even though I allowed scripts on that page).
- josteink 12y agoFails in Firefox nightly with the following errors: This site makes use of a SHA-1 Certificate; it's recommended you use certificates with signature algorithms that use hash functions stronger than SHA-1.[Learn More] webrtc-ips TypeError: Not enough arguments to mozRTCPeerConnection.setLocalDescription. Here's me hoping they're addressing these concerns already.
- szimek 12y agoI've been using it for almost a year on sharedrop.io (p2p file transfer app) to distinguish peers in the same local network. The code I'm using for finding local IP comes from http://net.ipcalf.com http://net.ipcalf.com. The app even allows you to select your local IP in case you got more than one, e.g. because of VPN.
- snake_plissken 12y agoIs there a specific reason stun.services.mozilla.com cannot be pinged successfully? Is this by design? Edit: Apparently it is by design; ICMP ECHOs are blocked by default on AWS instances, on which stun.services.mozilla.com [54.172.47.69] is running. http://aws.amazon.com/articles/1145?_encoding=UTF8&jiveRedirect=1#18 http://aws.amazon.com/articles/1145?_encoding=UTF8&jiveRedir...