From djb@cr.yp.to Wed Dec 15 14:23:52 2004
Date: 15 Dec 2004 08:37:03 -0000
From: D. J. Bernstein <djb@cr.yp.to>
To: securesoftware@list.cr.yp.to, bug-unrtf@gnu.org,
     obraun@informatik.unibw-muenchen.de, tuorfa@yahoo.com
Subject: [remote] [control] unrtf 0.19.3 process_font_table overflows name
    buffer

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

    [ Part 2, Application/RTF  409bytes. ]
    [ Unable to print this part. ]