How To Scan And Hack WordPress Website Using WPScan And Metasploit

Let’s scan WordPress website in order to find vulnerabilities to exploit using WPScan and Metasploit.

What things you require?

  1. Wpscan
  2. Metasploit

If your using Kali Linux both of them is already installed, If you’re using other operating system you need to install them.

Don’t Miss: WordPress Vulnerability Scanning With WPSeku

Let’s Get Started!

What is WPscan ?

The WPScan software (henceforth referred to simply as “WPScan”) is dual-licensed – Copyright 2011-2016 WPScan Team.

Cases that include commercialization of WPScan require a commercial, non-free license. Otherwise, WPScan can be used without charge under the terms set out below.

How to start Wpscan?

[email protected]:~# wpscan

WPScan Examples

Do ‘non-intrusive’ checks…

wpscan --url example.com

Do word-list password brute force on enumerated users using 50 threads…

wpscan --url example.com --wordlist darkc0de.lst --threads 50

Do word-list password brute force on enumerated users using STDIN as the word-list…

crunch 5 13 -f charset.lst mixalpha | wpscan --url example.com --wordlist -

Do word-list password brute force on the ‘admin’ username only…

Don’t Miss: Large Password Lists

wpscan --url example.com --wordlist darkc0de.lst --username admin

Enumerate installed plugins…

wpscan --url example.com --enumerate p

Run all enumeration tools…

wpscan --url example.com --enumerate

Use custom content directory…

wpscan -u example.com --wp-content-dir custom-content

Update WPScan’s databases…

wpscan --update

Debug output…

wpscan --url example.com --debug-output 2>debug.log

Arguments

--update                            Update the database to the latest version.
--url       | -u <target url>       The WordPress URL/domain to scan.
--force     | -f                    Forces WPScan to not check if the remote site is running WordPress.
--enumerate | -e [option(s)]        Enumeration.
  option :
    u        usernames from id 1 to 10
    u[10-20] usernames from id 10 to 20 (you must write [] chars)
    p        plugins
    vp       only vulnerable plugins
    ap       all plugins (can take a long time)
    tt       timthumbs
    t        themes
    vt       only vulnerable themes
    at       all themes (can take a long time)
  Multiple values are allowed : "-e tt,p" will enumerate timthumbs and plugins
  If no option is supplied, the default is "vt,tt,u,vp"

--exclude-content-based "<regexp or string>"
                                    Used with the enumeration option, will exclude all occurrences based on the regexp or string supplied.
                                    You do not need to provide the regexp delimiters, but you must write the quotes (simple or double).
--config-file  | -c <config file>   Use the specified config file, see the example.conf.json.
--user-agent   | -a <User-Agent>    Use the specified User-Agent.
--cookie <string>                   String to read cookies from.
--random-agent | -r                 Use a random User-Agent.
--follow-redirection                If the target url has a redirection, it will be followed without asking if you wanted to do so or not
--batch                             Never ask for user input, use the default behaviour.
--no-color                          Do not use colors in the output.
--log [filename]                    Creates a log.txt file with WPScan's output if no filename is supplied. Otherwise the filename is used for logging.
--no-banner                         Prevents the WPScan banner from being displayed.
--disable-accept-header             Prevents WPScan sending the Accept HTTP header.
--disable-referer                   Prevents setting the Referer header.
--disable-tls-checks                Disables SSL/TLS certificate verification.
--wp-content-dir <wp content dir>   WPScan try to find the content directory (ie wp-content) by scanning the index page, however you can specify it.
                                    Subdirectories are allowed.
--wp-plugins-dir <wp plugins dir>   Same thing than --wp-content-dir but for the plugins directory.
                                    If not supplied, WPScan will use wp-content-dir/plugins. Subdirectories are allowed
