This 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…
> 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.
Stealing secrets from developers using WebSockets
21–30 of 146 posts
Re: Stealing secrets from developers using WebSockets
#22Wrap the exploit up in a blog post about Rust -- or an article about gut bacteria -- and submit it to Hackernews. Boom, a virtual feast of secrets.
Re: Stealing secrets from developers using WebSockets
#23{"type":"error","data":"Invalid Host/Origin header"}
I don't think I changed any significant settings in CRA, this is pretty close to the default. Not sure what exactly determines whether this works or not.
Re: Stealing secrets from developers using WebSockets
#24The server didn't work for me, not sure if it's a traffic issue or what. I have at least 3 create-react-app and one next app running. I even ran a quick websocket server on port 3000 just to see but nada.
It was only tested on Firefox, as a basic proof-of-concept. AIUI, chrome et al offer similar functionality but maybe the API is different
It may also take a few minutes to find and connect to the websocket, I think CRA webserver maybe only binds to one client at a time, so maybe it would pick up the connection after a webpack-dev-server reload or two.
Re: Stealing secrets from developers using WebSockets
#25"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." Wrap the exploit up in a blog post about Rust -- or an article about gut bacteria -- and submit it to Hackernews. Boom, a virtual feast of secrets.
Re: Stealing secrets from developers using WebSockets
#26And this is why you are supposed to check the origin and host headers before sending sensitive data to a web socket
Re: Stealing secrets from developers using WebSockets
#27I get the following output when trying this with Create React App running: {"type":"error","data":"Invalid Host/Origin header"} I don't think I changed any significant settings in CRA, this is pretty close to the default. Not sure what exactly determines whether this works or not.
It's not clear (without a lot more digging) what impact the sockjs changes have on this issue.
Re: Stealing secrets from developers using WebSockets
#28This 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…
This is one Show HN post away from an exploit in the wild
Simply call Date.now() when adding the iframe and when that iframe's onerror event fires then diff the two. I think you can do this with img tags, frames, and anything backed by a network call that lets you observe load failures.
CORS doesn't save you because you aren't trying to reach into that iframe and run Javascript or access the DOM. A CSP doesn't save you because the site you're visiting is opting to do this and can put whatever they want in their CSP.
Re: Stealing secrets from developers using WebSockets
#29Re: Stealing secrets from developers using WebSockets
#30I too like to hardcode my AWS secret keys in my frontend application
I /have/ put other secrets into frontend code before, strictly for small temporary projects where the cost of implementing secret management outweighs the size of the project. And obviously not in code that was anywhere close to being deployed outside my own box.
Unfortunately the method outlined in the article allows access to environments that would otherwise be considered trusted and not-accessible over the internet, hence the problem