Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 74480 - app-text/unrtf-0.19.3: process_font_table overflows name buffer
Summary: app-text/unrtf-0.19.3: process_font_table overflows name buffer
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All All
: High normal
Assignee: Gentoo Security
URL:
Whiteboard: B2 [glsa] koon
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-15 05:25 UTC by Sascha Silbe
Modified: 2007-06-24 23:32 UTC (History)
1 user (show)

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


Attachments
81.rtf from advisory (bug74480-81.rtf,298 bytes, application/rtf)
2004-12-15 05:26 UTC, Sascha Silbe
no flags Details
unrtf-final.patch (unrtf-final.patch,906 bytes, patch)
2004-12-30 07:03 UTC, Thierry Carrez (RETIRED)
no flags Details | Diff
unrtf-final.patch (unrtf-final.patch,400 bytes, patch)
2004-12-30 07:08 UTC, Thierry Carrez (RETIRED)
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sascha Silbe 2004-12-15 05:25:54 UTC
Advisory from securesoftware@list.cr.yp.to:

Date: 15 Dec 2004 08:37:03 -0000
From: "D. J. Bernstein" <djb@cr.yp.to>
Subject: [remote] [control] unrtf 0.19.3 process_font_table overflows name buffer
To: securesoftware@list.cr.yp.to, bug-unrtf@gnu.org,
        obraun@informatik.unibw-muenchen.de, tuorfa@yahoo.com
X-HELOcheck: OK: FQDN
Mailing-List: contact securesoftware-help@list.cr.yp.to; run by ezmlm
Mail-Followup-To: securesoftware@list.cr.yp.to, bug-unrtf@gnu.org,
        obraun@informatik.unibw-muenchen.de, tuorfa@yahoo.com
Automatic-Legal-Notices: See http://cr.yp.to/mailcopyright.html.

[-- Attachment #1 [details] --]
[-- Type: text/plain, Encoding: 7bit, Size: 1.5K --]

Yosef Klein and Limin Wang, two students in my Fall 2004 UNIX Security
Holes course, have discovered a remotely exploitable security hole in
unrtf. I'm publishing this notice, but all the discovery credits should
be assigned to Klein and Wang.

You are at risk if you take an RTF document from an email message (or a
web page or any other source that could be controlled by an attacker)
and feed it through unrtf. (The unrtf documentation does not tell users
to avoid taking input from the network.) Whoever provides that document
then has complete control over your account: he or she can read and
modify your files, watch the programs you're running, etc.

Proof of concept: On an x86 computer running FreeBSD 4.10, type

   wget http://www.gnu.org/software/unrtf/unrtf-0.19.3.tar.gz
   gunzip < unrtf-0.19.3.tar.gz | tar -xf -
   cd unrtf-0.19.3
   make

to download and compile the unrtf program, version 0.19.3 (current).
Then save the file 81.rtf attached to this message, and type

   ./unrtf 81.rtf

with the unauthorized result that a file named EXPLOITED is created in
the current directory. (I tested this with a 548-byte environment, as
reported by printenv | wc -c; beware that 81.rtf is particularly
sensitive to the environment size.)

Here's the bug: In convert.c, process_font_table() uses an unprotected
strcat() to copy any number of bytes into a 255-byte name array.

---D. J. Bernstein, Associate Professor, Department of Mathematics,
Statistics, and Computer Science, University of Illinois at Chicago
Comment 1 Sascha Silbe 2004-12-15 05:26:35 UTC
Created attachment 46032 [details]
81.rtf from advisory
Comment 2 Matthias Geerdsen (RETIRED) gentoo-dev 2004-12-15 05:54:49 UTC
robbat2/aliz: you have committed ebuilds for this before... pls verify and advise
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2004-12-15 06:13:37 UTC
Strange the DJB didn't attach a fix as well.

Funnily enough that corrupt file is caught by Windows, but it does affect unrtf on linux.
Comment 4 Thierry Carrez (RETIRED) gentoo-dev 2004-12-21 07:03:21 UTC
======================================================
Candidate: CAN-2004-1297
URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2004-1297
Reference: MISC:http://tigger.uic.edu/~jlongs2/holes/unrtf.txt

Buffer overflow in the process_font_table function in convert.c for
unrtf 0.19.3 allows remote attackers to execute arbitrary code via a
crafted RTF file.
======================================================
Comment 5 Thierry Carrez (RETIRED) gentoo-dev 2004-12-30 07:03:09 UTC
Created attachment 47210 [details, diff]
unrtf-final.patch

Patch from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=287038
Comment 6 Thierry Carrez (RETIRED) gentoo-dev 2004-12-30 07:08:48 UTC
Created attachment 47211 [details, diff]
unrtf-final.patch

Clean unrtf-final.patch
Comment 7 Thierry Carrez (RETIRED) gentoo-dev 2004-12-30 07:09:35 UTC
No metadata...
aliz/robbat2: please bump with patch.
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-01-07 03:34:21 UTC
-r1 in CVS now, ready for amd64 ppc s390 to stabilze.
It's marked stable for x86 already.
Comment 9 Thierry Carrez (RETIRED) gentoo-dev 2005-01-07 04:50:13 UTC
ppc, s390: please test 0.19.3-r1 and mark stable
Comment 10 Lars Weiler (RETIRED) gentoo-dev 2005-01-08 11:47:43 UTC
stable on ppc.
Comment 11 Dan Margolis (RETIRED) gentoo-dev 2005-01-10 11:47:19 UTC
glsa 200501-15