Public Vulnerability Reports

SquirrelMail S/MIME Plugin Command Injection Vulnerability



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:


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.


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.


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


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);


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


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


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


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


Karol Wiesek is credited with this discovery.

Get paid for vulnerability research


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 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.