[VulnWatch] iDEFENSE Security Advisory 02.07.05: SquirrelMail S/MIME Plugin Command Injection Vulnerability

From: iDefense Customer Service (customerservice_at_idefense.com)
Date: 02/07/05

  • Next message: iDefense Customer Service: "[VulnWatch] iDEFENSE Security Advisory 02.07.05: IBM AIX chdev Local Format String Vulnerability"
    Date: Mon, 7 Feb 2005 15:03:01 -0500
    To: <bugtraq@securityfocus.com>, <vulnwatch@vulnwatch.org>
    
    

    SquirrelMail S/MIME Plugin Command Injection Vulnerability

    iDEFENSE Security Advisory 02.07.05
    www.idefense.com/application/poi/display?id=191&type=vulnerabilities
    February 07, 2005

    I. BACKGROUND

    Squirrelmail S/MIME plugin enables the viewing of S/MIME-signed messages
    of the MIME "multipart/signed" format. More information about the plugin
    is available at:

        http://www.squirrelmail.org/plugin_view.php?id=54

    II. DESCRIPTION

    Remote exploitation of a command injection vulnerability in the
    Squirrelmail S/MIME plugin allows web mail users to execute arbitrary
    commands with the privileges of the web server.

    The problem specifically exists due to insufficient filtering of
    user-provided data in a call to exec(). The following snippet exposes
    the offending area of code from viewcert.php:

        if(!isset($cert)) $cert=$_GET['cert'];
        ...
        function x509_open($cert) {
            global $cert_in_dir, $openssl;
            $lines = array();
            exec("$openssl x509 -in $cert_in_dir$cert -subject -issuer \
                -dates -serial -fingerprint -noout 2>/tmp/err", $lines);
        ...
        list ($ow, $is, $nb, $na, $sn, $fp) = x509_open($cert);

    The variable '$cert' from the above snippet contains unfiltered user
    supplied data and can be exploited.

    III. ANALYSIS

    Successful exploitation allows authenticated web mail users to execute
    arbitrary commands on the underlying system with the privileges of the
    web server. This can lead to further compromise and exposure of other
    users' mail to the attacker.

    IV. DETECTION

    iDEFENSE has confirmed the existence of this vulnerability in S/MIME
    plugin 0.5 and 0.4. Earlier versions are also suspected to be
    vulnerable.

    V. WORKAROUND

    PHP provides the escapeshellarg() routine to filter data to be used as
    an argument to calls such as exec() and system(). Modify the call to
    exec() from:

        exec("$openssl x509 -in $cert_in_dir$cert -subject -issuer -dates \
            -serial -fingerprint -noout 2>/tmp/err", $lines);

    To:

        $filtered = escapeshellarg("$cert_in_dir$cert");
        exec("$openssl x509 -in $filtered -subject -issuer -dates -serial \
            -fingerprint -noout 2>/tmp/err", $lines);

    VI. VENDOR RESPONSE

    The vendor has released S/MIME plugin 0.6 to address this vulnerability.
    The plugin is available for download at:

       http://www.squirrelmail.org/plugin_view.php?id=54

    VII. CVE INFORMATION

    A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
    been assigned yet.

    VIII. DISCLOSURE TIMELINE

    09/22/2004 Initial vendor notification
    09/22/2004 Initial vendor response
    02/07/2005 Coordinated public disclosure

    IX. CREDIT

    Karol Wiesek is credited with this discovery.

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

    X. LEGAL NOTICES

    Copyright (c) 2005 iDEFENSE, 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.


  • Next message: iDefense Customer Service: "[VulnWatch] iDEFENSE Security Advisory 02.07.05: IBM AIX chdev Local Format String Vulnerability"

    Relevant Pages