[Full-disclosure] Multiple vulnerabilities in Outgun 1.0.3 bot 2

Type securityvulns
Reporter Securityvulns
Modified 2006-05-13T00:00:00


                         Luigi Auriemma

Application: Outgun http://koti.mbnet.fi/outgun/ Versions: <= 1.0.3 bot 2 Platforms: Windows, nix, BSD and more Bugs: A] data_file_request buffer-overflow B] exception with big data C] invalid memory access in messages handling D] harmless buffer-overflow on a global variable in changeRegistration Exploitation: remote, versus server Date: 12 May 2006 Author: Luigi Auriemma e-mail: aluigi@autistici.org web: aluigi.org

1) Introduction 2) Bugs 3) The Code 4) Fix

=============== 1) Introduction ===============

Outgun is an open source 2D capture-the-flag game with multiplayer support for LAN and Internet through a centralized master server.

======= 2) Bugs =======

A] data_file_request command buffer-overflow

The game supports the downloading of map files directly from the server in which the clients want to play. The request for the downloading of the map is composed by the command data_file_request and two text strings for the type and name of the requested file. The buffers in which the server stores these two strings have a size of 64 and 256 bytes and the function readString doesn't check the length of the destination buffer during the copying.

>From src/servnet.cpp:

void ServerNetworking::incoming_client_data(int id, char *data, int length) { ... else if (code == data_file_request) { char ftype[64]; char fname[256]; readString(msg, count, ftype); readString(msg, count, fname); ...

B] exception with big data

The leetnet functions used in the game for handling the packets automatically raise an exception (throw) if a data bigger than 512 (DATA_BUF_SIZE) bytes is received. The effect is the immediate interruption of the game.

>From src/leetnet/rudp.cpp:

class data_ci : public data_c { public:

//allocated length, used length
int alen, ulen;

//data buffer
char buf[DATA_BUF_SIZE];

//extend buffer to fit additional len
void extend&#40;int len&#41; {
    if &#40;len + ulen &gt; DATA_BUF_SIZE&#41; {
        throw 66677;

C] invalid memory access in messages handling

The leetnet functions support a maximum amount of 64 messages in each incoming packet but no checks are made for avoiding the reading of the unallocated memory after the packet if an attacker uses wrong message sizes.

>From src/leetnet/rudp.cpp:

virtual char* process_incoming_packet&#40;int *size, bool *special&#41; {
    NLulong msgid;
    NLshort msgsize;
    for &#40;i=0; i&lt;nreliable; i++&#41; {       // read all reliable msgs
        readLong&#40;udp_data, count, msgid&#41;;       //id
        readShort&#40;udp_data, count, msgsize&#41;;    //size

        //if &#40;debug&#41; printf&#40;&quot;&#40;&#37;i,&#37;i&#41;&quot;, msgid, msgsize&#41;;

        // station will process the incoming reliable message
        process_incoming_message&#40;msgid, &#40;udp_data + count&#41;, msgsize&#41;;

        //advance count since we didn&#39;t &quot;readBlock&quot;
        count += msgsize;

        //p-&gt;add_reliable&#40;msgid, &#40;udp_data + count&#41;, msgsize&#41;;  //data

D] harmless buffer-overflow on a global variable in changeRegistration

changeRegistration is the function for handling the changing of the registration informations of the clients. This function uses strcpy for copying the client's token in a buffer of 64 bytes located in the global array of the clients informations. During my tests (limited by the problem described in bug B) was not possible to exploit this bug for crashing the server but I was only able to modify some of the informations of the other players in the server.

>From src/servernet.cpp:

bool Server::changeRegistration(int id, const string& token) { const int intoken = atoi(token.c_str()); if (intoken == client[id].intoken) return false;

// v0.4.9 FIX : IF HAD previous token have/valid, then FLUSH his stats

strcpy&#40;client[id].token, token.c_str&#40;&#41;&#41;;

=========== 3) The Code ===========


====== 4) Fix ======

Some of the bugs will be fixed in the next "bot" release.

Luigi Auriemma http://aluigi.org http://mirror.aluigi.org

Full-Disclosure - We believe in it. Charter: http://lists.grok.org.uk/full-disclosure-charter.html Hosted and sponsored by Secunia - http://secunia.com/