// back

KPPP Privileged File Descriptor Leak Vulnerability

02.28.05

BACKGROUND

KPPP is a dialer and front end for pppd. It allows for interactive
script generation and network setup. More information is available at:

    http://docs.kde.org/en/3.3/kdenetwork/kppp/

DESCRIPTION

Local exploitation of a privileged file descriptor leak in KPPP can
allow attackers to hijack a system's domain name resolution function.

The vulnerability specifically exists due to kppp's failure to properly
close privileged file descriptors. Typically, KPPP is installed setuid
root and uses privilege separation to allow only certain functions of
the PPP dialer to execute with elevated privileges. Communication
between the privileged portion and non-privileged portion of kppp is
done over a domain socket which does not properly get closed.

A fix for a similar vulnerability was introduced to the kppp code base
in 1998 as can be seen below:

    // close file descriptors
    for (int fd = 3; fd < 20; fd++)
      close(fd);

This fix may be easily bypassed if an attacker opens 17 file descriptors
before executing kppp. The loop will execute, closing the previously
opened file descriptors and leave the remaining privileged file
descriptor used to talk to the privileged component of kppp open for
attackers. KPPP may be abused to gain read and write access to
/etc/hosts and /etc/resolv.conf, thus giving attackers complete control
over a system's domain resolution capabilities.

ANALYSIS

Exploitation allows local attackers to gain control over a system's
domain name resolution function. Exploitation is trivial and allows an
attacker to write to the two files typically providing the configuration
for domain name resolution. Modifications of /etc/resolv.conf will allow
the attacker to specify a malicious domain server which may return
arbitrary responses to domain name lookups. Modifications to /etc/hosts
will cause hostname resolution redirection without the need for an
external domain server. This class of attack can be used to aid in
phishing and social engineering attempts.

DETECTION

iDEFENSE has confirmed the existence of this vulnerability in KPPP
2.1.2. The vendor has confirmed that KPPP as included in KDE 3.1.5 and
prior are affected. KDE 3.2.x and newer are not affected.

Note that some Linux distributions which come with KPPP, such as Red
Hat Linux, use a wrapper for executing X11 applications that require
root privileges. This wrapper  safely closes all file descriptors in the
executed application.

WORKAROUND

As a workaround, temporarily remove the setuid bit from KPPP and
manually gain root privileges before executing KPPP:

chmod -s /usr/sbin/kppp

VENDOR RESPONSE

A vendor advisory for this issue is available at:

   http://www.kde.org/info/security/advisory-20050228-1.txt

A patch for KDE 3.1 is available from

   ftp://ftp.kde.org/pub/kde/security_patches :

   0e999df54963edd5f565b6d541f408d9  post-3.1.5-kdenetwork.diff

CVE INFORMATION

The Common Vulnerabilities and Exposures (CVE) project has assigned the
names CAN-2005-0205 to these issues. This is a candidate for inclusion
in the CVE list (http://cve.mitre.org), which standardizes names for
security problems.

DISCLOSURE TIMELINE

02/09/2005   Initial vendor notification
02/09/2005   Initial vendor response
02/28/2005   Coordinated public disclosure

CREDIT

The discoverer of this vulnerability wishes to remain anonymous.

Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp

Free tools, research and upcoming events
http://labs.idefense.com

LEGAL NOTICES

Copyright © 2005 Verisign, Inc.

Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email customerservice@idefense.com for permission.

Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.