Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Socket.io Security Issues

I'm wondering how I could secure my socket.io connection to the server from th following.

Security Issues:

  • What would stop malicious users from connecting to the socket server via client side code?

Example:

OUTSIDE DOMAIN REQUEST var socket = io.connect('http://Mydomain', {port: 4000});
  • Users can seemingly create thousands of concurrent connections just by opening a different browser window.

How can I prevent these issues?

like image 290
Trevor Avatar asked Sep 16 '11 21:09

Trevor


People also ask

How do I secure a Socket.IO connection?

All you have to do is updating the remote session store on node server when a new login/logout happens in your php server. Show activity on this post. The excellent passport framework for express uses secure cookies to validate identity. There is even a module to access it from socket.io.

Are WebSockets vulnerable?

Some WebSockets security vulnerabilities arise when an attacker makes a cross-domain WebSocket connection from a web site that the attacker controls. This is known as a cross-site WebSocket hijacking attack, and it involves exploiting a cross-site request forgery (CSRF) vulnerability on a WebSocket handshake.

Does Socket.IO need authentication?

It is important to know that, by default, there is no authentication provided by Socket.io connections. Anyone can point a client at your server and start emitting and receiving events.

Is Socket.IO encrypted?

Now our communications are encrypted and logged user cannot read another ones data.


1 Answers

You should be able to check serverside that the HTTP referrer is correct. Check the socket.io spec for info on both http referring as well as handshaking.

https://github.com/socketio/socket.io-protocol

Also 0.8 has referrer verification. Havent used it before, but this may be a place to start looking:

https://github.com/LearnBoost/socket.io/pull/481

like image 58
wesbos Avatar answered Oct 03 '22 07:10

wesbos