This is interesting, thanks for sharing. I wonder if a remediation for the moment would be for local websocket servers to check the Host header before sending the 101 switch protocol response. Also would a CORS "Access-Control-Allow-Origin: localhost" prevent the connections being established?
Stealing secrets from developers using WebSockets
11–20 of 146 posts
Re: Stealing secrets from developers using WebSockets
#12This is interesting, thanks for sharing. I wonder if a remediation for the moment would be for local websocket servers to check the Host header before sending the 101 switch protocol response. Also would a CORS "Access-Control-Allow-Origin: localhost" prevent the connections being established?
This would prevent having to worry about people who use other hostnames for host even in localdev.
Re: Stealing secrets from developers using WebSockets
#13Re: Stealing secrets from developers using WebSockets
#14"In all seriousness, this attack vector is pretty slim. You’ve got to tempt unwitting users to visit your site, and to stay on it while they’re developing JS code."
Re: Stealing secrets from developers using WebSockets
#15This websockets thing is getting more interesting very fast. I wonder how long it'll be before someone finds something truly scary? This is the 3rd post this week, and each one has found a little bit more. Nothing that seems panic worthy yet. From this one: "In all seriousness, this attack vector is pretty slim. You’ve got to tempt unwitting users to visit your site, and to stay on it while they’re developing JS code…
Re: Stealing secrets from developers using WebSockets
#16This websockets thing is getting more interesting very fast. I wonder how long it'll be before someone finds something truly scary? This is the 3rd post this week, and each one has found a little bit more. Nothing that seems panic worthy yet. From this one: "In all seriousness, this attack vector is pretty slim. You’ve got to tempt unwitting users to visit your site, and to stay on it while they’re developing JS code…
So, something like evil counterparts to HN, reddit, StackOverflow, or latestcatvideos.com.
Re: Stealing secrets from developers using WebSockets
#17Re: Stealing secrets from developers using WebSockets
#18Earlier quoted context omitted.
Super bad news about that: even if it didn't allow the `localhost` string, DNS rebinding allows the domain name of the site you visited to become 127.0.0.1. The answer to why browsers allow connections to 127.0.0.1 from external sites is probably something like "legacy reasons".
DNS rebinding can be fixed at the DNS server level. OpenWRT has an option for it. But this websocket thing in browsers can't easily be turned off/mitigated AFAICT.
You can't always depend on that. eg. when you're on public/enterprise wifi that intercepts DNS requests.
Re: Stealing secrets from developers using WebSockets
#19[1]: https://youtu.be/pRlh8LX4kQI?t=954
[2]: https://chromium.googlesource.com/chromiumos/platform2/+/HEA...