Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 234093 (CVE-2008-3282) - app-office/openoffice Numeric truncation error in memory allocator on 64bit (CVE-2008-3282)
Summary: app-office/openoffice Numeric truncation error in memory allocator on 64bit (...
Status: RESOLVED INVALID
Alias: CVE-2008-3282
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Security
URL: http://www.openoffice.org/issues/show...
Whiteboard: A2? [ebuild]
Keywords:
: 236083 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-06 15:24 UTC by Robert Buchholz (RETIRED)
Modified: 2008-08-29 11:53 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Buchholz (RETIRED) gentoo-dev 2008-08-06 15:24:13 UTC
** Please note that this issue is SEMI-PUBLIC and no additional information should be disclosed until it is made public, see "Whiteboard" for a date **

Tomas Hoger of the Red Hat Security Response Team reported:
It was discovered, that OpenOffice.org memory allocator is not 64bit clean.
rtl_allocateMemory() function in sal/rtl/source/alloc_global.c accepts one
argument - sal_Size n.  On 64bit platforms such as x86_64, sal_Size is defined
as unsigned long int.  This requested memory chunk size is later memory aligned
as size (type sal_Size).  size is later used to calculate int index to
g_alloc_table[] array:

  int index = (size - 1) >> RTL_MEMALIGN_SHIFT;

However, as sizeof(int) == 4 and sizeof(sal_Size) == 8 on 64bit platforms, the
calculated value may not fit into index (this can happen when
rtl_allocateMemory() is called with large argument, e.g. when some other flaw
causes OpenOffice to attempt to allocate chunk of memory with negative size,
which wraps to large positive value during signed -> unsigned type conversion,
such as [1]).  Value stored in the index is wrapped / truncated, possibly
resulting in the index being negative.

Before index is used, it is checked not to exceed fixed upper limit, but it's
not checked whether its value is >= 0:

  if (index < RTL_MEMORY_CACHED_LIMIT >> RTL_MEMALIGN_SHIFT)

Negative index used in g_alloc_table[index] will cause OpenOffice to access
memory outside of the g_alloc_table[] array.  This may result it crash, or if
that points to an attacker controlled memory, attacker may possibly be able to
use this flaw to run arbitrary code.

[1] http://www.openoffice.org/issues/show_bug.cgi?id=91818
    http://scary.beasts.org/security/CESA-2008-006.html
Comment 1 Robert Buchholz (RETIRED) gentoo-dev 2008-08-06 15:38:27 UTC
As mentioned, this issue only affects 64bit builds, and therefore only openoffice (not -bin), and only amd64.

Andreas, since the patch is public, please commit a revbump including the it in our patchset with an innocent ChangeLog (like your last one).
Comment 2 Andreas Proschofsky (RETIRED) gentoo-dev 2008-08-07 14:20:52 UTC
As far as I understand this is only a problem in Suns own memory allocator. Fortunately we are NOT using this anymore in our own OOo builds since March of this year (pre 2.4.1), but rely on the system memory allocator instead. So actually there shouldn't be any action required on our side, as this bug doesn't affect us. Citing a mail from the Debian maintainer on the OOo security list in response to Red Hats planned security advisory:

"Please mention that many distros are also not affected because they
don't use the custom allocatiors implemented by Sun but malloc() as they
should (--with-alloc=system to configure)"

Which actually is exactly what we do.
Comment 3 Robert Buchholz (RETIRED) gentoo-dev 2008-08-07 20:52:40 UTC
Great, thank you for the analysis. I'll close this INVALID and leave it closed until the due date.
Comment 4 Andreas Proschofsky (RETIRED) gentoo-dev 2008-08-29 06:19:01 UTC
*** Bug 236083 has been marked as a duplicate of this bug. ***