Julian Klewes

How to harden your Wordpress install (ssh)

Tagged

Categorized
Dated 4 months ago






Times read: 521
Read today: 5
Read last: March 9, 2010

How to harden your Wordpress install (ssh)

popup tail

I figured out how to harden wordpress using ssh and some common sense.

I changed ownership (user) of the cache and uploads folder to apache by

chown apache uploads
chown apache cache

to enable apache to write to it

chmod was set to more restrictive value of 755 each instead of easily
exploitable (as it happened on solarvps and zone.net) chmod 777

chmod 755 uploads
chmod 755 cache

giving me the following structure

ls -l /wp-content/

drwxr-xr-x 2 apache psacln 60416 May 3 05:39 cache
-rw-r--r-- 1 comh4x3d psacln 30 Nov 14 03:26 index.php
drwxr-xr-x 83 comh4x3d psacln 3072 Apr 17 12:48 plugins
drwxr-xr-x 9 comh4x3d psacln 1024 Apr 17 12:37 themes
drwxr-xr-x 5 comh4x3d psacln 1024 Mar 25 07:04 upgrade
drwxr-xr-x 3 apache psacln 8192 May 3 05:38 uploads

by that wordpress can upload files to the uploads folder and files can
be created in the cache folder.

to restrict the folders even more I added a
.htaccess file with chmod 644 each

vi .htaccess

for uploads:

Deny from all
Allow from 72.249.95.104 # server IP address

Options -ExecCGI # disallow execution of below files
AddHandler cgi-scriptscript .php .pl .py .jsp .asp .htm .shtml .sh .cgi
# we dont want any dodgy pearl scripts or php to executed

Order Allow,Deny
Deny from all
# deny everything but the
image and text files
Allow from all

# deny
opening those files
Order Allow,Deny
Deny from all

similar file for the cache folder, but instead of the image and doc
files only meta and html are allowed, make sure to remove html from
execcgi line

I hope you appreciate this article,

best,
julian klewes
h4×3d.com


People asked me to put up a donate button or something similar, so here it is: if you care to buy me a beer or Red Bull (I drink the Dutch equivalent called Spam Energy), feel free to donate, anything is appreciated!



h4x3d.com does not host any illegal content. Links/Files referred to are for educational purposes only.

Interact - Leave a comment

Engage in the conversion and leave a comment.
I would much love to hear from you. Please note however that comments are moderated by default. Advertising and rant is welcomed, yet often discarded...
See left/right for additional information













comment? jump to the form



archives | sitemap
contact | tos

Top

lorem

solarVPS.com - reliale enterprise hosting
you know the game, get in touch with me
3