--proxy <[protocol://]host:port>    Supply a proxy. HTTP, SOCKS4 SOCKS4A and SOCKS5 are supported.
                                    If no protocol is given (format host:port), HTTP will be used.
--proxy-auth <username:password>    Supply the proxy login credentials.
--basic-auth <username:password>    Set the HTTP Basic authentication.
--wordlist | -w <wordlist>          Supply a wordlist for the password brute forcer.
                                    If the "-" option is supplied, the wordlist is expected via STDIN.
--username | -U <username>          Only brute force the supplied username.
--usernames     <path-to-file>      Only brute force the usernames from the file.
--cache-dir       <cache-directory> Set the cache directory.
--cache-ttl       <cache-ttl>       Typhoeus cache TTL.
--request-timeout <request-timeout> Request Timeout.
--connect-timeout <connect-timeout> Connect Timeout.
--threads  | -t <number of threads> The number of threads to use when multi-threading requests.
--max-threads     <max-threads>     Maximum Threads.
--throttle        <milliseconds>    Milliseconds to wait before doing another web request. If used, the --threads should be set to 1.
--help     | -h                     This help screen.
--verbose  | -v                     Verbose output.
--version                           Output the current version and exit.

I Have Tested WPScan to show you how it gives us output. I have tested on public website and replaced the real domain with domain.com

Don’t Miss: 10 Things to do after Installing Kali Linux 2017

wpscan --url http://www.domain.com --enumerate
_______________________________________________________________
        __          _______   _____                  
        \ \        / /  __ \ / ____|                 
         \ \  /\  / /| |__) | (___   ___  __ _ _ __ ®
          \ \/  \/ / |  ___/ \___ \ / __|/ _` | '_ \ 
           \  /\  /  | |     ____) | (__| (_| | | | |
            \/  \/   |_|    |_____/ \___|\__,_|_| |_|

        WordPress Security Scanner by the WPScan Team 
                       Version 2.9.2
          Sponsored by Sucuri - https://sucuri.net
   @_WPScan_, @ethicalhack3r, @erwan_lr, pvdl, @_FireFart_
_______________________________________________________________

[i] It seems like you have not updated the database for some time.
[?] Do you want to update now? [Y]es [N]o [A]bort, default: [N]Y
[i] Updating the Database ...
[i] Update completed.
[+] URL: http://www.domain.com/
[+] Started: Sat Sep 16 09:10:55 2017

[+] robots.txt available under: 'http://www.domain.com/robots.txt'
[+] Interesting entry from robots.txt: http://www.domain.com/wp-admin/admin-ajax.php
[!] The WordPress 'http://www.domain.com/readme.html' file exists exposing a version number
[!] Full Path Disclosure (FPD) in 'http://www.domain.com/wp-includes/rss-functions.php': 
[+] Interesting header: LINK: <http://www.domain.com/wp-json/>; rel="https://api.w.org/", <http://www.domain.com/>; rel=shortlink
[+] Interesting header: SERVER: Apache

[+] WordPress version 4.7.5 (Released on 2017-05-16) identified from meta generator, links opml
[!] 1 vulnerability identified from the version number

[!] Title: WordPress 2.3-4.7.5 - Host Header Injection in Password Reset
    Reference: https://wpvulndb.com/vulnerabilities/8807
    Reference: https://exploitbox.io/vuln/WordPress-Exploit-4-7-Unauth-Password-Reset-0day-CVE-2017-8295.html
    Reference: http://blog.dewhurstsecurity.com/2017/05/04/exploitbox-wordpress-security-advisories.html
    Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8295

[+] WordPress theme in use: bully3 - v3.0

[+] Name: bully3 - v3.0
 |  Location: http://www.domain.com/wp-content/themes/bully3/
 |  Style URL: http://www.domain.com/wp-content/themes/bully3/style.css
 |  Theme Name: Bully's Game Calls v3
 |  Theme URI: http://www.domain.com/
 |  Description: Based on a design submitted by Brian V
 |  Author: Justin Gruca

[+] Enumerating installed plugins (only ones with known vulnerabilities) ...

   Time: 00:06:52 <=========================================================> (1547 / 1547) 100.00% Time: 00:06:52

[+] We found 4 plugins:

[+] Name: akismet
 |  Latest version: 3.3.4 
 |  Location: http://www.domain.com/wp-content/plugins/akismet/

[!] We could not determine a version so all vulnerabilities are printed out

[!] Title: Akismet 2.5.0-3.1.4 - Unauthenticated Stored Cross-Site Scripting (XSS)
    Reference: https://wpvulndb.com/vulnerabilities/8215
    Reference: http://blog.akismet.com/2015/10/13/akismet-3-1-5-wordpress/
    Reference: https://blog.sucuri.net/2015/10/security-advisory-stored-xss-in-akismet-wordpress-plugin.html
[i] Fixed in: 3.1.5

[+] Name: newsletter
 |  Latest version: 5.0.6 
 |  Location: http://www.domain.com/wp-content/plugins/newsletter/

[!] We could not determine a version so all vulnerabilities are printed out

[!] Title: Newsletter <= 3.0.8 - SQL Injection
    Reference: https://wpvulndb.com/vulnerabilities/6729
[i] Fixed in: 3.0.9

[!] Title: Newsletter <= 3.2.6 - Cross-Site Scripting (XSS)
    Reference: https://wpvulndb.com/vulnerabilities/6730
    Reference: http://packetstormsecurity.com/files/121634/
    Reference: http://www.securityfocus.com/bid/59856/
    Reference: http://www.zeroscience.mk/en/vulnerabilities/ZSL-2013-5141.php
    Reference: https://secunia.com/advisories/53398/
[i] Fixed in: 3.2.7

[!] Title: Newsletter 3.7.0 - Open Redirect
    Reference: https://wpvulndb.com/vulnerabilities/7868
    Reference: https://research.g0blin.co.uk/g0blin-00039/
    Reference: https://plugins.trac.wordpress.org/changeset/1190491/newsletter
[i] Fixed in: 3.8.3

[+] Name: tdo-mini-forms - v0.12.7
 |  Location: http://www.domain.com/wp-content/plugins/tdo-mini-forms/
 |  Readme: http://www.domain.com/wp-content/plugins/tdo-mini-forms/Readme.txt

[!] Title: TDO Mini Forms 0.13.9 - tdomf-upload-inline.php File Upload Remote Code Execution
    Reference: https://wpvulndb.com/vulnerabilities/7041
    Reference: http://packetstormsecurity.com/files/124352/

[+] Name: wp-shopping-cart - v3.6.7
 |  Location: http://www.domain.com/wp-content/plugins/wp-shopping-cart/
 |  Readme: http://www.domain.com/wp-content/plugins/wp-shopping-cart/readme.txt

[!] Title: e-Commerce <= 3.4 - Arbitrary File Upload Exploit
    Reference: https://wpvulndb.com/vulnerabilities/6480
    Reference: https://www.exploit-db.com/exploits/6867/

[+] Enumerating installed themes (only ones with known vulnerabilities) ...

   Time: 00:01:00 <===========================================================> (283 / 283) 100.00% Time: 00:01:00

[+] We found 1 themes:

[+] Name: more
 |  Location: http://www.domain.com/wp-content/themes/more/
 |  Style URL: http://www.domain.com/wp-content/themes/more/style.css

[!] We could not determine a version so all vulnerabilities are printed out

[!] Title: Multiple Themes - PrettyPhoto DOM XSS
    Reference: https://wpvulndb.com/vulnerabilities/7388
    Reference: http://www.rafayhackingarticles.net/2013/05/kali-linux-dom-based-xss-writeup.html
    Reference: http://packetstormsecurity.com/files/124960/
    Reference: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-6837
    Reference: https://secunia.com/advisories/54924/
    Reference: https://secunia.com/advisories/56583/

[+] Enumerating timthumb files ...

   Time: 00:09:09 <=========================================================> (2541 / 2541) 100.00% Time: 00:09:09

[+] No timthumb files found

[+] Enumerating usernames ...
[+] Identified the following 3 user/s:
    +----+-------------------+-------------------+
    | Id | Login             | Name              |
    +----+-------------------+-------------------+
    | 1  | admin             | admin             |
    | 5  | bullys            | Bullys            |
    | 6  | Contributer       | tdomf_71060       |
    +----+-------------------+-------------------+
[!] Default first WordPress username 'admin' is still used

[+] Finished: Sat Sep 16 09:29:49 2017
[+] Requests Done: 4514
[+] Memory used: 102.609 MB
[+] Elapsed time: 00:18:53

Using WPScan we can find installed plugins and themes and search for exploits according to those plugins and themes. After that we’re gonna start with metasploit and try to exploit through those vulnerabilities . I’m not going to attack on public sites this article is for education purpose only.

Let’s Start with Metasploit.

msf > search wordpress

How To Scan And Exploit WordPress Website Using WPScan And Metasploit

There’s tons of exploits if you search in metasploit, After searching for installed themes and plugins using WPScan you can search those in metasploit and easily can exploit and get shell.

Back to top button
Close