|
|||||||||||
|
Multiple vulnerabilities in Doomsday 1.9.0-beta5.1
From: Luigi Auriemma <aluigi(at)autistici.org>
Date: Wed Aug 29 2007 - 17:39:48 EDT
#######################################################################
Luigi Auriemma
Application: Doomsday
http://www.doomsdayhq.com
http://www.dengine.net
http://sourceforge.net/projects/deng/
Versions: <= 1.9.0-beta5.1 and current SVN
Platforms: Windows, Linux and Mac
Bugs: A] D_NetPlayerEvent global buffer-overflow using PKT_CHAT
B] Msg_Write global buffer-overflow through PKT_CHAT
C] undelimited strcpy in PKT_CHAT
D] integer overflow in PKT_CHAT
E] static buffer-overflow in NetSv_ReadCommands
F] client format string through PSV_CONSOLE_TEXT
Exploitation: remote, versus servers or clients depending by the bug
Date: 29 Aug 2007
Author: Luigi Auriemma
e-mail: aluigi@autistici.org
web: aluigi.org
#######################################################################
1) Introduction
2) Bugs
3) The Code 4) Fix #######################################################################
Doomsday (aka deng) is an open source port of the original Doom code with tons of enhancements and addons which make it the most advanced port at the moment. ####################################################################### 2) Bugs
When a chat message is received, the server takes the incoming packet
and reads who sent it, its destination and naturally the entire message
which is copied in a heap buffer using the remaining size of the packet
for calculating the amount of data to allocate.
Then a strcpy() is performed for copying the message from the packet to
the new allocated buffer called msg.
This explanation is valid for the other three bugs below too since they are exploited all through this same set of instructions which are showed here: from sv_main.c: void Sv_HandlePacket(void)
...
// The first byte contains the sender.
msgfrom = Msg_ReadByte();
In the case of D_NetPlayerEvent we have the following global buffer overflow of msgBuff caused by a sprintf or strcpy depending by the number of players in the server.
Important note: although this is a global buffer-overflow, on the
Windows game server (not the dedicated one) is possible to control the
code flow since EIP takes the value sent by the attacker, and so could
be possible to execute malicious code.
from d_net.c:
char msgBuff[256];
...
...
B] Msg_Write global buffer-overflow through PKT_CHAT
The Msg_Write function used for filling the "send" buffer suffers of a global buffer-overflow too, in this case the target buffer is netBuffer which is 32768 bytes long. from net_msg.c: void Msg_Write(const void *src, int len) {
memcpy(netBuffer.cursor, src, len);
C] undelimited strcpy in PKT_CHAT
Although this specific bug has no reason of being exploited at the
moment due to the presence of the other more critical vulnerabilities I
want to report it for thoroughness.
D] integer overflow in PKT_CHAT As already said the size of the msg buffer is calculated through the size of the packet but without the proper checks. The result is that an attacker can send an incomplete PKT_CHAT packet which has a data length minor than 3 causing the attempt of allocating a too big amount of memory (for example 0xfffffffd, resulted by 0 - 3) which will fail and return a NULL msg buffer causing a crash during the copying performed by strcpy:
mask = Msg_ReadShort();
E] static buffer-overflow in NetSv_ReadCommands
A static buffer-overflow is located in the function which reads the commands sent by the clients allowing an attacker to fill the data buffer with more than the 30 max commands supported. from d_netsv.c:
void *NetSv_ReadCommands(byte *msg, uint size)
{
static byte data[2 + sizeof(ticcmd_t) * MAX_COMMANDS];
ticcmd_t *cmd;
memset(data, 0, sizeof(data)); // The first two bytes of the data contain the number of commands. *count = 0;
// The first command.
while(msg < end)
// One more command. // First the flags.
flags = *msg++;
if(flags & CMDF_FORWARDMOVE)
cmd->forwardMove = *msg++;
...
} F] client format string through PSV_CONSOLE_TEXT The clients are affected by a format string vulnerability exploitable during the handling of a PSV_CONSOLE_TEXT message. This attack can be exploited only through a malicious server to which the victim must connect. from cl_main.c: void Cl_GetPackets(void) ...
case PSV_CONSOLE_TEXT:
i = Msg_ReadLong();
Con_FPrintf(i, (char*)netBuffer.cursor);
break;
#######################################################################
3) The Code http://aluigi.org/poc/dumsdei.zip ####################################################################### 4) Fix
No fix.
#######################################################################
---
This archive was generated by hypermail 2.1.8 : Sun Oct 28 2007 - 06:13:53 EDT |
||||||||||
|
|||||||||||