I have been updating all my VMs to apply the fix for the bash bug (shellshock) for the past few hours. While performing this, it got me to think about the security on Urho3D, especially on the possibility of remote code execution. The bad news is, I do believe that inherently our networking code does have such loop hole to allow arbitrary code execution from a client to a server, and vice versa. I have also managed to create a proof of concept for that using networking sample 17_SceneReplication to execute arbitrary command. There are two things that make it possible:
- Remote event.
Although the documentation warns that for safety reason the allowed (incoming) remote event types must be first registered, the default behavior of the networking code does exactly the opposite for the sake of convenience. When none of the remote event types are registered then it implies nobody cares and it allows all remote events to be processed. - Console command event.
The console command is intended to be sent and handled locally ONLY, however, currently nothing stopping user to send that event type remotely. So, a client could easily just prepare any command string in the event data and even to choose whether to interpret the string by using command line shell or by one of the scripting subsystems, then send the console event to be executed on the remote server. The payload could potentially instruct the server to broadcast more harmful commands on other connected clients.
I think we should definitely do something about it. Reject all incoming remote event types when none are registered. Add an event type blacklist instance variable which lists out local event type that should never ever be processed as remote event. Anymore ideas on how to mitigate this?