From djb@cr.yp.to Wed Dec 15 14:23:43 2004 Date: 15 Dec 2004 08:35:50 -0000 From: D. J. Bernstein To: securesoftware@list.cr.yp.to, C.Walshaw@gre.ac.uk Subject: [remote] [control] abc2mtex 1.6.1 process_abc overflows key buffer Limin Wang, a student in my Fall 2004 UNIX Security Holes course, has discovered a remotely exploitable security hole in abc2mtex. I'm publishing this notice, but all the discovery credits should be assigned to Wang. You are at risk if you take an ABC file from an email message (or a web page or any other source that could be controlled by an attacker) and feed that document through abc2mtex. Whoever provides the ABC file then has complete control over your account: she can read and modify your files, watch the programs you're running, etc. The abc2mtex documentation does not tell users to avoid taking input from the network. Many web pages offer ABC files for public consumption. Proof of concept: On an x86 computer running FreeBSD 4.10, type mkdir abc2mtex cd abc2mtex wget ftp://ftp.funet.fi/pub/TeX/CTAN/support/abc2mtex/abc2mtex1.6.1.tar.gz gunzip < abc2mtex1.6.1.tar.gz | tar -xf - make to download and compile the abc2mtex program, version 1.6.1 (current). Then change your environment so that the total environment size, as reported by printenv|wc -c, is exactly 500; this particular proof-of-concept attack allows only a very small range of environment sizes. Then save the file 79.abc attached to this message, and type ./abc2mtex 79.abc with the unauthorized result that a file named EXPLOITED is created in the current directory. Here's the bug: In abc.c, process_abc() uses strcat() to copy data from entry->KEY into a 99-byte key[] array; entry->KEY is read by getsIn(), which allows up to 999 bytes of data. ---D. J. Bernstein, Associate Professor, Department of Mathematics, Statistics, and Computer Science, University of Illinois at Chicago [ Part 2, Text/PLAIN (charset: unknown-8bit) 12 lines. ] [ Unable to print this part. ]