Vulnerabilities > CVE-2012-2311 - SQL Injection vulnerability in PHP

047910
CVSS 0.0 - NONE
Attack vector
UNKNOWN
Attack complexity
UNKNOWN
Privileges required
UNKNOWN
Confidentiality impact
UNKNOWN
Integrity impact
UNKNOWN
Availability impact
UNKNOWN
php
CWE-89
nessus
exploit available

Summary

sapi/cgi/cgi_main.c in PHP before 5.3.13 and 5.4.x before 5.4.3, when configured as a CGI script (aka php-cgi), does not properly handle query strings that contain a %3D sequence but no = (equals sign) character, which allows remote attackers to execute arbitrary code by placing command-line options in the query string, related to lack of skipping a certain php_getopt for the 'd' case. NOTE: this vulnerability exists because of an incomplete fix for CVE-2012-1823.

Vulnerable Configurations

Part Description Count
Application
Php
448

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
  • Object Relational Mapping Injection
    An attacker leverages a weakness present in the database access layer code generated with an Object Relational Mapping (ORM) tool or a weakness in the way that a developer used a persistence framework to inject his or her own SQL commands to be executed against the underlying database. The attack here is similar to plain SQL injection, except that the application does not use JDBC to directly talk to the database, but instead it uses a data access layer generated by an ORM tool or framework (e.g. Hibernate). While most of the time code generated by an ORM tool contains safe access methods that are immune to SQL injection, sometimes either due to some weakness in the generated code or due to the fact that the developer failed to use the generated access methods properly, SQL injection is still possible.
  • SQL Injection through SOAP Parameter Tampering
    An attacker modifies the parameters of the SOAP message that is sent from the service consumer to the service provider to initiate a SQL injection attack. On the service provider side, the SOAP message is parsed and parameters are not properly validated before being used to access a database in a way that does not use parameter binding, thus enabling the attacker to control the structure of the executed SQL query. This pattern describes a SQL injection attack with the delivery mechanism being a SOAP message.
  • Expanding Control over the Operating System from the Database
    An attacker is able to leverage access gained to the database to read / write data to the file system, compromise the operating system, create a tunnel for accessing the host machine, and use this access to potentially attack other machines on the same network as the database machine. Traditionally SQL injections attacks are viewed as a way to gain unauthorized read access to the data stored in the database, modify the data in the database, delete the data, etc. However, almost every data base management system (DBMS) system includes facilities that if compromised allow an attacker complete access to the file system, operating system, and full access to the host running the database. The attacker can then use this privileged access to launch subsequent attacks. These facilities include dropping into a command shell, creating user defined functions that can call system level libraries present on the host machine, stored procedures, etc.
  • SQL Injection
    This attack exploits target software that constructs SQL statements based on user input. An attacker crafts input strings so that when the target software constructs SQL statements based on the input, the resulting SQL statement performs actions other than those the application intended. SQL Injection results from failure of the application to appropriately validate input. When specially crafted user-controlled input consisting of SQL syntax is used without proper validation as part of SQL queries, it is possible to glean information from the database in ways not envisaged during application design. Depending upon the database and the design of the application, it may also be possible to leverage injection to have the database execute system-related commands of the attackers' choice. SQL Injection enables an attacker to talk directly to the database, thus bypassing the application completely. Successful injection can cause information disclosure as well as ability to add or modify data in the database. In order to successfully inject SQL and retrieve information from a database, an attacker:

