Vulnerabilities > CVE-2011-2507 - Code Injection vulnerability in PHPmyadmin
Attack vector
UNKNOWN Attack complexity
UNKNOWN Privileges required
UNKNOWN Confidentiality impact
UNKNOWN Integrity impact
UNKNOWN Availability impact
UNKNOWN Summary
libraries/server_synchronize.lib.php in the Synchronize implementation in phpMyAdmin 3.x before 3.3.10.2 and 3.4.x before 3.4.3.1 does not properly quote regular expressions, which allows remote authenticated users to inject a PCRE e (aka PREG_REPLACE_EVAL) modifier, and consequently execute arbitrary PHP code, by leveraging the ability to modify the SESSION superglobal array.
Vulnerable Configurations
Common Weakness Enumeration (CWE)
Common Attack Pattern Enumeration and Classification (CAPEC)
- Leverage Executable Code in Non-Executable Files An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high. The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/) http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process. The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.
- Manipulating User-Controlled Variables This attack targets user controlled variables (DEBUG=1, PHP Globals, and So Forth). An attacker can override environment variables leveraging user-supplied, untrusted query variables directly used on the application server without any data sanitization. In extreme cases, the attacker can change variables controlling the business logic of the application. For instance, in languages like PHP, a number of poorly set default configurations may allow the user to override variables.
D2sec
name | Phpmyadmin 3.x RCE |
url | http://www.d2sec.com/exploits/phpmyadmin_3.x_rce.html |
Nessus
NASL family Fedora Local Security Checks NASL id FEDORA_2011-9144.NASL description Changes for 3.4.3.1 (2011-06-07) - [PMASA-2011-5] Possible session manipulation in Swekey authentication (http://www.phpmyadmin.net/home_page/security/PMASA-2011 -5.php) - [PMASA-2011-6] Possible code injection in setup script in case session variables are compromised (http://www.phpmyadmin.net/home_page/security/PMASA-20 11-6.php) - [PMASA-2011-7] Regular expression quoting issue in Synchronize code (http://www.phpmyadmin.net/home_page/security/PMASA-20 11-7.php) - [PMASA-2011-8] Possible directory traversal (http://www.phpmyadmin.net/home_page/security/PMASA-20 11-8.php) Changes for 3.4.3.0 (2011-06-27) - [sync] Missing helper icons in Synchronize - [setup] Redefine a lable that was wrong - [parser] master is not a reserved word - [edit] Inline edit updates multiple duplicate rows - [edit] Inline edit does not escape backslashes - [interface] Columns class sometimes changed for nothing - [interface] Some tooltips do not disappear - [search] Fix search in non unicode tables - [display] Inline query edit broken - [privileges] Generate password option missing on new accounts - [edit] Inline edit places HTML line breaks in edit area - [interface] Inline query edit does not escape special characters - [security] minor XSS (require a valid token) Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues. last seen 2020-06-01 modified 2020-06-02 plugin id 55604 published 2011-07-18 reporter This script is Copyright (C) 2011-2019 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/55604 title Fedora 14 : phpMyAdmin-3.4.3.1-1.fc14 (2011-9144) code #%NASL_MIN_LEVEL 80502 # # (C) Tenable Network Security, Inc. # # The descriptive text and package checks in this plugin were # extracted from Fedora Security Advisory 2011-9144. # include("compat.inc"); if (description) { script_id(55604); script_version("1.13"); script_cvs_date("Date: 2019/08/02 13:32:35"); script_cve_id("CVE-2011-2505", "CVE-2011-2506", "CVE-2011-2507", "CVE-2011-2508"); script_bugtraq_id(48563); script_xref(name:"FEDORA", value:"2011-9144"); script_name(english:"Fedora 14 : phpMyAdmin-3.4.3.1-1.fc14 (2011-9144)"); script_summary(english:"Checks rpm output for the updated package."); script_set_attribute( attribute:"synopsis", value:"The remote Fedora host is missing a security update." ); script_set_attribute( attribute:"description", value: "Changes for 3.4.3.1 (2011-06-07) - [PMASA-2011-5] Possible session manipulation in Swekey authentication (http://www.phpmyadmin.net/home_page/security/PMASA-2011 -5.php) - [PMASA-2011-6] Possible code injection in setup script in case session variables are compromised (http://www.phpmyadmin.net/home_page/security/PMASA-20 11-6.php) - [PMASA-2011-7] Regular expression quoting issue in Synchronize code (http://www.phpmyadmin.net/home_page/security/PMASA-20 11-7.php) - [PMASA-2011-8] Possible directory traversal (http://www.phpmyadmin.net/home_page/security/PMASA-20 11-8.php) Changes for 3.4.3.0 (2011-06-27) - [sync] Missing helper icons in Synchronize - [setup] Redefine a lable that was wrong - [parser] master is not a reserved word - [edit] Inline edit updates multiple duplicate rows - [edit] Inline edit does not escape backslashes - [interface] Columns class sometimes changed for nothing - [interface] Some tooltips do not disappear - [search] Fix search in non unicode tables - [display] Inline query edit broken - [privileges] Generate password option missing on new accounts - [edit] Inline edit places HTML line breaks in edit area - [interface] Inline query edit does not escape special characters - [security] minor XSS (require a valid token) Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues." ); # http://www.phpmyadmin.net/home_page/security/PMASA-2011-5.php script_set_attribute( attribute:"see_also", value:"https://www.phpmyadmin.net/security/PMASA-2011-5/" ); # http://www.phpmyadmin.net/home_page/security/PMASA-2011-6.php script_set_attribute( attribute:"see_also", value:"https://www.phpmyadmin.net/security/PMASA-2011-6/" ); # http://www.phpmyadmin.net/home_page/security/PMASA-2011-7.php script_set_attribute( attribute:"see_also", value:"https://www.phpmyadmin.net/security/PMASA-2011-7/" ); # http://www.phpmyadmin.net/home_page/security/PMASA-2011-8.php script_set_attribute( attribute:"see_also", value:"https://www.phpmyadmin.net/security/PMASA-2011-8/" ); script_set_attribute( attribute:"see_also", value:"https://bugzilla.redhat.com/show_bug.cgi?id=718964" ); # https://lists.fedoraproject.org/pipermail/package-announce/2011-July/062719.html script_set_attribute( attribute:"see_also", value:"http://www.nessus.org/u?f35faca3" ); script_set_attribute( attribute:"solution", value:"Update the affected phpMyAdmin package." ); script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P"); script_set_cvss_temporal_vector("CVSS2#E:POC/RL:OF/RC:C"); script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available"); script_set_attribute(attribute:"exploit_available", value:"true"); script_set_attribute(attribute:"d2_elliot_name", value:"Phpmyadmin 3.x RCE"); script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true"); script_set_attribute(attribute:"plugin_type", value:"local"); script_set_attribute(attribute:"cpe", value:"p-cpe:/a:fedoraproject:fedora:phpMyAdmin"); script_set_attribute(attribute:"cpe", value:"cpe:/o:fedoraproject:fedora:14"); script_set_attribute(attribute:"vuln_publication_date", value:"2011/07/14"); script_set_attribute(attribute:"patch_publication_date", value:"2011/07/08"); script_set_attribute(attribute:"plugin_publication_date", value:"2011/07/18"); script_set_attribute(attribute:"generated_plugin", value:"current"); script_end_attributes(); script_category(ACT_GATHER_INFO); script_copyright(english:"This script is Copyright (C) 2011-2019 and is owned by Tenable, Inc. or an Affiliate thereof."); script_family(english:"Fedora Local Security Checks"); script_dependencies("ssh_get_info.nasl"); script_require_keys("Host/local_checks_enabled", "Host/RedHat/release", "Host/RedHat/rpm-list"); exit(0); } include("audit.inc"); include("global_settings.inc"); include("rpm.inc"); if (!get_kb_item("Host/local_checks_enabled")) audit(AUDIT_LOCAL_CHECKS_NOT_ENABLED); release = get_kb_item("Host/RedHat/release"); if (isnull(release) || "Fedora" >!< release) audit(AUDIT_OS_NOT, "Fedora"); os_ver = eregmatch(pattern: "Fedora.*release ([0-9]+)", string:release); if (isnull(os_ver)) audit(AUDIT_UNKNOWN_APP_VER, "Fedora"); os_ver = os_ver[1]; if (! ereg(pattern:"^14([^0-9]|$)", string:os_ver)) audit(AUDIT_OS_NOT, "Fedora 14.x", "Fedora " + os_ver); if (!get_kb_item("Host/RedHat/rpm-list")) audit(AUDIT_PACKAGE_LIST_MISSING); cpu = get_kb_item("Host/cpu"); if (isnull(cpu)) audit(AUDIT_UNKNOWN_ARCH); if ("x86_64" >!< cpu && cpu !~ "^i[3-6]86$") audit(AUDIT_LOCAL_CHECKS_NOT_IMPLEMENTED, "Fedora", cpu); flag = 0; if (rpm_check(release:"FC14", reference:"phpMyAdmin-3.4.3.1-1.fc14")) flag++; if (flag) { if (report_verbosity > 0) security_hole(port:0, extra:rpm_report_get()); else security_hole(0); exit(0); } else { tested = pkg_tests_get(); if (tested) audit(AUDIT_PACKAGE_NOT_AFFECTED, tested); else audit(AUDIT_PACKAGE_NOT_INSTALLED, "phpMyAdmin"); }
NASL family CGI abuses NASL id PHPMYADMIN_PMASA_2011_8.NASL description The remote host contains a version of phpMyAdmin - 3.3.x less than 3.3.10.2 or 3.4.x less than 3.4.3.1 - that is affected by multiple vulnerabilities : - An error in the file last seen 2020-06-01 modified 2020-06-02 plugin id 57346 published 2011-12-20 reporter This script is Copyright (C) 2011-2018 Tenable Network Security, Inc. source https://www.tenable.com/plugins/nessus/57346 title phpMyAdmin 3.3.x / 3.4.x < 3.3.10.2 / 3.4.3.1 Multiple Vulnerabilities (PMASA-2011-5 - PMASA-2011-8) code # # (C) Tenable Network Security, Inc. # include("compat.inc"); if (description) { script_id(57346); script_version("1.8"); script_cvs_date("Date: 2018/07/24 18:56:11"); script_cve_id( "CVE-2011-2505", "CVE-2011-2506", "CVE-2011-2507", "CVE-2011-2508" ); script_bugtraq_id(48563); script_xref(name:"EDB-ID", value:"17510"); script_xref(name:"EDB-ID", value:"17514"); script_name(english:"phpMyAdmin 3.3.x / 3.4.x < 3.3.10.2 / 3.4.3.1 Multiple Vulnerabilities (PMASA-2011-5 - PMASA-2011-8)"); script_summary(english:"Checks version of phpMyAdmin"); script_set_attribute(attribute:"synopsis", value: "The remote web server contains a PHP application that is affected by multiple vulnerabilities."); script_set_attribute(attribute:"description", value: "The remote host contains a version of phpMyAdmin - 3.3.x less than 3.3.10.2 or 3.4.x less than 3.4.3.1 - that is affected by multiple vulnerabilities : - An error in the file 'libraries/auth/swekey/swekey.auth.lib.php' allows an attacker to modify the 'SESSION' superglobal array. (CVE-2011-2505) - An error in the file 'setup/lib/ConfigGenerator.class.php' does not properly handle PHP comment-closing delimiters. This can allow an attacker inject static code via a modified 'SESSION' superglobal array. (CVE-2011-2506) - An error in the file 'libraries/server_synchronize.lib.php' does not properly call the 'preg_replace' function. This can allow an attacker to execute arbitrary code via a modified 'SESSION' superglobal array. (CVE-2011-2507) - An local file inclusion error exists in the 'PMA_displayTableBody' function in the file 'libraries/display_tbl.lib.php' that can allow an attacker to obtain sensitive information or execute code in file already present on the host. (CVE-2011-2508)"); script_set_attribute(attribute:"see_also", value:"http://ha.xxor.se/2011/07/phpmyadmin-3x-multiple-remote-code.html"); script_set_attribute(attribute:"see_also", value:"http://www.phpmyadmin.net/home_page/security/PMASA-2011-5.php"); script_set_attribute(attribute:"see_also", value:"http://www.phpmyadmin.net/home_page/security/PMASA-2011-6.php"); script_set_attribute(attribute:"see_also", value:"http://www.phpmyadmin.net/home_page/security/PMASA-2011-7.php"); script_set_attribute(attribute:"see_also", value:"http://www.phpmyadmin.net/home_page/security/PMASA-2011-8.php"); script_set_attribute(attribute:"solution", value:"Upgrade to phpMyAdmin version 3.3.10.2 / 3.4.3.1 or later."); script_set_cvss_base_vector("CVSS2#AV:N/AC:L/Au:N/C:P/I:P/A:P"); script_set_cvss_temporal_vector("CVSS2#E:POC/RL:OF/RC:C"); script_set_attribute(attribute:"exploitability_ease", value:"No exploit is required"); script_set_attribute(attribute:"exploit_available", value:"false"); script_set_attribute(attribute:"d2_elliot_name", value:"Phpmyadmin 3.x RCE"); script_set_attribute(attribute:"exploit_framework_d2_elliot", value:"true"); script_set_attribute(attribute:"vuln_publication_date", value:"2011/07/02"); script_set_attribute(attribute:"patch_publication_date", value:"2011/07/02"); script_set_attribute(attribute:"plugin_publication_date", value:"2011/12/20"); 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_end_attributes(); script_category(ACT_GATHER_INFO); script_family(english:"CGI abuses"); script_copyright(english:"This script is Copyright (C) 2011-2018 Tenable Network Security, Inc."); script_dependencies("phpMyAdmin_detect.nasl"); script_exclude_keys("Settings/disable_cgi_scanning"); script_require_keys("www/phpMyAdmin", "www/PHP", "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"); if (report_paranoia < 2) audit(AUDIT_PARANOID); port = get_http_port(default:80, php:TRUE); install = get_install_from_kb(appname:"phpMyAdmin", port:port, exit_on_fail:TRUE); dir = install['dir']; install_url = build_url(port:port,qs:dir); version = install['ver']; if (version == UNKNOWN_VER) exit(1, "The version of phpMyAdmin located at "+install_url+" could not be determined."); if (version =~ "^3(\.[34])?$") exit(1, "The version of phpMyAdmin located at "+install_url+" ("+version+") is not granular enough."); if ( # 3.3.x < 3.3.10.2 version =~ "^3\.3\.([0-9]|10(\.[01]|$))($|[^0-9])" || # 3.4.x < 3.4.3.1 version =~ "^3\.4\.([0-2]|3(\.0|$))([^0-9]|$)" ) { if (report_verbosity > 0) { report = '\n URL : ' + install_url + '\n Installed version : ' + version + '\n Fixed version : 3.3.10.2 / 3.4.3.1' + '\n'; security_hole(port:port, extra:report); } else security_hole(port); exit(0); } else exit(0, "The phpMyAdmin "+version+" install at "+build_url(port:port,qs:dir)+" is not affected.");
NASL family FreeBSD Local Security Checks NASL id FREEBSD_PKG_7E4E5C53A56C11E0B18000216AA06FC2.NASL description The phpMyAdmin development team reports : It was possible to manipulate the PHP session superglobal using some of the Swekey authentication code. This could open a path for other attacks. An unsanitized key from the Servers array is written in a comment of the generated config. An attacker can modify this key by modifying the SESSION superglobal array. This allows the attacker to close the comment and inject code. Through a possible bug in PHP running on Windows systems a NULL byte can truncate the pattern string allowing an attacker to inject the /e modifier causing the preg_replace function to execute its second argument as PHP code. Fixed filtering of a file path in the MIME-type transformation code, which allowed for directory traversal. last seen 2020-06-01 modified 2020-06-02 plugin id 55502 published 2011-07-05 reporter This script is Copyright (C) 2011-2019 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/55502 title FreeBSD : phpmyadmin -- multiple vulnerabilities (7e4e5c53-a56c-11e0-b180-00216aa06fc2) NASL family Debian Local Security Checks NASL id DEBIAN_DSA-2286.NASL description Several vulnerabilities were discovered in phpMyAdmin, a tool to administrate MySQL over the web. The Common Vulnerabilities and Exposures project identifies the following problems : - CVE-2011-2505 Possible session manipulation in Swekey authentication. - CVE-2011-2506 Possible code injection in setup script, in case session variables are compromised. - CVE-2011-2507 Regular expression quoting issue in Synchronize code. - CVE-2011-2508 Possible directory traversal in MIME-type transformation. - CVE-2011-2642 Cross site scripting in table Print view when the attacker can create crafted table names. - No CVE name yet Possible superglobal and local variables manipulation in Swekey authentication. (PMASA-2011-12) The oldstable distribution (lenny) is only affected by CVE-2011-2642, which has been fixed in version 2.11.8.1-5+lenny9. last seen 2020-03-17 modified 2011-07-28 plugin id 55708 published 2011-07-28 reporter This script is Copyright (C) 2011-2020 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/55708 title Debian DSA-2286-1 : phpmyadmin - several vulnerabilities NASL family Gentoo Local Security Checks NASL id GENTOO_GLSA-201201-01.NASL description The remote host is affected by the vulnerability described in GLSA-201201-01 (phpMyAdmin: Multiple vulnerabilities) Multiple vulnerabilities have been discovered in phpMyAdmin. Please review the CVE identifiers and phpMyAdmin Security Advisories referenced below for details. Impact : Remote attackers might be able to insert and execute PHP code, include and execute local PHP files, or perform Cross-Site Scripting (XSS) attacks via various vectors. Workaround : There is no known workaround at this time. last seen 2020-06-01 modified 2020-06-02 plugin id 57433 published 2012-01-05 reporter This script is Copyright (C) 2012-2019 and is owned by Tenable, Inc. or an Affiliate thereof. source https://www.tenable.com/plugins/nessus/57433 title GLSA-201201-01 : phpMyAdmin: Multiple vulnerabilities
Packetstorm
data source | https://packetstormsecurity.com/files/download/102908/phpmyadmin3-exec.txt |
id | PACKETSTORM:102908 |
last seen | 2016-12-05 |
published | 2011-07-08 |
reporter | Mango |
source | https://packetstormsecurity.com/files/102908/phpMyAdmin-3.x-Remote-Code-Execution.html |
title | phpMyAdmin 3.x Remote Code Execution |
Seebug
bulletinFamily exploit description CVE ID: CVE-2011-2505,CVE-2011-2506,CVE-2011-2507,CVE-2011-2508 phpMyAdmin是用PHP编写的工具,用于通过WEB管理MySQL。 phpMyAdmin在实现上存在多个漏洞,可被恶意用户利用泄露敏感信息并控制受影响系统。 1)libraries/auth/swekey/swekey.auth.lib.php中的"Swekey_login()"函数中存在错误,可被利用覆盖会话变量并注入和执行任意PHP代码; 2)传递到libraries/server_synchronize.lib.php中的"PMA_createTargetTables()"函数的输入在调用带有e修饰符的"preg_replace()"函数之前没有正确过滤,可被利用通过URL编码的NULL字节执行任意PHP代码; 3)传递到libraries/display_tbl.lib.php中的"PMA_displayTableBody()"函数的输入在用于包括文件之前没有正确过滤,可被利用通过目录遍历序列包含本地资源中的任意文件。 phpMyAdmin 3.x 厂商补丁: phpMyAdmin ---------- 目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载: http://www.phpmyadmin.net/ id SSV:20704 last seen 2017-11-19 modified 2011-07-07 published 2011-07-07 reporter Root title phpMyAdmin 3.x 多个安全漏洞 bulletinFamily exploit description No description provided by source. id SSV:20710 last seen 2017-11-19 modified 2011-07-09 published 2011-07-09 reporter Root source https://www.seebug.org/vuldb/ssvid-20710 title phpMyAdmin 3.x Multiple Remote Code Executions
References
- http://0x6a616d6573.blogspot.com/2011/07/phpmyadmin-fud.html
- http://www.phpmyadmin.net/home_page/security/PMASA-2011-7.php
- http://secunia.com/advisories/45139
- http://www.openwall.com/lists/oss-security/2011/06/29/11
- http://www.openwall.com/lists/oss-security/2011/06/28/6
- http://www.openwall.com/lists/oss-security/2011/06/28/2
- http://ha.xxor.se/2011/07/phpmyadmin-3x-pregreplace-rce-poc.html
- http://www.osvdb.org/73613
- http://www.xxor.se/advisories/phpMyAdmin_3.x_Multiple_Remote_Code_Executions.txt
- http://www.openwall.com/lists/oss-security/2011/06/28/8
- http://ha.xxor.se/2011/07/phpmyadmin-3x-multiple-remote-code.html
- http://typo3.org/teams/security/security-bulletins/typo3-sa-2011-008/
- http://lists.fedoraproject.org/pipermail/package-announce/2011-July/062719.html
- http://secunia.com/advisories/45292
- http://www.debian.org/security/2011/dsa-2286
- http://secunia.com/advisories/45315
- http://securityreason.com/securityalert/8306
- http://www.mandriva.com/security/advisories?name=MDVSA-2011:124
- http://www.securityfocus.com/archive/1/518804/100/0/threaded
- http://phpmyadmin.git.sourceforge.net/git/gitweb.cgi?p=phpmyadmin/phpmyadmin%3Ba=commit%3Bh=69fb0f8e7dc38075427aceaf09bcac697d0590ff