[VulnWatch] High Risk Vulnerability in the OpenOffice and StarOffice Suites

John Heasman of NGSSoftware has discovered several high risk vulnerabilities
in the handling of WMF and EMF graphics formats within the OpenOffice
StarOffice suite.

The vulnerabilities, three heap overflows, affect OpenOffice 2.1.0 and
StarOffice 6, 7 and 8. If an attacker can coax a user into opening a
specially crafted document then the attacker can execute arbitrary code in
the security context of their victim.

1) From svtools\source\filter.vcl\wmf\winwmf.cxx

sal_uInt32 i, nStringLen, nDXCount;
aMemoryStream >> aPt.X()
>> aPt.Y()
>> nStringLen;

sal_Unicode* pBuf = aString.AllocBuffer( (sal_uInt16)nStringLen );
for ( i = 0; i < nStringLen; i++ )
aMemoryStream >> pBuf[ i ];

nStringLen is a sal_uInt32; it is cast to a sal_uInt16 for the allocation
then the original 32 bit value is used as a count to fill the buffer, thus
any length greater than 0xFFFF results in a heap overflow. Code execution is
possible via a function pointer overwrite or arbitrary DWORD overwrite if
the user opens a malicious WMF, or a container document (such as a Microsoft
Word document) in which it is embedded.

2) From svtools\source\filter.vcl\wmf\enhwmf.cxx


INT32 i, nPoly, nGesPoints;
*pWMF >> nPoly >> nGesPoints;
pPtAry = (Point*) new char[ nGesPoints * sizeof(Point) ];

for ( i = 0; i < nGesPoints; i++ )
*pWMF >> nX32 >> nY32;
pPtAry[ i ] = Point( nX32, nY32 );

nGesPoints * sizeof(Point) will result in an integer wrap if nGesPoints is >
(0x100000000 / sizeof(Point)).

Code execution is possible via a function pointer overwrite.

3) As above but for EMR_POLYPOLYGON16 record.


These issues have now been resolved; OpenOffice and StarOffice users are
strongly recommended to install the relevant patch, available from the
OpenOffice and SunSolve websites:


NGSSoftware Insight Security Research
+44(0)208 401 0070


The information contained in this email and any subsequent
correspondence is private, is solely for the intended recipient(s) and
may contain confidential or privileged information. For those other than
the intended recipient(s), any disclosure, copying, distribution, or any
other action taken, or omitted to be taken, in reliance on such
information is prohibited and may be unlawful. If you are not the
intended recipient and have received this message in error, please
inform the sender and delete this mail and any attachments.

The views expressed in this email do not necessarily reflect NGS policy.
NGS accepts no liability or responsibility for any onward transmission
or use of emails and attachments having left the NGS domain.

NGS and NGSSoftware are trading names of Next Generation Security
Software Ltd. Registered office address: 52 Throwley Way, Sutton, SM1
4BF with Company Number 04225835 and VAT Number 783096402