Exploit-Db

  • descriptionApache / PHP 5.x - cgi-bin Remote Code Execution Exploit. CVE-2012-1823,CVE-2012-2311,CVE-2012-2336. Remote exploit for linux platform
    idEDB-ID:29290
    last seen2016-02-03
    modified2013-10-29
    published2013-10-29
    reporterkingcope
    sourcehttps://www.exploit-db.com/download/29290/
    titleApache / PHP 5.x - cgi-bin Remote Code Execution Exploit
  • descriptionApache + PHP 5.x - Remote Code Execution (Multithreaded Scanner) (2). CVE-2012-1823,CVE-2012-2311,CVE-2012-2336. Remote exploit for php platform
    idEDB-ID:29316
    last seen2016-02-03
    modified2013-10-31
    published2013-10-31
    reporternoptrix
    sourcehttps://www.exploit-db.com/download/29316/
    titleApache + PHP 5.x - Remote Code Execution Multithreaded Scanner 2
  • descriptionPHP CGI Argument Injection Exploit. CVE-2012-1823,CVE-2012-2311,CVE-2012-2336. Remote exploit for php platform
    idEDB-ID:18836
    last seen2016-02-02
    modified2012-05-05
    published2012-05-05
    reporterrayh4c
    sourcehttps://www.exploit-db.com/download/18836/
    titlePHP CGI Argument Injection Exploit
  • descriptionPHP CGI Argument Injection. CVE-2012-1823,CVE-2012-2311,CVE-2012-2336. Remote exploit for php platform
    idEDB-ID:18834
    last seen2016-02-02
    modified2012-05-04
    published2012-05-04
    reportermetasploit
    sourcehttps://www.exploit-db.com/download/18834/
    titlePHP CGI Argument Injection
  • descriptionApache + PHP < 5.3.12 / < 5.4.2 - Remote Code Execution (Multithreaded Scanner) (2). CVE-2012-1823,CVE-2012-2311,CVE-2012-2336. Remote exploit for PHP ...
    idEDB-ID:40233
    last seen2016-08-13
    modified2013-11-01
    published2013-11-01
    reporternoptrix
    titleApache + PHP < 5.3.12 / < 5.4.2 - Remote Code Execution (Multithreaded Scanner) (2)

