Security of WordPress
A guide by Nedko Hristov
About me
We’re hiring
Secret requirements:
Be awesome
Be great table tennis player
Be the best Mortal kombat player alive
Appendix
Overall security
Backups
Updates
etc
Platform security
Core
Plugins
Themes
System security
OS
Apache/nginx
PHP, etc
Platform security
Install plugins only if needed;
Note - Inactive plugins/themes are vulnerable too (using direct file access method).
Platform security
Don't install nulled plugins/themes
Platform security
Install with different that default (wp_) prefix (to avoid some SQL injections);
Rename WordPress default prefix can be vital in case of SQL injection. Attacker can create valid admin user/post or anything he wants to (depends of the vulnerability).
Platform security
File privileges;
Database privileges (select/ delete/ insert/ update);
WordPress users;
Files and directories permissions (755 for directories, 644 for files, 600 for wp-config.php);
FTP access (plugins, third party contractors).
Platform security
User enumeration is one of the most user attack vectors.
This method use author functionality (?author=x) to find all users. Try with https://nedko.info/?author=1 and you’ll find my username and user ID.
Platform security
Even not using passwords like 1234 will not assure you from bruteforce attacks.
Why?
Platform security
�Tool - wpscan, dictionary - darc0de
Target - https://nedko.info/old_wp/
Attack vectors - information disclosure, scan for outdated core/plugins/themes, user enumeration, bruteforce dictionary attack.
Result:
+----+-------+---------------------+----------------------+
| Id | Login | Name | Password |
+----+-------+---------------------+----------------------+
| 1 | nedko | nedko – Testing old | password123!@# |
+----+-------+---------------------+----------------------+
System security
System security
Manual system scan
Scan for suspicious strings like base64_decode and shell_exec;
Search php files in the Uploads Directory (find ./wp-content/uploads -name "*.php" -print)
Search for files with 777
find / -type f -perm 0777
Change files permissions from 777 to 755 automatically
find /path/to/search -perm 777 -print -exec chmod 755 {} \;
System security
System security
Find wp-config.php_old
inurl:wp-config.php_old
Find database
inurl:"/wp-content/wpclone-temp/wpclone_backup/"
Find files with SQL extention and containing wp_users
filetype:sql intext:wp_users phpmyadmin
nginx/apache bruteforce protection
/etc/nginx/sites-available/nedko.info
limit_req_zone $binary_remote_addr zone=one:1m rate=5r/s;
location = /old_wp/wp-login.php {
limit_req zone=one burst=1 nodelay;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
}
Proof of Concept
Overall security
Contact me