Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 11:57

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: possible OpenOffice psprint heap overflow
PostPosted: 14 Apr 2008 20:38 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
I have lost a day (I don't have all this patience, one hour is already too much for me) without understanding how to load a damned custom pfb file so at the moment I don't know if this bug is really exploitable or not and in any case I don't want to lost other time on it.

From psprint/source/helper/helper.cxx in OpenOffice 2.4.0:

Code:
bool psp::convertPfbToPfa( ::osl::File& rInFile, ::osl::File& rOutFile )
{
...
    while( bSuccess && ! bEof )
    {
        // read leading bytes
        bEof = ! rInFile.read( buffer, 6, nRead ) && nRead == 6 ? false : true;
        unsigned int nType = buffer[ 1 ];
        unsigned int nBytesToRead = buffer[2] | buffer[3] << 8 | buffer[4] << 16 | buffer[5] << 24;
        if( buffer[0] != 0x80 ) // test for pfb m_agic number
    ...
        else if( nType == 1 || nType == 2 )
        {
            unsigned char* pBuffer = new unsigned char[ nBytesToRead+1 ];

            if( ! rInFile.read( pBuffer, nBytesToRead, nRead ) && nRead == nBytesToRead )


psprint is a function for printing on Unix (so Windows doesn't use it), where the input file is first converted to PS (postscript) and then printed in some way.
If nBytesToRead is equal to 0xffffffff will be allocated 0 bytes of memory but the program will read max 0xffffffff bytes of data overflowing the allocated buffer.

In attachment there is a formatted pfb file which should test the bug, if it can be exploited naturally.

So I repeat that is possible that this part of the code cannot be reached or other things and so the bug for the moment exists only in theory.
As usual: no proof = no bug


Attachments:
oohof.zip [227 Bytes]
Downloaded 218 times
Top
 Profile  
 
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: