


Let’s take a moment to discuss how methods or member functions, are called in C++ in a very abstract way, after all, write is a virtual method of demorecord.Ī method is a function like any other, with the small caveat that it needs to be able to reference the object’s members as well. Well, easy peasy, let’s just call system and our text message is already passed as an argument to the function, so that’s it, we can run commands on the server’s host, right? You guessed it, of course not. Hold on…Is the address of system completely printable? _ZTVN10_cxxabiv120_si_class_type_infoE: H]D That’s why I couldn’t just call functions within the executable itself. Note that I had to limit the search to GOT functions because I needed a memory address that holds a pointer to a function, exactly like the vtable behaves. In order to deal with that, I wrote a script that returns all the GOT functions whose pointers are completely printable. This is pretty problematic because it drastically reduces the leverage of this attack, in effect, allowing us to only pass printable pointers. Let’s rewind into the limitations for a second.īecause of the call to filtertext here, it is not possible to send a message with unprintable characters, and the size of the message is limited to 260 bytes. So, we can both control the function that is called, and even choose an argument to pass it! Neato’.ĭemorecord itself is initialized only once at the start of the game and is of type gzstream : stream I quickly noticed that reading data from the client is done using functions like getstring and getint, etc.Įnum So I started going over the various updates that can be sent from the client, for instance, sending a text message or the player’s position on the map. This is the function that, according to the developers, does “server-side processing of updates”.

Pretty quickly I came across the process function at server.cpp.
#Could not connect to assaultcube server code
Right from the beginning I was looking for the code that takes input from the client and looked for ways to meddle with it, essentially providing unexpected data to the server. So I opened up the game’s code and started to get familiar with the codebase. There’s also the possibilities of client → client, or server → client, but they both tend to be easier as the client is usually written in a more trustful manner.Įscalating to admin, crashing the server, or writing some hacks (which I did by the way) were not what I was looking for. The goal was clear and straightforward, achieving Remote Code Execution Client → Server. The game is open-source and is still very active with quite a lot of players and servers still running, so I thought “that might be an interesting target”. I decided to go with a game called AssaultCube. So I’ve been doing quite a lot of Wargames & CTFs and I was looking to research a “real” production application.
