|
#######################################################################
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(int len) {
if (len + ulen > DATA_BUF_SIZE) {
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(int *size, bool *special) {
...
NLulong msgid;
NLshort msgsize;
for (i=0; i