Full Disclosure mailing list archives

Buffer-overflow in WinUAE 1.4.4


From: Luigi Auriemma <aluigi () autistici org>
Date: Fri, 21 Dec 2007 20:00:52 +0100


#######################################################################

                             Luigi Auriemma

Application:  WinUAE
              http://www.winuae.net
Versions:     <= 1.4.4
Platforms:    Windows
Bug:          buffer-overflow
Exploitation: local
Date:         21 Dec 2007
Author:       Luigi Auriemma
              e-mail: aluigi () autistici org
              web:    aluigi.org


#######################################################################


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


#######################################################################

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


WinUAE is the most known and used Amiga emulator for Windows.

A note about this advisory:
UAE (and consequently WinUAE) is affected by some design bugs which
introduce other security problems (as pointed by the same developer)
so I focused only on the following non-design security bug.


#######################################################################

======
2) Bug
======


WinUAE supports various types of compressed floppy disk images.
Gzip compression (images with gz, adz, roz and hdz extensions) is
handled by an internal function called zfile_gunzip in which is used a
stack buffer of 1000 (MAX_DPATH) bytes for including the name of the
file available in the gzipped archive.
The instructions which copy the name from the archive to the buffer
don't check it's length allowing an attacker to exploit the subsequent
buffer-overflow for executing malicious code.

From zfile.c:

struct zfile *zfile_gunzip (struct zfile *z)
{
    uae_u8 header[2 + 1 + 1 + 4 + 1 + 1];
    z_stream zs;
    int i, size, ret, first;
    uae_u8 flags;
    long offset;
    char name[MAX_DPATH];
    uae_u8 buffer[8192];
    ...
    do {
        zfile_fread (name + i, 1, 1, z);
    } while (name[i++]);
    ...


#######################################################################

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


http://aluigi.org/poc/winuaebof.zip


#######################################################################

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


Version 1.4.5


#######################################################################


--- 
Luigi Auriemma
http://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/


Current thread: