Security in OpenSim

There are, confusingly, working options for using secure connections to OpenSim but these are related to remote admin and other web interfaces, not to the more fundamental issue of securely logging into the simulator in the first place. (I will avoid the usual misuse of the term “SSL” here, since this has long ago been obsoleted by the more modern TLS, but in practice these terms are used interchangeably.)

OpenSim logins are done over an insecure HTTP-only connection. There is no reason that they could not be done over a secure connection but the code has not been written made functional. It would be quite a simple job. Grid administrators would need TLS (“SSL”) certificates in the same way as they mostly also use for the front-end web sites representing their grid online or whatever else they run securely on their server. It’s not a big deal to do.

The viewer sends an MD5 hash of the password, not the clear-text password, to the server. This, however, is not secure. The reason that MD5 is still used rather than changing to the much more secure SHA2 is that the entire password table for a every OpenSim grid would have to be changed. I wonder if the table could be modified by adding a column noting whether MD5 were used or, if available, the password had been migrated to SHA2? This however, would need coordination between viewer developers and OpenSim core developers, as the viewer would need to transmit the information to OpenSim grids. In practice, this is unlikely to happen. It would also require front-end software i.e. web GUIs to be changed.

Admittedly, MD5 uses salt so that rainbow tables can’t be used, but MD5 is still susceptible to collision attacks and passwords can be sniffed and recovered trivially in a matter of seconds. What other server technology, other than OpenSim, transmits MD5 hashed passwords in clear text? Answer: nobody! It’s not at all safe and HTTPS is a basic requirement for all server platforms. If this was in place, the MD5 hash would be transmitted using strong encryption anyway, so it wouldn’t matter any more that we were still using MD5 internally because only the sender and the server would see it. Ok, SHA2 would be ideal but there we are – at least things would be basically secure.

Here is the config section in OpenSim.ini that you need to look at:

; ssl config: Experimental! The auto https config only really works definately on windows XP now
; you need a Cert Request/Signed pair installed in the MY store with the CN specified below
; you can use https on other platforms, but you'll need to configure the httpapi yourself for now
http_listener_ssl = false ; Also create a SSL server
http_listener_cn = "localhost" ; Use the cert with the common name
http_listener_sslport = 9001 ; Use this port for SSL connections
http_listener_ssl_cert = "" ; Currently unused, but will be used for OSHttpServer

; HTTPS for "Out of band" management applications such as the remote
; admin module
; Create https_listener = "True" will create a listener on the port
; specified. Provide the path to your server certificate along with it's
; password
; https_listener = False
; Set our listener to this port
; https_port = 0
; Path to X509 certificate
; cert_path = "path/to/cert.p12"
; Password for cert
; cert_pass = "password"

The confusion here is that there are two separate “SSL” configurations here. One is for “out of band” connections like web interfaces and remote admin, i.e. https_listener, which comes second here. This does work (also see Robust{.HG}.ini etc). But it’s the first, http_listener_ssl, that is relevant here. This does not work. It’s for a code stub that hasn’t been completed and, if you try to use it, the region will never start successfully. The code in question is: [INSTALL_FOLDER]/opensim/OpenSim/Server/Base/HttpServerBase.cs

What is needed is for this code to be completed. It also needs the addition of an option to force logins over secure HTTP connections, as the existing options would only add HTTPS logins rather than replace them over HTTP if it worked as intended. For security, you need to actually prevent people from sending passwords in clear text only, i.e. by adding force_https_login = true in order to redirect all login requests to HTTPS, not simply enable optional HTTPS for the login URI. It might be worth also having a setting for force_http_traffic = false as default but allowing a setting of force_https_traffic = true for better security where sufficiently fast connections allow all traffic to be sent over HTTPS  – this would obviously affect only HTTP(S) and not UDP traffic to and from the viewer. Note that Second Life™ does use HTTPS for its login URI, and this has been true for many years. What is stopping OpenSim from developing this very simple, industry-standard security?

Editor’s note 2014-12-30: despite Melanie’s comment “… one really should not trust grids that don’t offer a https:// loginuri”, the only grids currently appearing to offer such URIs are Second Life™ (and test grids) and Avination. These have the wherewithal to develop and deploy solutions beyond what is available in the current OpenSim release code. While Melanie’s position is ideal, it is also currently impossible, either because the code simply doesn’t work or else because how to deploy it is undocumented and obscure to the point that nobody does it in practice. It seems likely that the former is true, given that the present writer and no doubt many other grid administrators have tried and failed to make it work. I also doubt Melanie’s assertion (from 2012) that MD5 is sufficiently difficult to break in practice: by 2014, it appears now to be trivial to crack MD5 hashes – corrections welcome from anybody with greater expertise in encryption hashes etc.