Facepunch / webrcon

Game server rcon, using websockets
MIT License
124 stars 57 forks source link

Password security #23

Closed alexfriesen closed 4 years ago

alexfriesen commented 7 years ago

I would like to address a security vulnerability in the current system. At the moment you connect to the server by calling ws://<ip>:<port>/<plain-text-password>, In this case, using a plain text password makes it very easy to gain access to the password through tracing someone's connection. Therefore, I would like to suggest an alternative way to connect to the server.

As you already stated on the devblogs that webrcon is going to become the preferred rcon tool, this should be a secure solution.

The most effective way would be to use the wss:// protocol and to send the password in a message after establishing a connection. However. this would require every server to have a valid SSL certificate, which is really impractical.

Because of this, I'd suggest to connect to ws://<ip>:<port>/ and to use a handshake method. The server sends the client a salt in order for the client to be able to generate a hash of the password and to send it to the server.

Client        Server
connect message---->
<----------------salt
hashed password --->
<-------except/reject
rocinante-sys commented 4 years ago

@alexfriesen you can use nginx proxy to secure connection to your proxy and then internally the traffic is unencrypted between proxy and your rust server :)