####################################################################### Luigi Auriemma Application: Scorched 3D http://www.scorched3d.co.uk Versions: <= 39.1 (bf) Platforms: Windows, Linux, MacOS, FreeBSD and Solaris Bugs: A] format string and buffer-overflow in addLine and SendString* B] server freeze through negative numplayers C] ComsMessageHandler buffer-overflow D] various crashes and possible code execution in Logger.cpp Exploitation: remote, versus server Date: 02 Nov 2005 Author: Luigi Auriemma e-mail: aluigi@autistici.org web: aluigi.org ####################################################################### 1) Introduction 2) Bugs 3) The Code 4) Fix ####################################################################### =============== 1) Introduction =============== Scorched 3D is a great and well known open source multiplayer game inspired to the old classic Scorched Earth. ####################################################################### ======= 2) Bugs ======= --------------------------------------------------------------- A] format string and buffer-overflow in addLine and SendString* --------------------------------------------------------------- The game is affected by many format string and buffer-overflow bugs which are "mainly" located in the GLConsole::addLine, all the ServerCommon::sendString* and ServerCommon::serverLog functions. All these functions use vsprintf with static buffers of various lengths (like 1024, 2048 and 10000) and some of them are called from instructions that pass the user's input (like messages or commands and values) directly as format argument opening the server also to format string attacks. -------------------------------------------- B] server freeze through negative numplayers -------------------------------------------- Scorched 3D clients use a strange field called numplayers used for creating a specific number of players in the server (although the client is only one). The problem is in the usage of a negative numplayers value which first bypasses the (signed) check used in the code and then freezes the server that enters in an almost endless loop located in ServerConnectHandler.cpp: for (unsigned int i=0; i