Nessus

  • NASL familySuSE Local Security Checks
    NASL idSUSE_APACHE2-MOD_PHP5-8114.NASL
    descriptionThis update fixes several security issues in PHP5 : - A directory traversal bug has been fixed in php5. (CVE-2012-1172) - A command injection was possible when PHP5 was operated in CGI mode using commandline options. This problem does not affect PHP5 in the normal Apache module mode setup. (CVE-2012-1823 / CVE-2012-2311) - Also a pack/unpacking bug on big endian 64bit architectures (ppc64 and s390x) has been fixed. bnc#753778
    last seen2020-06-05
    modified2012-05-09
    plugin id59053
    published2012-05-09
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/59053
    titleSuSE 10 Security Update : PHP5 (ZYPP Patch Number 8114)
  • NASL familyCGI abuses
    NASL idPHP_CGI_QUERY_STRING_CODE_EXECUTION.NASL
    descriptionThe PHP installation on the remote web server contains a flaw that could allow a remote attacker to pass command-line arguments as part of a query string to the PHP-CGI program. This could be abused to execute arbitrary code, reveal PHP source code, cause a system crash, etc.
    last seen2020-06-01
    modified2020-06-02
    plugin id59088
    published2012-05-14
    reporterThis script is Copyright (C) 2012-2018 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/59088
    titlePHP PHP-CGI Query String Parameter Injection Arbitrary Code Execution
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2012-7567.NASL
    descriptionThe releases complete a fix for a vulnerability in CGI-based setups (CVE-2012-2311). 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 seen2020-03-17
    modified2012-05-29
    plugin id59265
    published2012-05-29
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/59265
    titleFedora 15 : maniadrive-1.2-32.fc15.5 / php-5.3.13-1.fc15 / php-eaccelerator-0.9.6.1-9.fc15.5 (2012-7567)
  • NASL familySuSE Local Security Checks
    NASL idOPENSUSE-2012-261.NASL
    descriptionwhen used in CGI mode remote attackers could inject command line arguments to php
    last seen2020-06-05
    modified2014-06-13
    plugin id74616
    published2014-06-13
    reporterThis script is Copyright (C) 2014-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/74616
    titleopenSUSE Security Update : php5 (openSUSE-SU-2012:0590-1)
  • NASL familySuSE Local Security Checks
    NASL idSUSE_11_APACHE2-MOD_PHP53-120504.NASL
    descriptionThis update fixes several security issues in PHP5 : - A directory traversal bug has been fixed in PHP5. (CVE-2012-1172) - A command injection was possible when PHP5 was operated in CGI mode using commandline options. This problem does not affect PHP5 in the normal Apache module mode setup. (CVE-2012-1823 / CVE-2012-2311)
    last seen2020-06-05
    modified2013-01-25
    plugin id64103
    published2013-01-25
    reporterThis script is Copyright (C) 2013-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/64103
    titleSuSE 11.2 Security Update : PHP5 (SAT Patch Number 6251)
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2012-7628.NASL
    descriptionThe releases complete a fix for a vulnerability in CGI-based setups (CVE-2012-2311). PHP 5.4.3 fixes a buffer overflow vulnerability in the apache_request_headers() (CVE-2012-2329). 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 seen2020-03-17
    modified2012-05-29
    plugin id59268
    published2012-05-29
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/59268
    titleFedora 17 : maniadrive-1.2-40.fc17 / php-5.4.3-1.fc17 (2012-7628)
  • NASL familyGentoo Local Security Checks
    NASL idGENTOO_GLSA-201209-03.NASL
    descriptionThe remote host is affected by the vulnerability described in GLSA-201209-03 (PHP: Multiple vulnerabilities) Multiple vulnerabilities have been discovered in PHP. Please review the CVE identifiers referenced below for details. Impact : A remote attacker could execute arbitrary code with the privileges of the process, cause a Denial of Service condition, obtain sensitive information, create arbitrary files, conduct directory traversal attacks, bypass protection mechanisms, or perform further attacks with unspecified impact. Workaround : There is no known workaround at this time.
    last seen2020-06-01
    modified2020-06-02
    plugin id62236
    published2012-09-24
    reporterThis script is Copyright (C) 2012-2018 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/62236
    titleGLSA-201209-03 : PHP: Multiple vulnerabilities
  • NASL familyMacOS X Local Security Checks
    NASL idMACOSX_10_8_2.NASL
    descriptionThe remote host is running a version of Mac OS X 10.8.x that is prior to 10.8.2. The newer version contains multiple security-related fixes for the following components : - BIND - Data Security - LoginWindow - Mobile Accounts - PHP
    last seen2020-06-01
    modified2020-06-02
    plugin id62215
    published2012-09-20
    reporterThis script is Copyright (C) 2012-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/62215
    titleMac OS X 10.8.x < 10.8.2 Multiple Vulnerabilities
  • NASL familyMacOS X Local Security Checks
    NASL idMACOSX_SECUPD2012-004.NASL
    descriptionThe remote host is running a version of Mac OS X 10.6 that does not have Security Update 2012-004 applied. This update contains multiple security-related fixes for the following components : - Apache - Data Security - DirectoryService - ImageIO - International Components for Unicode - Mail - PHP - QuickLook - QuickTime - Ruby
    last seen2020-06-01
    modified2020-06-02
    plugin id62213
    published2012-09-20
    reporterThis script is Copyright (C) 2012-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/62213
    titleMac OS X Multiple Vulnerabilities (Security Update 2012-004) (BEAST)
  • NASL familyWeb Servers
    NASL idHPSMH_7_2_1_0.NASL
    descriptionAccording to the web server
    last seen2020-06-01
    modified2020-06-02
    plugin id69020
    published2013-07-23
    reporterThis script is Copyright (C) 2013-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/69020
    titleHP System Management Homepage < 7.2.1.0 Multiple Vulnerabilities (BEAST)
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2012-7586.NASL
    descriptionThe releases complete a fix for a vulnerability in CGI-based setups (CVE-2012-2311). 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 seen2020-03-17
    modified2012-05-29
    plugin id59266
    published2012-05-29
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/59266
    titleFedora 16 : maniadrive-1.2-32.fc16.5 / php-5.3.13-1.fc16 / php-eaccelerator-0.9.6.1-9.fc16.5 (2012-7586)
  • NASL familyFreeBSD Local Security Checks
    NASL idFREEBSD_PKG_59B68B1E9C7811E1B5E0000C299B62E1.NASL
    descriptionThe PHP Development Team reports : The release of PHP 5.4.13 and 5.4.3 complete a fix for the vulnerability in CGI-based setups as originally described in CVE-2012-1823. (CVE-2012-2311) Note: mod_php and php-fpm are not vulnerable to this attack. PHP 5.4.3 fixes a buffer overflow vulnerability in the apache_request_headers() (CVE-2012-2329).
    last seen2020-06-01
    modified2020-06-02
    plugin id59084
    published2012-05-14
    reporterThis script is Copyright (C) 2012-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/59084
    titleFreeBSD : php -- multiple vulnerabilities (59b68b1e-9c78-11e1-b5e0-000c299b62e1)
  • NASL familyCGI abuses
    NASL idPHP_5_4_3.NASL
    descriptionAccording to its banner, the version of PHP installed on the remote host is 5.4.x earlier than 5.4.3. It is, therefore, potentially affected the following vulnerabilities : - The fix for CVE-2012-1823 does not completely correct the CGI query parameter vulnerability. Disclosure of PHP source code and code execution are still possible. Note that this vulnerability is exploitable only when PHP is used in CGI-based configurations. Apache with
    last seen2020-06-01
    modified2020-06-02
    plugin id59057
    published2012-05-09
    reporterThis script is Copyright (C) 2012-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/59057
    titlePHP 5.4.x < 5.4.3 Multiple Vulnerabilities
  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DSA-2465.NASL
    descriptionDe Eindbazen discovered that PHP, when run with mod_cgi, will interpret a query string as command line parameters, allowing to execute arbitrary code. Additionally, this update fixes insufficient validation of upload name which lead to corrupted $_FILES indices.
    last seen2020-03-17
    modified2012-05-10
    plugin id59059
    published2012-05-10
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/59059
    titleDebian DSA-2465-1 : php5 - several vulnerabilities
  • NASL familyCGI abuses
    NASL idPHP_CGI_REMOTE_CODE_EXECUTION.NASL
    descriptionThe PHP installation on the remote web server contains a flaw that could allow a remote attacker to pass command-line arguments as part of a query string to the PHP-CGI program. This could be abused to execute arbitrary code, reveal PHP source code, cause a system crash, etc.
    last seen2020-06-01
    modified2020-06-02
    plugin id70728
    published2013-11-01
    reporterThis script is Copyright (C) 2013-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/70728
    titleApache PHP-CGI Remote Code Execution
  • NASL familySuSE Local Security Checks
    NASL idSUSE_11_APACHE2-MOD_PHP5-120504.NASL
    descriptionThis update fixes several security issues in PHP5 : - A directory traversal bug has been fixed in PHP5. (CVE-2012-1172) - A command injection was possible when PHP5 was operated in CGI mode using commandline options. This problem does not affect PHP5 in the normal apache module mode setup. (CVE-2012-1823 / CVE-2012-2311) - Also a pack/unpacking bug on big endian 64bit architectures (ppc64 and s390x) has been fixed. (bnc#753778)
    last seen2020-06-05
    modified2013-01-25
    plugin id64099
    published2013-01-25
    reporterThis script is Copyright (C) 2013-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/64099
    titleSuSE 11.1 Security Update : PHP5 (SAT Patch Number 6252)
  • NASL familyUbuntu Local Security Checks
    NASL idUBUNTU_USN-1437-1.NASL
    descriptionIt was discovered that PHP, when used as a stand alone CGI processor for the Apache Web Server, did not properly parse and filter query strings. This could allow a remote attacker to execute arbitrary code running with the privilege of the web server. Configurations using mod_php5 and FastCGI were not vulnerable. This update addresses the issue when the PHP CGI interpreter is configured using mod_cgi and mod_actions as described in /usr/share/doc/php5-cgi/README.Debian.gz; however, if an alternate configuration is used to enable PHP CGI processing, it should be reviewed to ensure that command line arguments cannot be passed to the PHP interpreter. Please see CVE-2012-2311 for more details and potential mitigation approaches. Note that Tenable Network Security has extracted the preceding description block directly from the Ubuntu security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-06-01
    modified2020-06-02
    plugin id59016
    published2012-05-07
    reporterUbuntu Security Notice (C) 2012-2019 Canonical, Inc. / NASL script (C) 2012-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/59016
    titleUbuntu 8.04 LTS / 10.04 LTS / 11.04 / 11.10 / 12.04 LTS : php5 vulnerability (USN-1437-1)
  • NASL familyCGI abuses
    NASL idPHP_5_3_13.NASL
    descriptionAccording to its banner, the version of PHP installed on the remote host is 5.3.x earlier than 5.3.13 and, as such, is potentially affected by a remote code execution and information disclosure vulnerability. The fix for CVE-2012-1823 does not completely correct the CGI query vulnerability. Disclosure of PHP source code and code execution via query parameters are still possible. Note that this vulnerability is exploitable only when PHP is used in CGI-based configurations. Apache with
    last seen2020-06-01
    modified2020-06-02
    plugin id59056
    published2012-05-09
    reporterThis script is Copyright (C) 2012-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/59056
    titlePHP 5.3.x < 5.3.13 CGI Query String Code Execution
  • NASL familyMacOS X Local Security Checks
    NASL idMACOSX_10_7_5.NASL
    descriptionThe remote host is running a version of Mac OS X 10.7.x that is prior to 10.7.5. The newer version contains multiple security-related fixes for the following components : - Apache - BIND - CoreText - Data Security - ImageIO - Installer - International Components for Unicode - Kernel - Mail - PHP - Profile Manager - QuickLook - QuickTime - Ruby - USB
    last seen2020-06-01
    modified2020-06-02
    plugin id62214
    published2012-09-20
    reporterThis script is Copyright (C) 2012-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/62214
    titleMac OS X 10.7.x < 10.7.5 Multiple Vulnerabilities (BEAST)