phpMyAdmin 3.5.x < 3.5.8.1 / 4.x < 4.0.0-rc3 Multiple Vulnerabilities (PMASA-2013-2 - PMASA-2013-5 - Nessus

Medium   Plugin ID: 66295

This page contains detailed information about the phpMyAdmin 3.5.x < 3.5.8.1 / 4.x < 4.0.0-rc3 Multiple Vulnerabilities (PMASA-2013-2 - PMASA-2013-5 Nessus plugin including available exploits and PoCs found on GitHub, in Metasploit or Exploit-DB for verifying of this vulnerability.

Plugin Overview


ID: 66295
Name: phpMyAdmin 3.5.x < 3.5.8.1 / 4.x < 4.0.0-rc3 Multiple Vulnerabilities (PMASA-2013-2 - PMASA-2013-5
Filename: phpmyadmin_pmasa_2013_2.nasl
Vulnerability Published: 2013-04-24
This Plugin Published: 2013-05-02
Last Modification Time: 2022-04-11
Plugin Version: 1.9
Plugin Type: remote
Plugin Family: CGI abuses
Dependencies: phpMyAdmin_detect.nasl
Required KB Items [?]: Settings/ParanoidReport, www/PHP, www/phpMyAdmin

Vulnerability Information


Severity: Medium
Vulnerability Published: 2013-04-24
Patch Published: 2013-04-24
CVE [?]: CVE-2013-3238, CVE-2013-3239, CVE-2013-3240, CVE-2013-3241
CPE [?]: cpe:/a:phpmyadmin:phpmyadmin

Synopsis

The remote web server hosts a PHP application that is affected by multiple vulnerabilities.

Description

According to its self-identified version number, the phpMyAdmin 3.5.x / 4.0.0 install hosted on the remote web server is earlier than 3.5.8.1 / 4.0.0-rc3 and is, therefore, affected by multiple vulnerabilities:

- The 'preg_replace' fails to properly sanitize arguments, which can be used to for arbitrary code execution. (CVE-2013-3238)

- A security weakness exists in the way that locally saved databases are handled. It is possible that the 'filename_template' parameter can be used to create a file with double extensions. (CVE-2013-3239)

- A flaw exists where the 'what' parameter was not correctly validated, allowing for a local file inclusion. This flaw reportedly affects phpMyAdmin 4.x only. (CVE-2013-3240)

- A flaw exists in the 'export.php' script that allows overwrite of global variables, leading to an unauthorized access vulnerability. This flaw reportedly affects phpMyAdmin 4.x only. (CVE-2013-3241)

Solution

Either upgrade to phpMyAdmin 3.5.8.1 / 4.0.0-rc3 or later, or apply the patches from the referenced link.

Public Exploits


Target Network Port(s): 80
Target Asset(s): Services/www
Exploit Available: True (Metasploit Framework, Exploit-DB, GitHub, Core Impact)
Exploit Ease: No exploit is required

Here's the list of publicly known exploits and PoCs for verifying the phpMyAdmin 3.5.x < 3.5.8.1 / 4.x < 4.0.0-rc3 Multiple Vulnerabilities (PMASA-2013-2 - PMASA-2013-5 vulnerability:

  1. Metasploit: exploit/multi/http/phpmyadmin_preg_replace
    [phpMyAdmin Authenticated Remote Code Execution via preg_replace()]
  2. Exploit-DB: exploits/php/remote/25136.rb
    [EDB-25136: phpMyAdmin - 'preg_replace' (Authenticated) Remote Code Execution (Metasploit)]
  3. Exploit-DB: exploits/php/webapps/25003.txt
    [EDB-25003: phpMyAdmin 3.5.8/4.0.0-RC2 - Multiple Vulnerabilities]
  4. GitHub: https://github.com/ACIC-Africa/metasploitable3
    [CVE-2013-3238]
  5. GitHub: https://github.com/duckstroms/Web-CTF-Cheatsheet
    [CVE-2013-3238]
  6. GitHub: https://github.com/w181496/Web-CTF-Cheatsheet
    [CVE-2013-3238]

Before running any exploit against any system, make sure you are authorized by the owner of the target system(s) to perform such activity. In any other case, this would be considered as an illegal activity.

WARNING: Beware of using unverified exploits from sources such as GitHub or Exploit-DB. These exploits and PoCs could contain malware. For more information, see how to use exploits safely.

Risk Information


CVSS V2 Vector [?]: AV:N/AC:L/Au:S/C:P/I:P/A:P/E:F/RL:OF/RC:C
CVSS Base Score:6.5 (Medium)
Impact Subscore:6.4
Exploitability Subscore:8.0
CVSS Temporal Score:5.4 (Medium)
CVSS Environmental Score:NA (None)
Modified Impact Subscore:NA
Overall CVSS Score:5.4 (Medium)

Go back to menu.

Plugin Source


This is the phpmyadmin_pmasa_2013_2.nasl nessus plugin source code. This script is Copyright (C) 2013-2022 and is owned by Tenable, Inc. or an Affiliate thereof.

#%NASL_MIN_LEVEL 70300
#
# (C) Tenable Network Security, Inc.
#

include('deprecated_nasl_level.inc');
include('compat.inc');

if (description)
{
  script_id(66295);
  script_version("1.9");
  script_set_attribute(attribute:"plugin_modification_date", value:"2022/04/11");

  script_cve_id(
    "CVE-2013-3238",
    "CVE-2013-3239",
    "CVE-2013-3240",
    "CVE-2013-3241"
  );
  script_bugtraq_id(
    59460,
    59461,
    59462,
    59465
  );
  script_xref(name:"EDB-ID", value:"25003");

  script_name(english:"phpMyAdmin 3.5.x < 3.5.8.1 / 4.x < 4.0.0-rc3 Multiple Vulnerabilities (PMASA-2013-2 - PMASA-2013-5");

  script_set_attribute(attribute:"synopsis", value:
"The remote web server hosts a PHP application that is affected by
multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"According to its self-identified version number, the phpMyAdmin 3.5.x /
4.0.0 install hosted on the remote web server is earlier than 3.5.8.1 /
4.0.0-rc3 and is, therefore, affected by multiple vulnerabilities:

  - The 'preg_replace' fails to properly sanitize
    arguments, which can be used to for arbitrary code
    execution. (CVE-2013-3238)

  - A security weakness exists in the way that locally saved
    databases are handled.  It is possible that the
    'filename_template' parameter can be used to create a
    file with double extensions. (CVE-2013-3239)

  - A flaw exists where the 'what' parameter was not
    correctly validated, allowing for a local file
    inclusion. This flaw reportedly affects phpMyAdmin 4.x
    only. (CVE-2013-3240)

  - A flaw exists in the 'export.php' script that allows
    overwrite of global variables, leading to an
    unauthorized access vulnerability. This flaw reportedly
    affects phpMyAdmin 4.x only. (CVE-2013-3241)");
  script_set_attribute(attribute:"see_also", value:"https://www.phpmyadmin.net/security/PMASA-2013-2/");
  script_set_attribute(attribute:"see_also", value:"https://www.phpmyadmin.net/security/PMASA-2013-3/");
  script_set_attribute(attribute:"see_also", value:"https://www.phpmyadmin.net/security/PMASA-2013-4/");
  script_set_attribute(attribute:"see_also", value:"https://www.phpmyadmin.net/security/PMASA-2013-5/");
  script_set_attribute(attribute:"see_also", value:"http://www.waraxe.us/advisory-103.html");
  script_set_attribute(attribute:"solution", value:
"Either upgrade to phpMyAdmin 3.5.8.1 / 4.0.0-rc3 or later, or apply the
patches from the referenced link.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:S/C:P/I:P/A:P");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");

  script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploit_framework_core", value:"true");
  script_set_attribute(attribute:"metasploit_name", value:'phpMyAdmin Authenticated Remote Code Execution via preg_replace()');
  script_set_attribute(attribute:"exploit_framework_metasploit", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2013/04/24");
  script_set_attribute(attribute:"patch_publication_date", value:"2013/04/24");
  script_set_attribute(attribute:"plugin_publication_date", value:"2013/05/02");

  script_set_attribute(attribute:"potential_vulnerability", value:"true");
  script_set_attribute(attribute:"plugin_type", value:"remote");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:phpmyadmin:phpmyadmin");
  script_set_attribute(attribute:"thorough_tests", value:"true");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"CGI abuses");

  script_copyright(english:"This script is Copyright (C) 2013-2022 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("phpMyAdmin_detect.nasl");
  script_require_keys("www/PHP", "www/phpMyAdmin", "Settings/ParanoidReport");
  script_require_ports("Services/www", 80);

  exit(0);
}

include("audit.inc");
include("global_settings.inc");
include("misc_func.inc");
include("http.inc");
include("webapp_func.inc");

port = get_http_port(default:80, php:TRUE);

install = get_install_from_kb(appname:"phpMyAdmin", port:port, exit_on_fail:TRUE);
dir = install['dir'];
location = build_url(qs:dir, port:port);

version = install['ver'];
if (version == UNKNOWN_VER) audit(AUDIT_UNKNOWN_WEB_APP_VER, "phpMyAdmin", location);

if (report_paranoia < 2) audit(AUDIT_PARANOID);

if (
  version =~ "^3(\.5)?$" ||
  version =~ "^4(\.0)?$"
) exit(1, "The version of phpMyAdmin located at "+ location +" ("+ version +") is not granular enough.");

if (
  # 3.5.x < 3.5.8.1
  version =~ "^3\.5\.[0-7]([^0-9]|$)" ||
  version =~ "^3\.5\.8($|\.[^1-9])" ||
  # 4.0.0 < 4.0.0-rc3
  version =~ "^4\.0\.0-rc[0-2]([^0-9]|$)"
)
{
  if (report_verbosity > 0)
  {
    report =
      '\n  URL               : ' + location +
      '\n  Installed version : ' + version +
      '\n  Fixed version     : 3.5.8.1 / 4.0.0-rc3' +
      '\n';
    security_warning(port:port, extra:report);
  }
  else security_warning(port);
  exit(0);
}
else audit(AUDIT_WEB_APP_NOT_AFFECTED, "phpMyAdmin", location, version);

The latest version of this script can be found in these locations depending on your platform:

  • Linux / Unix:
    /opt/nessus/lib/nessus/plugins/phpmyadmin_pmasa_2013_2.nasl
  • Windows:
    C:\ProgramData\Tenable\Nessus\nessus\plugins\phpmyadmin_pmasa_2013_2.nasl
  • Mac OS X:
    /Library/Nessus/run/lib/nessus/plugins/phpmyadmin_pmasa_2013_2.nasl

Go back to menu.

How to Run


Here is how to run the phpMyAdmin 3.5.x < 3.5.8.1 / 4.x < 4.0.0-rc3 Multiple Vulnerabilities (PMASA-2013-2 - PMASA-2013-5 as a standalone plugin via the Nessus web user interface (https://localhost:8834/):

  1. Click to start a New Scan.
  2. Select Advanced Scan.
  3. Navigate to the Plugins tab.
  4. On the top right corner click to Disable All plugins.
  5. On the left side table select CGI abuses plugin family.
  6. On the right side table select phpMyAdmin 3.5.x < 3.5.8.1 / 4.x < 4.0.0-rc3 Multiple Vulnerabilities (PMASA-2013-2 - PMASA-2013-5 plugin ID 66295.
  7. Specify the target on the Settings tab and click to Save the scan.
  8. Run the scan.

Here are a few examples of how to run the plugin in the command line. Note that the examples below demonstrate the usage on the Linux / Unix platform.

Basic usage:

/opt/nessus/bin/nasl phpmyadmin_pmasa_2013_2.nasl -t <IP/HOST>

Run the plugin with audit trail message on the console:

/opt/nessus/bin/nasl -a phpmyadmin_pmasa_2013_2.nasl -t <IP/HOST>

Run the plugin with trace script execution written to the console (useful for debugging):

/opt/nessus/bin/nasl -T - phpmyadmin_pmasa_2013_2.nasl -t <IP/HOST>

Run the plugin with using a state file for the target and updating it (useful for running multiple plugins on the target):

/opt/nessus/bin/nasl -K /tmp/state phpmyadmin_pmasa_2013_2.nasl -t <IP/HOST>

Go back to menu.

References


BID | SecurityFocus Bugtraq ID: See also: Similar and related Nessus plugins:
  • 66364 - Fedora 19 : phpMyAdmin-3.5.8.1-1.fc19 (2013-6928)
  • 66365 - Fedora 18 : phpMyAdmin-3.5.8.1-1.fc18 (2013-6977)
  • 66366 - Fedora 17 : phpMyAdmin-3.5.8.1-1.fc17 (2013-7000)
  • 66210 - FreeBSD : phpMyAdmin -- Multiple security vulnerabilities (8c8fa44d-ad15-11e2-8cea-6805ca0b3d42)
  • 70753 - GLSA-201311-02 : phpMyAdmin: Multiple vulnerabilities
  • 66313 - Mandriva Linux Security Advisory : phpmyadmin (MDVSA-2013:160)
  • 75055 - openSUSE Security Update : phpMyAdmin (openSUSE-SU-2013:1065-1)
  • 99661 - phpMyAdmin 4.0.x < 4.0.10.16 Multiple Vulnerabilities (PMASA-2016-17, PMASA-2016-22 - PMASA-2016-24, PMASA-2016-26 - PMASA-2016-28)
  • 99662 - phpMyAdmin 4.4.x < 4.4.15.7 Multiple Vulnerabilities (PMASA-2016-17, PMASA-2016-19, PMASA-2016-21 - PMASA-2016-24, PMASA-2016-26 - PMASA-2016-28)
  • 99663 - phpMyAdmin 4.6.x < 4.6.3 Multiple Vulnerabilities (PMASA-2016-17 - PMASA-2016-28)
  • 36170 - phpMyAdmin setup.php save Action Arbitrary PHP Code Injection (PMASA-2009-3)
  • 59211 - phpMyAdmin simplexml_load_string() Function Information Disclosure (PMASA-2011-17)
  • 57346 - phpMyAdmin 3.3.x / 3.4.x < 3.3.10.2 / 3.4.3.1 Multiple Vulnerabilities (PMASA-2011-5 - PMASA-2011-8)
  • 62312 - phpMyAdmin server_sync.php Backdoor (PMASA-2012-5)
  • 79599 - phpMyAdmin 4.0.x < 4.0.10.6 / 4.1.x < 4.1.14.7 / 4.2.x < 4.2.12 Multiple Vulnerabilities (PMASA-2014-13 - PMASA-2014-16)
  • 79797 - phpMyAdmin 4.0.x < 4.0.10.7 / 4.1.x < 4.1.14.8 / 4.2.x < 4.2.13.1 Multiple Vulnerabilities (PMASA-2014-17 - PMASA-2014-18)
  • 143253 - phpMyAdmin 4.7.x < 4.7.7 XSRF (PMASA-2017-9)
  • 143262 - phpMyAdmin 4.3.x < 4.7.8 XSS (PMASA-2018-1)
  • 110722 - phpMyAdmin 4.8.x < 4.8.2 Vulnerability (PMASA-2018-4)
  • 119601 - phpMyAdmin 4.x < 4.8.4 Multiple Vulnerabilities (PMASA-2018-6) (PMASA-2018-8)
  • 123416 - phpMyAdmin 4.x < 4.8.5 Multiple Vulnerabilities (PMASA-2019-1) (PMASA-2019-2)
  • 125856 - phpMyAdmin 4.x < 4.9.0 CSRF vulnerablity (PMASA-2019-4)
  • 131319 - phpMyAdmin 4.7.7 < 4.9.2 SQLi (PMASA-2019-5)
  • 138595 - phpMyAdmin 4.x < 4.9.4 / 5.x < 5.0.1 SQLi (PMASA-2020-1)
  • 126705 - phpMyAdmin 4.0 < 4.8.5 Multiple Vulnerabilities (PMASA-2019-1), (PMASA-2019-2)
  • 129696 - phpMyAdmin <= 4.9.1 Cross-Site Request Forgery Vulnerability
  • 144649 - phpMyAdmin 4.9.0 < 4.9.6 / 5.0.0 < 5.0.3 Multiple Vulnerabilities (PMASA-2020-5, PMASA-2020-6)
  • 51425 - phpMyAdmin error.php BBcode Tag XSS (PMASA-2010-9)
  • 19950 - phpMyAdmin grab_globals.lib.php subform Parameter Traversal Local File Inclusion

Version


This page has been produced using Nessus Professional 10.1.2 (#68) LINUX, Plugin set 202205072148.
Plugin file phpmyadmin_pmasa_2013_2.nasl version 1.9. For more plugins, visit the Nessus Plugin Library.

Go back to menu.