Rapid7 Vulnerability & Exploit Database

PHP CGI Argument Injection

Back to Search

PHP CGI Argument Injection

Disclosed
05/03/2012
Created
05/30/2018

Description

When run as a CGI, PHP up to version 5.3.12 and 5.4.2 is vulnerable to an argument injection vulnerability. This module takes advantage of the -d flag to set php.ini directives to achieve code execution. From the advisory: "if there is NO unescaped '=' in the query string, the string is split on '+' (encoded space) characters, urldecoded, passed to a function that escapes shell metacharacters (the "encoded in a system-defined manner" from the RFC) and then passes them to the CGI binary." This module can also be used to exploit the plesk 0day disclosed by kingcope and exploited in the wild on June 2013.

Author(s)

  • egypt <egypt@metasploit.com>
  • hdm <x@hdm.io>
  • jjarmoc
  • kingcope
  • juan vazquez <juan.vazquez@metasploit.com>

Platform

PHP

Architectures

php

Development

Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/multi/http/php_cgi_arg_injection
msf exploit(php_cgi_arg_injection) > show targets
    ...targets...
msf exploit(php_cgi_arg_injection) > set TARGET < target-id >
msf exploit(php_cgi_arg_injection) > show options
    ...show and set options...
msf exploit(php_cgi_arg_injection) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security

;