Issues
The current RCON implementation for community servers is faulty and causes some usability issues for all community server hosts.
- RCON responses appear to be corrupt (at the beginning of the body), leading to lost information (especially with certain commands such as
listbans
). - RCON requests are occasionally met with the response spewing a lot of null bytes (
\x00
). - RCON connections leak threads on the server. If a client is used which creates one connection per command, multiple commands over time cause thread leaks that lead to unnecessary CPU consumption (and inevitable server death).
Test Steps
- Set up a community server with (passworded) RCON enabled.
- Roll your own RCON client implementation, since the likes of
mcrcon
andrcon-cli
will not parse/return the response given by the server (another hint that the implementation is faulty). Ensure that your implementation reuses the same connection so that you do not have issues with leaked threads. - Authenticate via the appropriate RCON port with the appropriate password.
- Send the
help
command over the established, authenticated session.
Expected Result
- All the
help
text observed in the server log shall be received in full by the client via the body of the RCON response:[2019.06.23-18.34.24:203][355]LogRcon: << help [2019.06.23-18.34.24:203][355]LogRcon: >> help [command substring] Displays a list of commands. listplayers Lists players currently connected to the server. kick <id/netid/name> [reason] Kicks a player from the server. permban <id/netid/name> [reason] Permanently bans a player from the server. travel <travel url> Transitions the server to a different level. ban <id/netid/name> [duration in minutes] [reason] Bans a player from the server. listbans Shows the ban list for the server. unban <netid> Lifts a ban for a user. say <message> Shows a message to all players in the chat box. restartround [0 = no team switch, 1 = swap teams] Restarts the current round. maps [level filter] Lists available maps. scenarios [level filter] Lists available scenarios. travelscenario <scenario> Change level to given scenario. gamemodeproperty <property> [new value] Gets or sets a gamemode property for the length of the scenario.
Observed Results
-
The following is the received via the body of the RCON response (logs my own):
2019/06/23 18:34:24.173 +0000 | DEBUG | send | Sending packet: "\x0E\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00help\x00\x00" 2019/06/23 18:34:24.173 +0000 | DEBUG | send_receive | Receiving response 2019/06/23 18:34:24.236 +0000 | DEBUG | send | Got response: "\xA5\x03\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\xF0\x03\x16\xE3\x01\x00\x00\x00\xF0\x85\xC5\x14\xEC\x7F\x00\x00ubstring]\n\t\tDisplays a list of commands.\n\tlistplayers \n\t\tLists players currently connected to the server.\n\tkick <id/netid/name> [reason]\n\t\tKicks a player from the server.\n\tpermban <id/netid/name> [reason]\n\t\tPermanently bans a player from the server.\n\ttravel <travel url>\n\t\tTransitions the server to a different level.\n\tban <id/netid/name> [duration in minutes] [reason]\n\t\tBans a player from the server.\n\tlistbans \n\t\tShows the ban list for the server.\n\tunban <netid>\n\t\tLifts a ban for a user.\n\tsay <message>\n\t\tShows a message to all players in the chat box.\n\trestartround [0 = no team switch, 1 = swap teams]\n\t\tRestarts the current round.\n\tmaps [level filter]\n\t\tLists available maps.\n\tscenarios [level filter]\n\t\tLists available scenarios.\n\ttravelscenario <scenario>\n\t\tChange level to given scenario.\n\tgamemodeproperty <property> [new value]\n\t\tGets or sets a gamemode property for the length of the scenario.\n\x00\x00" 2019/06/23 18:34:24.236 +0000 | WARN | utf8 | Failed to encode string as UTF-8: ubstring] Displays a list of commands. listplayers Lists players currently connected to the server. kick <id/netid/name> [reason] Kicks a player from the server. permban <id/netid/name> [reason] Permanently bans a player from the server. travel <travel url> Transitions the server to a different level. ban <id/netid/name> [duration in minutes] [reason] Bans a player from the server. listbans Shows the ban list for the server. unban <netid> Lifts a ban for a user. say <message> Shows a message to all players in the chat box. restartround [0 = no team switch, 1 = swap teams] Restarts the current round. maps [level filter] Lists available maps. scenarios [level filter] Lists available scenarios. travelscenario <scenario> Change level to given scenario. gamemodeproperty <property> [new value] Gets or sets a gamemode property for the length of the scenario.
If this received text is sent to Discord (for example), here's what that looks like (UTF-8 encoded, unknowns replaced):
As you can see, the beginning is corrupt and not visible. This poses a problem for commands such aslistbans
, where useful information at the beginning of the body is unable to be parsed/read. -
Sometimes the RCON response will be a long series of null bytes... Could this be a buffer issue?
2019/06/23 18:28:48.436 +0000 | DEBUG | send | Sending packet: "\x0E\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00help\x00\x00" 2019/06/23 18:28:48.436 +0000 | DEBUG | send_receive | Receiving response 2019/06/23 18:28:48.503 +0000 | DEBUG | send | Got response: "\xA5\x03\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
-
RCON connections are leaking threads on the server (one thread per connection; so connection reuse is vital for server stability with this faulty implementation). Demonstration
Conclusion
These issues have been present since beta, and I believe all server software is affected. If you need any further information or specific build testing, please reach out to me. We also have an unofficial community server hosts Discord where you can get in touch with a lot of server hosts about the issues we're facing.