Vulnerabilities > CVE-2006-4169 - Remote Command Execution vulnerability in SquirrelMail G/PGP Encryption Plug-in

047910
CVSS 5.5 - MEDIUM
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
SINGLE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
NONE
network
low complexity
squirrelmail
nessus

Summary

Multiple directory traversal vulnerabilities in the G/PGP (GPG) Plugin 2.0, and 2.1dev before 20070614, for Squirrelmail allow remote authenticated users to include and execute arbitrary local files via a .. (dot dot) in the help parameter to (1) gpg_help.php or (2) gpg_help_base.php. The vendor has addressed this issue in the following product update: http://www.squirrelmail.org/plugin_download.php?id=153&rev=1303

Vulnerable Configurations

Part Description Count
Application
Squirrelmail
2

Nessus

NASL familyGentoo Local Security Checks
NASL idGENTOO_GLSA-200708-08.NASL
descriptionThe remote host is affected by the vulnerability described in GLSA-200708-08 (SquirrelMail G/PGP plugin: Arbitrary code execution) The functions deletekey(), gpg_check_sign_pgp_mime() and gpg_recv_key() used in the SquirrelMail G/PGP encryption plugin do not properly escape user-supplied data. Impact : An authenticated user could use the plugin to execute arbitrary code on the server, or a remote attacker could send a specially crafted e-mail to a SquirrelMail user, possibly leading to the execution of arbitrary code with the privileges of the user running the underlying web server. Note that the G/PGP plugin is disabled by default. Workaround : Enter the SquirrelMail configuration directory (/usr/share/webapps/squirrelmail/version/htdocs/config), then execute the conf.pl script. Select the plugins menu, then select the gpg plugin item number in the
last seen2020-06-01
modified2020-06-02
plugin id25873
published2007-08-13
reporterThis script is Copyright (C) 2007-2019 Tenable Network Security, Inc.
sourcehttps://www.tenable.com/plugins/nessus/25873
titleGLSA-200708-08 : SquirrelMail G/PGP plugin: Arbitrary code execution
code
#%NASL_MIN_LEVEL 80502
#
# (C) Tenable Network Security, Inc.
#
# The descriptive text and package checks in this plugin were
# extracted from Gentoo Linux Security Advisory GLSA 200708-08.
#
# The advisory text is Copyright (C) 2001-2015 Gentoo Foundation, Inc.
# and licensed under the Creative Commons - Attribution / Share Alike 
# license. See http://creativecommons.org/licenses/by-sa/3.0/
#

include("compat.inc");

if (description)
{
  script_id(25873);
  script_version("1.13");
  script_cvs_date("Date: 2019/08/02 13:32:44");

  script_cve_id("CVE-2005-1924", "CVE-2006-4169");
  script_xref(name:"GLSA", value:"200708-08");

  script_name(english:"GLSA-200708-08 : SquirrelMail G/PGP plugin: Arbitrary code execution");
  script_summary(english:"Checks for updated package(s) in /var/db/pkg");

  script_set_attribute(
    attribute:"synopsis", 
    value:
"The remote Gentoo host is missing one or more security-related
patches."
  );
  script_set_attribute(
    attribute:"description", 
    value:
"The remote host is affected by the vulnerability described in GLSA-200708-08
(SquirrelMail G/PGP plugin: Arbitrary code execution)

    The functions deletekey(), gpg_check_sign_pgp_mime() and gpg_recv_key()
    used in the SquirrelMail G/PGP encryption plugin do not properly escape
    user-supplied data.
  
Impact :

    An authenticated user could use the plugin to execute arbitrary code on
    the server, or a remote attacker could send a specially crafted e-mail
    to a SquirrelMail user, possibly leading to the execution of arbitrary
    code with the privileges of the user running the underlying web server.
    Note that the G/PGP plugin is disabled by default.
  
Workaround :

    Enter the SquirrelMail configuration directory
    (/usr/share/webapps/squirrelmail/version/htdocs/config), then execute
    the conf.pl script. Select the plugins menu, then select the gpg plugin
    item number in the 'Installed Plugins' list to disable it. Press S to
    save your changes, then Q to quit."
  );
  script_set_attribute(
    attribute:"see_also",
    value:"https://security.gentoo.org/glsa/200708-08"
  );
  script_set_attribute(
    attribute:"solution", 
    value:
"All SquirrelMail users should upgrade to the latest version:
    # emerge --sync
    # emerge --ask --oneshot --verbose '>=mail-client/squirrelmail-1.4.10a-r2'"
  );
  script_set_cvss_base_vector("CVSS2#AV:N/AC:M/Au:N/C:C/I:C/A:C");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"p-cpe:/a:gentoo:linux:squirrelmail");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:gentoo:linux");

  script_set_attribute(attribute:"patch_publication_date", value:"2007/08/11");
  script_set_attribute(attribute:"plugin_publication_date", value:"2007/08/13");
  script_set_attribute(attribute:"vuln_publication_date", value:"2007/07/11");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_copyright(english:"This script is Copyright (C) 2007-2019 Tenable Network Security, Inc.");
  script_family(english:"Gentoo Local Security Checks");

  script_dependencies("ssh_get_info.nasl");
  script_require_keys("Host/local_checks_enabled", "Host/Gentoo/release", "Host/Gentoo/qpkg-list");

  exit(0);
}


include("audit.inc");
include("global_settings.inc");
include("qpkg.inc");

if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED);
if (!get_kb_item("Host/Gentoo/release")) audit(AUDIT_OS_NOT, "Gentoo");
if (!get_kb_item("Host/Gentoo/qpkg-list")) audit(AUDIT_PACKAGE_LIST_MISSING);


flag = 0;

if (qpkg_check(package:"mail-client/squirrelmail", unaffected:make_list("ge 1.4.10a-r2"), vulnerable:make_list("lt 1.4.10a-r2"))) flag++;

if (flag)
{
  if (report_verbosity > 0) security_hole(port:0, extra:qpkg_report_get());
  else security_hole(0);
  exit(0);
}
else
{
  tested = qpkg_tests_get();
  if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested);
  else audit(AUDIT_PACKAGE_NOT_INSTALLED, "SquirrelMail G/PGP plugin");
}

Seebug

bulletinFamilyexploit
descriptionBUGTRAQ ID: 24874,24782 CVE(CAN) ID: CVE-2005-1924,CVE-2006-4169 SquirrelMail是一个多功能的用PHP4实现的Webmail程序,可运行于Linux/Unix类操作系统下。 SquirrelMail的实现上存在多个输入验证漏洞,远程攻击者可能利用这些漏洞在服务器上执行任意命令。 SquirrelMail中的G/PGP加密插件没有正确地过滤所包含的某些文件,gpg_help.php和gpg_help_base.php文件中可能包含有通过“help” HTTP GET请求参数所提供的本地文件,代码如下: 68 // Help body text is inserted here via GET parameter 69 require_once (SM_PATH.'plugins/gpg/help/' . $_GET['help'] ); 如果使用了目录遍历标识符,攻击者就可以导致将储存在Web服务器中的文件解析为PHP代码。 由于使用未经过滤的用户数据调用了exec(),导致G/PGP加密插件中gpg_key_functions.php所定义的gpg_recv_key()函数中存在命令注入漏洞,代码如下: $command = &quot;$path_to_gpg --batch --no-tty --homedir $gpg_key_dir \ --keyserver hkp://$keyserver --recv-key $searchkeyid 2&gt;&amp;1&quot;; [...] exec($command, $output, $returnval); 上面的$keyserver变量是通过对gpg_options.php脚本的POST数据提供的。攻击者必须拥有有效的认证会话才能利用这个漏洞。 由于使用未经过滤的用户数据调用了exec(),导致G/PGP加密插件中gpg_hook_functions.php所定义的gpg_check_sign_pgp_mime()函数中存在命令注入漏洞,代码如下: $command = &quot;echo -n \&quot;$messageSignedText\&quot; | $path_to_gpg --batch \ --no-tty --homedir $gpg_key_dir --verify &quot;.\ $detachedSignatureFilename.&quot;- 2&gt;&amp;1&quot;; if ($debug) echo &quot;gpg command: &quot;.$command.&quot;\&quot;; exec($command, $results, $returnval); $messageSignedText变量中包含有从邮件消息中剥离的数据。 由于使用未经过滤的用户数据调用了exec(),导致G/PGP加密插件中gpg_keyring.php所定义的deleteKey()函数中存在命令注入漏洞,代码如下: $command = &quot;$path_to_gpg --batch --no-tty --yes --homedir \ $gpg_key_dir $flag $fpr 2&gt;&amp;1&quot;; exec($command, $output, $returnval); deleteKey()例程是从import_key_file.php、import_key_text.php和keyring_main.php文件中调用的,且$fpr变量是在POST数据中提供的。攻击者必须拥有有效的认证会话才能利用这个漏洞。 SquirrelMail G/PGP加密插件 2.1 SquirrelMail G/PGP加密插件 2.0 临时解决方法: * 禁用G/PGP插件,或在调用exec()之前添加以下行: $messageSignedText= escapeshellarg($messageSignedText); $keyserver = escapeshellarg($keyserver); $fpr = escapeshellarg($fpr); 厂商补丁: SquirrelMail ------------ 目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本: <a href="http://www.squirrelmail.org" target="_blank">http://www.squirrelmail.org</a>
idSSV:2012
last seen2017-11-19
modified2007-07-18
published2007-07-18
reporterRoot
titleSquirrelMail G/PGP加密插件多个远程命令执行漏洞