SlideShare uma empresa Scribd logo
1 de 75
WordCamp UK 2014
How to Secure your
WordPress Website
Mike Pead
www.primaryimage.com
About Me!
 Web design for 15 years
 Based in Essex & London
 Founded Primary Image
in 2010
 Mainly work with
small/medium sized
businesses
2
About Me!
 Manage WordPress hosting
for clients
 100% WordPress
 Handle all their security,
including WordPress
updates
3
 Why worry about
WordPress security?
 Steps you can take to
secure your site…
Today’s Talk
? Why is WordPress vulnerable?
% of WordPress Usage
23
60
All Websites CMS Websites
%
That’s over 70 million
websites in the world!
Half are self-hosted.
Only a fraction of
sites change from
the default
configuration.
6
1
2
3
%
! = WordPress is an attractive
target to hackers due to its
popularity – a victim of its
own success!
? So why did I get interested
in WordPress security?
Most attacks are automated
(i.e. bots)!
Analysis by Wordfence
Looked at 26 million
"page not found“
reports from
30,000
websites
15
Bot URL requests
• 4th place: 102,800 requests: /wp-login.php
• 7th place: 31,800 requests: /wp-login.php?action=register
• 10th place: 24,000 requests: /wp-comments-post.php
• 11th place: 22,300 requests: /administrator/
• 23rd place: 14,200 requests: /wp-content/themes/GeoPlaces/monetize/
• 45th place: 8,500 requests: /author=1
Source: http://www.wordfence.com/blog/2014/05/top-100-page-not-found-errors-for-wordpress/
16
Bot URL requests
17
?
So what does a botnet
attack look like?
Consequences of an attack…
19
Website
becomes
inaccessible
Lose
brand
reputation
Lose SEO /
become
blacklisted
20
So is WordPress Secure?
21
• YES IT IS!
• And trusted by some
of the biggest names
in the world:
Are you sure it’s secure?
• Most vulnerabilities are found in plugins and
hosting environment, not the WordPress core.
• WordPress is extremely good (& quick) at
rolling out security fixes when issues are
found.
• Many techniques used to attack WordPress
could be applied to other types of CMS too.
22
But there are precautions you
can take to secure your site …!
And the WordPress Codex
itself gives some tips:
http://codex.wordpress.org/
Hardening_WordPress
!
? What simple steps can I
take to secure my site?
01 Keep WordPress updated
• WHY? WordPress is open-source – means
anyone can see what vulnerabilities have been
fixed between versions.
• HOW?
 One-click upgrades are easy, quick &
reliable.
• Today you should all be using WordPress 3.9.1.
26
01 Keep WordPress updated
• Survey of 350+ NHS WordPress websites:
27
Source: Terence Eden
http://shkspr.mobi/blog/2014/03/2000-nhs-security/vulnerabilities-disclosed/
01 Keep WordPress updated
• I alerted the Trade & Investment (UKTI) Government
department in March they were
using WP 3.4.2 for their blog:
– released in 2012
– 9 security updates had been
issued
28
02 Keep plugins updated
• WHY? Can be a big hole for allowing attacks.
• HOW?
 If running multiple sites, use a service
such as WP Remote (free) to check and
install plugin updates in one dashboard.
–How often do you check & install plugin
updates?
29
03 Only use trusted plugins
• WHY? Not all plugins can be trusted!
• HOW?
 Get the plugin from wordpress.org or a
trusted source.
 How many downloads / reviews has it got?
 When was it last updated?
30
04 Only use trusted themes
• WHY? Themes can have poorly written code,
or worse – purposely malicious code included.
• HOW?
 Get the theme from a trusted source.
 Examine the code yourself.
 Be aware of Base64 code:
TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGh
pcyByZWFzb24sIGJ1dCBieSB0aGlzmd1aXNoZWQsIG5vdCft
31
05 Choose a secure password
• WHY? Brute force attacks mainly rely on using
dictionary words.
• HOW?
 Use characters, numbers, capitals, etc.
 Use a unique password, don’t use the same
for every login on the internet!
 Change it regularly, at least every 3 months.
 Make sure other users also have strong passwords.
 This includes your FTP, cPanel & other passwords too!
32
06 No “admin” usernames
• WHY? Any element of predictability gives
hackers an edge. Bots will try this first!
• HOW?
 Setup a new admin account with a
unique username.
 Delete the existing admin account.
33
07 You need decent hosting
• WHY? Attacks can exploit vulnerabilities at a
server-level. Don’t let your hosting account be
the weak link.
• HOW?
 Choose a reputable host, perhaps those
that specialise in WordPress.
 Budget hosts may not always have their
focus on security.
34
08 Keep regular backups!
• WHY? If the worst comes to the worst, have a
clean backup you can restore to!
• HOW?
 Download a copy to your
computer.
 Use an external service,
e.g. myRepono.
 Frequency to depend on
how often your site is updated!
35
? Want more powerful steps to
secure your WordPress site…
09 Restrict login attempts
• WHY? Detect and block brute force attacks.
• HOW?
 Install a plugin
such as iThemes
Security.
37
09 Restrict login attempts
38
• Setup differently depending on whether it’s just you or
members of the public logging-in!
09 Restrict login attempts
• BUT THERE ARE FLAWS
IN THIS METHOD:
Botnet attacks can
come from 1000s of
IP addresses.
39
09 Restrict login attempts
• How about BruteProtect? It logs every failed
attempt community-wide.
Botnet attacks can come from 1000s of IP
addresses.
40
10 Switch on SSL encryption
• WHY? Secures
the traffic between
the server and your
computer, inc. your
password.
• HOW?
 Buy an SSL certificate from your host.
 Force WP-Admin SSL in iThemes Security.
41
11 Obscurity
• WHY? Make it harder for bots to scan for your
WordPress version.
• HOW?
42
12 Change your database prefix
• WHY? Default MySQL tables easy to guess.
• HOW? Use iThemes Security or Change Database Prefix
43
404 detection blocking
“Away mode”
Set “allow” IP addresses
Changing directory URLs as
they can break plugins
Automatic edits to key files
Enforcing strong passwords
for subscribers
Blocking whole countries
Things I don’t recommend:
• WHY? Provides another
hurdle for unauthorised
users trying to login.
• HOW?
 Google Authenticator
45
13 Two-Factor Authentication
14 Monitor what’s happening
• WHY? If you have a multi-author site, check
what they’re doing!
• HOW? Plainview Activity Monitor
46
.htaccess file
15 Block access to system files
• WHY? You don’t want
prying eyes looking at
these sensitive files!
• HOW?
 Add some rules to your .htaccess file.
48
15 Block access to system files
# protect files
<files wp-config.php>
Order deny,allow
Deny from all
</files>
<files readme.html>
Order allow,deny
Deny from all
</files>
50
<files license.txt>
Order allow,deny
Deny from all
</files>
<files install.php>
Order allow,deny
Deny from all
</files>
<files error_log>
Order allow,deny
Deny from all
</files>
15 Block access to system files
Recommended on the WordPress Codex:
# Block the include-only files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
51
16 Build your own firewall
• WHY? Stop dodgy requests from even
reaching your WordPress installation
– block them at server level.
• HOW?
 Again, add some rules to the .htaccess file.
52
16 Build your own firewall
Extract from 5G Blacklist
(http://perishablepress.com/5g-blacklist-2013)
# 5G:[QUERY STRINGS]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} ("|%22).*(<|>|%3) [NC,OR]
RewriteCond %{QUERY_STRING} (javascript:).*(;) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR]
RewriteCond %{QUERY_STRING} (|../|`|='$|=%27$) [NC,OR]
RewriteCond %{QUERY_STRING}
(;|'|"|%22).*(union|select|insert|drop|update|md5|benchmark|or|and|if) [NC,OR]
RewriteCond %{QUERY_STRING} (base64_encode|localhost|mosconfig) [NC,OR]
RewriteCond %{QUERY_STRING} (boot.ini|echo.*kae|etc/passwd) [NC,OR]
RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|[|%) [NC]
RewriteRule .* - [F]
</IfModule>
53
16 Build your own firewall
<IfModule mod_alias.c>
RedirectMatch 403 (https?|ftp|php)://
RedirectMatch 403 /(https?|ima|ucp)/
RedirectMatch 403 /(Permanent|Better)$
RedirectMatch 403 (='|=%27|/'/?|).css()$
RedirectMatch 403 (,|)+|/,/|{0}|(/(|...|+++|||"")
RedirectMatch 403 .(cgi|asp|aspx|cfg|dll|exe|jsp|mdb|sql|ini|rar)$
RedirectMatch 403 /(contac|fpw|install|pingserver|register).php$
RedirectMatch 403 (base64|crossdomain|localhost|wwwroot|e107_)
RedirectMatch 403 (eval(|_vti_|(null)|echo.*kae|config.xml)
RedirectMatch 403 .well-known/host-meta
RedirectMatch 403 /function.array-rand
RedirectMatch 403 );$(this).html(
RedirectMatch 403 proc/self/environ
RedirectMatch 403 msnbot.htm)._
RedirectMatch 403 /ref.outcontrol
RedirectMatch 403 com_cropimage
RedirectMatch 403 indonesia.htm
RedirectMatch 403 {$itemURL}
RedirectMatch 403 function()
RedirectMatch 403 labels.rdf
RedirectMatch 403 /playing.php
RedirectMatch 403 muieblackcat
</IfModule>
54
More…!
16 Build your own firewall
RewriteCond %{HTTP_USER_AGENT} (havij|libwww-perl|wget|python|nikto|curl|scan|java|winhttp|clshttp|loader)[NC,OR]
RewriteCond %{HTTP_USER_AGENT} (%0A|%0D|%3C|%3E|%00)[NC,OR]
RewriteCond %{HTTP_USER_AGENT} (;|<|>|'|"|)|(|%0A|%0D|%22|%27|%28|%3C|%3E|%00).*(libwww-perl|wget|python|nikto|curl|scan|java|winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner)[NC,OR]
RewriteCond %{THE_REQUEST} (?|*|%2a)+(%20+|s+|%20+s+|s+%20+|s+%20+s+)HTTP(:/|/)[NC,OR]
RewriteCond %{THE_REQUEST} etc/passwd[NC,OR]
RewriteCond %{THE_REQUEST} cgi-bin [NC,OR]
RewriteCond %{THE_REQUEST} (%0A|%0D|r|n)[NC,OR]
RewriteCond %{REQUEST_URI} owssvr.dll [NC,OR]
RewriteCond %{HTTP_REFERER} (%0A|%0D|%3C|%3E|%00)[NC,OR]
RewriteCond %{HTTP_REFERER} .opendirviewer.[NC,OR]
RewriteCond %{HTTP_REFERER} users.skynet.be.* [NC,OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http://[NC,OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(..//?)+ [NC,OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC,OR]
RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC,OR]
RewriteCond %{QUERY_STRING} (../|%2e%2e%2f|%2e%2e/|..%2f|%2e.%2f|%2e./|.%2e%2f|.%2e/)[NC,OR]
RewriteCond %{QUERY_STRING} ftp: [NC,OR]
RewriteCond %{QUERY_STRING} http:[NC,OR]
RewriteCond %{QUERY_STRING} https: [NC,OR]
RewriteCond %{QUERY_STRING} =|w| [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)/self/(.*)$ [NC,OR]
RewriteCond %{QUERY_STRING} ^(.*)cPath=http://(.*)$[NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E)[NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*embed.*(>|%3E)[NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^e]*e)+mbed.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*object.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^o]*o)+bject.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C).*iframe.*(>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} (<|%3C)([^i]*i)+frame.*(>|%3E)[NC,OR]
RewriteCond %{QUERY_STRING} base64_encode.*(.*)[NC,OR]
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*([^)]*)[NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2})[OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})[OR]
RewriteCond %{QUERY_STRING} ^.*((|)|<|>|%3c|%3e).*[NC,OR]
RewriteCond %{QUERY_STRING} ^.*(x00|x04|x08|x0d|x1b|x20|x3c|x3e|x7f).* [NC,OR]
RewriteCond %{QUERY_STRING} (NULL|OUTFILE|LOAD_FILE) [OR]
RewriteCond %{QUERY_STRING} (.{1,}/)+(motd|etc|bin)[NC,OR]
RewriteCond %{QUERY_STRING} (localhost|loopback|127.0.0.1)[NC,OR]
RewriteCond %{QUERY_STRING} (<|>|%0A|%0D|%3C|%3E|%00)[NC,OR]
RewriteCond %{QUERY_STRING} concat[^(]*([NC,OR]
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} -[sdcr].*(allow_url_include|allow_url_fopen|safe_mode|disable_functions|auto_prepend_file) [NC,OR]
RewriteCond %{QUERY_STRING} (;|<|>|'|"|)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/*|union|select|insert|drop|delete|update|cast|create|char|convert|alter|declare|order|script|set|md5|benchmark|encode)[NC,OR]
RewriteCond %{QUERY_STRING} (sp_executesql)[NC]
RewriteRule ^(.*)$ - [F,L]
# END BPSQSE BPS QUERY STRING EXPLOITS
55
BulletProof Security adds 43 lines of rules to the .htaccess file!
16 Build your own firewall
• CHECK OUT…
 The 5G 2013 list: http://perishablepress.com/5g-
blacklist-2013/
 The htaccess file generated by
BulletProof Security
 WordPress Codex
56
17 Hide the .htaccess file itself!
• HOW?
# STRONG HTACCESS PROTECTION
<Files ~ "^.*.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</Files>
57
18 Protect your WP-Admin area
• Problem with login limits plugins:
–Query database for every request
–Run a lot of server processes
–Fill up your MySQL database
58
18 Protect your WP-Admin area
59
WP-Admin
MySQL Database
18 Protect your WP-Admin area
STEP 1: Use your hosting control panel to
password protect the WP-Admin
directory
60
18 Protect your WP-Admin area
End up with this:
61
18 Protect your WP-Admin area
• STEP 2: New htaccess file in the WP-Admin folder:
AuthType basic
AuthUserFile "/home/example.co.uk/wp-admin//.htpasswd"
AuthGroupFile /dev/null
AuthName "ENTER YOUR LOGIN DETAILS"
Require valid-user
<Files admin-ajax.php>
Order allow,deny
Allow from all
Satisfy any
</Files>
ErrorDocument 401 /401error.html
62
18 Protect your WP-Admin area
• STEP 3: Add this to your root htaccess:
<Files wp-login.php>
AuthType Basic
AuthUserFile "/home/example.co.uk/wp-admin//.htpasswd"
AuthGroupFile /dev/null
AuthName "ENTER YOUR LOGIN DETAILS"
Require valid-user
</Files>
ErrorDocument 401 /401error.html
63
18 Protect your WP-Admin area
64
Presented to the user:
18 Protect your WP-Admin area
65
Create a custom 401 error page:
18 Protect your WP-Admin area
• Benefits:
–Blocks bad bots at server-level
–Less server resources needed than firing up
WordPress
–Works ok with public logins if using a front-
end login form (e.g. ‘Theme My Login’
plugin with the front-end widget)
66
19 Block PHP in Uploads folder
• WHY? Uploads folder can be used by other users.
• HOW?
 Create a .htaccess file in the
WP-Content/Uploads folder, with the following:
<Files *.php>
Deny from All
</Files>
67
20 Tighten PHP configuration
• WHY? Helps block PHP code injection
vulnerabilities caused by bad input filtering.
• HOW?
 Add a php.ini file in your root directory and
paste in some code…
68
20 Tighten PHP configuration
; Disable allow_url_fopen in php.ini for security reasons
allow_url_fopen = Off
; Disable allow_url_include in php.ini for security reasons
allow_url_include = Off
; Disable display_errors in php.ini for security reasons
display_errors = Off
log_errors = On
69
21 Create your own encryption keys
• WHY? Makes an attackers job harder.
• HOW?
 Open up wp-config.php, scroll down to
“Authentication Unique Keys and Salts”.
 Generate your own keys at:
https://api.wordpress.org/secret-key/1.1/salt/
70
22 Move WP-Config location
• WHY? Take wp-config.php out of a publicly
accessible location.
• HOW? Move it one level up, outside of your
public_html folder:
71
23 Folder permissions
• WHY? Can be a security hole if permissions
are not strong enough.
• HOW?
 Use your FTP software’s
CHMOD feature.
72
23 Folder permissions
 All folders should have a CHMOD of 755.
 All "wp-" PHP files = 644.
 wp-config.php = 640.
 htaccess files = 644.
 robot.txt = 755.
 sitemap.xml = 666.
73
Don’t forget the basics:
• Keep WordPress and your plugins updated.
• Have a secure password.
• Get decent quality hosting.
www.primaryimage.com
Twitter: @primaryimage
Also find us on Facebook,
Google+ & LinkedIn

Mais conteúdo relacionado

Mais procurados

WordPress Security Essentials WordCamp Denver 2012
WordPress Security Essentials WordCamp Denver 2012WordPress Security Essentials WordCamp Denver 2012
WordPress Security Essentials WordCamp Denver 2012
Angela Bowman
 
An example of cms - wordpress
An example of cms - wordpressAn example of cms - wordpress
An example of cms - wordpress
Eunus Hosen
 

Mais procurados (20)

8 Most Popular Joomla Hacks & How To Avoid Them
8 Most Popular Joomla Hacks & How To Avoid Them8 Most Popular Joomla Hacks & How To Avoid Them
8 Most Popular Joomla Hacks & How To Avoid Them
 
WordPress Security Tips
WordPress Security TipsWordPress Security Tips
WordPress Security Tips
 
Secrets to a Hack-Proof Joomla Revealed
Secrets to a Hack-Proof Joomla RevealedSecrets to a Hack-Proof Joomla Revealed
Secrets to a Hack-Proof Joomla Revealed
 
Locking down word press
Locking down word pressLocking down word press
Locking down word press
 
The Ultimate Guide to Wordpress Security
The Ultimate Guide to Wordpress SecurityThe Ultimate Guide to Wordpress Security
The Ultimate Guide to Wordpress Security
 
Tips to improve word press security ppt
Tips to improve word press security pptTips to improve word press security ppt
Tips to improve word press security ppt
 
How secure is WordPress ?
How secure is WordPress ?How secure is WordPress ?
How secure is WordPress ?
 
HOW TO PROTECT YOUR WORDPRESS WEBSITE FROM HACKERS
HOW TO PROTECT YOUR WORDPRESS WEBSITE FROM HACKERSHOW TO PROTECT YOUR WORDPRESS WEBSITE FROM HACKERS
HOW TO PROTECT YOUR WORDPRESS WEBSITE FROM HACKERS
 
Why wordpress is not completely safe
Why wordpress is not completely safeWhy wordpress is not completely safe
Why wordpress is not completely safe
 
WordPress Security Essentials WordCamp Denver 2012
WordPress Security Essentials WordCamp Denver 2012WordPress Security Essentials WordCamp Denver 2012
WordPress Security Essentials WordCamp Denver 2012
 
Dan Catalin Vasile - Defcamp2013 - Does it pay to be a blackhat hacker
Dan Catalin Vasile - Defcamp2013 - Does it pay to be a blackhat hackerDan Catalin Vasile - Defcamp2013 - Does it pay to be a blackhat hacker
Dan Catalin Vasile - Defcamp2013 - Does it pay to be a blackhat hacker
 
An example of cms - wordpress
An example of cms - wordpressAn example of cms - wordpress
An example of cms - wordpress
 
WordPress Security Implementation Guideline - Presentation for OWASP Romania ...
WordPress Security Implementation Guideline - Presentation for OWASP Romania ...WordPress Security Implementation Guideline - Presentation for OWASP Romania ...
WordPress Security Implementation Guideline - Presentation for OWASP Romania ...
 
WordPress Security WordCamp OC 2013
WordPress Security WordCamp OC 2013WordPress Security WordCamp OC 2013
WordPress Security WordCamp OC 2013
 
RUNNING A SECURITY CHECK FOR YOUR WORDPRESS SITE
RUNNING A SECURITY CHECK FOR YOUR WORDPRESS SITERUNNING A SECURITY CHECK FOR YOUR WORDPRESS SITE
RUNNING A SECURITY CHECK FOR YOUR WORDPRESS SITE
 
Securing Word Press Blog
Securing Word Press BlogSecuring Word Press Blog
Securing Word Press Blog
 
The moment my site got hacked - WordCamp Sofia
The moment my site got hacked - WordCamp SofiaThe moment my site got hacked - WordCamp Sofia
The moment my site got hacked - WordCamp Sofia
 
Managing WordPress
Managing WordPressManaging WordPress
Managing WordPress
 
Basic Plugin Recommendations to get your WordPress Website Started
Basic Plugin Recommendations to get your WordPress Website StartedBasic Plugin Recommendations to get your WordPress Website Started
Basic Plugin Recommendations to get your WordPress Website Started
 
Word campktm speed-security
Word campktm speed-securityWord campktm speed-security
Word campktm speed-security
 

Semelhante a How to Secure your WordPress Website - WordCamp UK 2014

How To Lock Down And Secure Your Wordpress
How To Lock Down And Secure Your WordpressHow To Lock Down And Secure Your Wordpress
How To Lock Down And Secure Your Wordpress
Chelsea O'Brien
 
Word Camp Ph 2009 Word Press In The Wild
Word Camp Ph 2009   Word Press In The WildWord Camp Ph 2009   Word Press In The Wild
Word Camp Ph 2009 Word Press In The Wild
rebelpixel
 
Joomla Security Simplified —  Seven Easy Steps For a More Secure Website
Joomla Security Simplified — Seven Easy Steps For a More Secure WebsiteJoomla Security Simplified — Seven Easy Steps For a More Secure Website
Joomla Security Simplified —  Seven Easy Steps For a More Secure Website
Imperva Incapsula
 
WordCamp Philippines 2009: WordPress In The Wild
WordCamp Philippines 2009: WordPress In The WildWordCamp Philippines 2009: WordPress In The Wild
WordCamp Philippines 2009: WordPress In The Wild
rebelpixel
 

Semelhante a How to Secure your WordPress Website - WordCamp UK 2014 (20)

2014 WordCamp Austin: Do's and Don'ts of WordPress Multisite
2014 WordCamp Austin: Do's and Don'ts of WordPress Multisite2014 WordCamp Austin: Do's and Don'ts of WordPress Multisite
2014 WordCamp Austin: Do's and Don'ts of WordPress Multisite
 
Protect Your WordPress From The Inside Out
Protect Your WordPress From The Inside OutProtect Your WordPress From The Inside Out
Protect Your WordPress From The Inside Out
 
WordPress security
WordPress securityWordPress security
WordPress security
 
WordPress Site Management - Keeping Your Creation Happy, Healthy and Secure
WordPress Site Management - Keeping Your Creation Happy, Healthy and SecureWordPress Site Management - Keeping Your Creation Happy, Healthy and Secure
WordPress Site Management - Keeping Your Creation Happy, Healthy and Secure
 
Responsible [digital] Home Ownership
Responsible [digital] Home OwnershipResponsible [digital] Home Ownership
Responsible [digital] Home Ownership
 
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
 
How To Lock Down And Secure Your Wordpress
How To Lock Down And Secure Your WordpressHow To Lock Down And Secure Your Wordpress
How To Lock Down And Secure Your Wordpress
 
Word Camp Ph 2009 Word Press In The Wild
Word Camp Ph 2009   Word Press In The WildWord Camp Ph 2009   Word Press In The Wild
Word Camp Ph 2009 Word Press In The Wild
 
Joomla Security Simplified —  Seven Easy Steps For a More Secure Website
Joomla Security Simplified — Seven Easy Steps For a More Secure WebsiteJoomla Security Simplified — Seven Easy Steps For a More Secure Website
Joomla Security Simplified —  Seven Easy Steps For a More Secure Website
 
Staying Connected: Securing Your WordPress Website
Staying Connected: Securing Your WordPress WebsiteStaying Connected: Securing Your WordPress Website
Staying Connected: Securing Your WordPress Website
 
WordPress Hardening: Strategies to Secure & Protect Your Website
WordPress Hardening: Strategies to Secure & Protect Your WebsiteWordPress Hardening: Strategies to Secure & Protect Your Website
WordPress Hardening: Strategies to Secure & Protect Your Website
 
Content Management System(CMS) & Basic WordPress
Content Management System(CMS) & Basic WordPressContent Management System(CMS) & Basic WordPress
Content Management System(CMS) & Basic WordPress
 
WordPress Resources Nov 2014
WordPress Resources Nov 2014WordPress Resources Nov 2014
WordPress Resources Nov 2014
 
WordPress Security Presentation
WordPress Security PresentationWordPress Security Presentation
WordPress Security Presentation
 
Seravo.com: WordPress Security 101
Seravo.com: WordPress Security 101Seravo.com: WordPress Security 101
Seravo.com: WordPress Security 101
 
WordCamp Philippines 2009: WordPress In The Wild
WordCamp Philippines 2009: WordPress In The WildWordCamp Philippines 2009: WordPress In The Wild
WordCamp Philippines 2009: WordPress In The Wild
 
WordPress Security and Best Practices
WordPress Security and Best PracticesWordPress Security and Best Practices
WordPress Security and Best Practices
 
Introduction to WordPress Security
Introduction to WordPress SecurityIntroduction to WordPress Security
Introduction to WordPress Security
 
Setup and run wordpress: 201
Setup and run wordpress: 201Setup and run wordpress: 201
Setup and run wordpress: 201
 
WordPress security 101 - WP Turku Meetup 2.2.2017
WordPress security 101 - WP Turku Meetup 2.2.2017WordPress security 101 - WP Turku Meetup 2.2.2017
WordPress security 101 - WP Turku Meetup 2.2.2017
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Último (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

How to Secure your WordPress Website - WordCamp UK 2014

  • 1. WordCamp UK 2014 How to Secure your WordPress Website Mike Pead www.primaryimage.com
  • 2. About Me!  Web design for 15 years  Based in Essex & London  Founded Primary Image in 2010  Mainly work with small/medium sized businesses 2
  • 3. About Me!  Manage WordPress hosting for clients  100% WordPress  Handle all their security, including WordPress updates 3
  • 4.  Why worry about WordPress security?  Steps you can take to secure your site… Today’s Talk
  • 5. ? Why is WordPress vulnerable?
  • 6. % of WordPress Usage 23 60 All Websites CMS Websites % That’s over 70 million websites in the world! Half are self-hosted. Only a fraction of sites change from the default configuration. 6 1 2 3 %
  • 7. ! = WordPress is an attractive target to hackers due to its popularity – a victim of its own success!
  • 8. ? So why did I get interested in WordPress security?
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. Most attacks are automated (i.e. bots)!
  • 15. Analysis by Wordfence Looked at 26 million "page not found“ reports from 30,000 websites 15
  • 16. Bot URL requests • 4th place: 102,800 requests: /wp-login.php • 7th place: 31,800 requests: /wp-login.php?action=register • 10th place: 24,000 requests: /wp-comments-post.php • 11th place: 22,300 requests: /administrator/ • 23rd place: 14,200 requests: /wp-content/themes/GeoPlaces/monetize/ • 45th place: 8,500 requests: /author=1 Source: http://www.wordfence.com/blog/2014/05/top-100-page-not-found-errors-for-wordpress/ 16
  • 18. ? So what does a botnet attack look like?
  • 19. Consequences of an attack… 19 Website becomes inaccessible Lose brand reputation Lose SEO / become blacklisted
  • 20. 20
  • 21. So is WordPress Secure? 21 • YES IT IS! • And trusted by some of the biggest names in the world:
  • 22. Are you sure it’s secure? • Most vulnerabilities are found in plugins and hosting environment, not the WordPress core. • WordPress is extremely good (& quick) at rolling out security fixes when issues are found. • Many techniques used to attack WordPress could be applied to other types of CMS too. 22
  • 23. But there are precautions you can take to secure your site …!
  • 24. And the WordPress Codex itself gives some tips: http://codex.wordpress.org/ Hardening_WordPress !
  • 25. ? What simple steps can I take to secure my site?
  • 26. 01 Keep WordPress updated • WHY? WordPress is open-source – means anyone can see what vulnerabilities have been fixed between versions. • HOW?  One-click upgrades are easy, quick & reliable. • Today you should all be using WordPress 3.9.1. 26
  • 27. 01 Keep WordPress updated • Survey of 350+ NHS WordPress websites: 27 Source: Terence Eden http://shkspr.mobi/blog/2014/03/2000-nhs-security/vulnerabilities-disclosed/
  • 28. 01 Keep WordPress updated • I alerted the Trade & Investment (UKTI) Government department in March they were using WP 3.4.2 for their blog: – released in 2012 – 9 security updates had been issued 28
  • 29. 02 Keep plugins updated • WHY? Can be a big hole for allowing attacks. • HOW?  If running multiple sites, use a service such as WP Remote (free) to check and install plugin updates in one dashboard. –How often do you check & install plugin updates? 29
  • 30. 03 Only use trusted plugins • WHY? Not all plugins can be trusted! • HOW?  Get the plugin from wordpress.org or a trusted source.  How many downloads / reviews has it got?  When was it last updated? 30
  • 31. 04 Only use trusted themes • WHY? Themes can have poorly written code, or worse – purposely malicious code included. • HOW?  Get the theme from a trusted source.  Examine the code yourself.  Be aware of Base64 code: TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGh pcyByZWFzb24sIGJ1dCBieSB0aGlzmd1aXNoZWQsIG5vdCft 31
  • 32. 05 Choose a secure password • WHY? Brute force attacks mainly rely on using dictionary words. • HOW?  Use characters, numbers, capitals, etc.  Use a unique password, don’t use the same for every login on the internet!  Change it regularly, at least every 3 months.  Make sure other users also have strong passwords.  This includes your FTP, cPanel & other passwords too! 32
  • 33. 06 No “admin” usernames • WHY? Any element of predictability gives hackers an edge. Bots will try this first! • HOW?  Setup a new admin account with a unique username.  Delete the existing admin account. 33
  • 34. 07 You need decent hosting • WHY? Attacks can exploit vulnerabilities at a server-level. Don’t let your hosting account be the weak link. • HOW?  Choose a reputable host, perhaps those that specialise in WordPress.  Budget hosts may not always have their focus on security. 34
  • 35. 08 Keep regular backups! • WHY? If the worst comes to the worst, have a clean backup you can restore to! • HOW?  Download a copy to your computer.  Use an external service, e.g. myRepono.  Frequency to depend on how often your site is updated! 35
  • 36. ? Want more powerful steps to secure your WordPress site…
  • 37. 09 Restrict login attempts • WHY? Detect and block brute force attacks. • HOW?  Install a plugin such as iThemes Security. 37
  • 38. 09 Restrict login attempts 38 • Setup differently depending on whether it’s just you or members of the public logging-in!
  • 39. 09 Restrict login attempts • BUT THERE ARE FLAWS IN THIS METHOD: Botnet attacks can come from 1000s of IP addresses. 39
  • 40. 09 Restrict login attempts • How about BruteProtect? It logs every failed attempt community-wide. Botnet attacks can come from 1000s of IP addresses. 40
  • 41. 10 Switch on SSL encryption • WHY? Secures the traffic between the server and your computer, inc. your password. • HOW?  Buy an SSL certificate from your host.  Force WP-Admin SSL in iThemes Security. 41
  • 42. 11 Obscurity • WHY? Make it harder for bots to scan for your WordPress version. • HOW? 42
  • 43. 12 Change your database prefix • WHY? Default MySQL tables easy to guess. • HOW? Use iThemes Security or Change Database Prefix 43
  • 44. 404 detection blocking “Away mode” Set “allow” IP addresses Changing directory URLs as they can break plugins Automatic edits to key files Enforcing strong passwords for subscribers Blocking whole countries Things I don’t recommend:
  • 45. • WHY? Provides another hurdle for unauthorised users trying to login. • HOW?  Google Authenticator 45 13 Two-Factor Authentication
  • 46. 14 Monitor what’s happening • WHY? If you have a multi-author site, check what they’re doing! • HOW? Plainview Activity Monitor 46
  • 48. 15 Block access to system files • WHY? You don’t want prying eyes looking at these sensitive files! • HOW?  Add some rules to your .htaccess file. 48
  • 49.
  • 50. 15 Block access to system files # protect files <files wp-config.php> Order deny,allow Deny from all </files> <files readme.html> Order allow,deny Deny from all </files> 50 <files license.txt> Order allow,deny Deny from all </files> <files install.php> Order allow,deny Deny from all </files> <files error_log> Order allow,deny Deny from all </files>
  • 51. 15 Block access to system files Recommended on the WordPress Codex: # Block the include-only files. <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^wp-admin/includes/ - [F,L] RewriteRule !^wp-includes/ - [S=3] RewriteRule ^wp-includes/[^/]+.php$ - [F,L] RewriteRule ^wp-includes/js/tinymce/langs/.+.php - [F,L] RewriteRule ^wp-includes/theme-compat/ - [F,L] </IfModule> 51
  • 52. 16 Build your own firewall • WHY? Stop dodgy requests from even reaching your WordPress installation – block them at server level. • HOW?  Again, add some rules to the .htaccess file. 52
  • 53. 16 Build your own firewall Extract from 5G Blacklist (http://perishablepress.com/5g-blacklist-2013) # 5G:[QUERY STRINGS] <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} ("|%22).*(<|>|%3) [NC,OR] RewriteCond %{QUERY_STRING} (javascript:).*(;) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR] RewriteCond %{QUERY_STRING} (|../|`|='$|=%27$) [NC,OR] RewriteCond %{QUERY_STRING} (;|'|"|%22).*(union|select|insert|drop|update|md5|benchmark|or|and|if) [NC,OR] RewriteCond %{QUERY_STRING} (base64_encode|localhost|mosconfig) [NC,OR] RewriteCond %{QUERY_STRING} (boot.ini|echo.*kae|etc/passwd) [NC,OR] RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|[|%) [NC] RewriteRule .* - [F] </IfModule> 53
  • 54. 16 Build your own firewall <IfModule mod_alias.c> RedirectMatch 403 (https?|ftp|php):// RedirectMatch 403 /(https?|ima|ucp)/ RedirectMatch 403 /(Permanent|Better)$ RedirectMatch 403 (='|=%27|/'/?|).css()$ RedirectMatch 403 (,|)+|/,/|{0}|(/(|...|+++|||"") RedirectMatch 403 .(cgi|asp|aspx|cfg|dll|exe|jsp|mdb|sql|ini|rar)$ RedirectMatch 403 /(contac|fpw|install|pingserver|register).php$ RedirectMatch 403 (base64|crossdomain|localhost|wwwroot|e107_) RedirectMatch 403 (eval(|_vti_|(null)|echo.*kae|config.xml) RedirectMatch 403 .well-known/host-meta RedirectMatch 403 /function.array-rand RedirectMatch 403 );$(this).html( RedirectMatch 403 proc/self/environ RedirectMatch 403 msnbot.htm)._ RedirectMatch 403 /ref.outcontrol RedirectMatch 403 com_cropimage RedirectMatch 403 indonesia.htm RedirectMatch 403 {$itemURL} RedirectMatch 403 function() RedirectMatch 403 labels.rdf RedirectMatch 403 /playing.php RedirectMatch 403 muieblackcat </IfModule> 54 More…!
  • 55. 16 Build your own firewall RewriteCond %{HTTP_USER_AGENT} (havij|libwww-perl|wget|python|nikto|curl|scan|java|winhttp|clshttp|loader)[NC,OR] RewriteCond %{HTTP_USER_AGENT} (%0A|%0D|%3C|%3E|%00)[NC,OR] RewriteCond %{HTTP_USER_AGENT} (;|<|>|'|"|)|(|%0A|%0D|%22|%27|%28|%3C|%3E|%00).*(libwww-perl|wget|python|nikto|curl|scan|java|winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner)[NC,OR] RewriteCond %{THE_REQUEST} (?|*|%2a)+(%20+|s+|%20+s+|s+%20+|s+%20+s+)HTTP(:/|/)[NC,OR] RewriteCond %{THE_REQUEST} etc/passwd[NC,OR] RewriteCond %{THE_REQUEST} cgi-bin [NC,OR] RewriteCond %{THE_REQUEST} (%0A|%0D|r|n)[NC,OR] RewriteCond %{REQUEST_URI} owssvr.dll [NC,OR] RewriteCond %{HTTP_REFERER} (%0A|%0D|%3C|%3E|%00)[NC,OR] RewriteCond %{HTTP_REFERER} .opendirviewer.[NC,OR] RewriteCond %{HTTP_REFERER} users.skynet.be.* [NC,OR] RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http://[NC,OR] RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(..//?)+ [NC,OR] RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC,OR] RewriteCond %{QUERY_STRING} =PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC,OR] RewriteCond %{QUERY_STRING} (../|%2e%2e%2f|%2e%2e/|..%2f|%2e.%2f|%2e./|.%2e%2f|.%2e/)[NC,OR] RewriteCond %{QUERY_STRING} ftp: [NC,OR] RewriteCond %{QUERY_STRING} http:[NC,OR] RewriteCond %{QUERY_STRING} https: [NC,OR] RewriteCond %{QUERY_STRING} =|w| [NC,OR] RewriteCond %{QUERY_STRING} ^(.*)/self/(.*)$ [NC,OR] RewriteCond %{QUERY_STRING} ^(.*)cPath=http://(.*)$[NC,OR] RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E)[NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C).*embed.*(>|%3E)[NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)([^e]*e)+mbed.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C).*object.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)([^o]*o)+bject.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C).*iframe.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)([^i]*i)+frame.*(>|%3E)[NC,OR] RewriteCond %{QUERY_STRING} base64_encode.*(.*)[NC,OR] RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*([^)]*)[NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2})[OR] RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})[OR] RewriteCond %{QUERY_STRING} ^.*((|)|<|>|%3c|%3e).*[NC,OR] RewriteCond %{QUERY_STRING} ^.*(x00|x04|x08|x0d|x1b|x20|x3c|x3e|x7f).* [NC,OR] RewriteCond %{QUERY_STRING} (NULL|OUTFILE|LOAD_FILE) [OR] RewriteCond %{QUERY_STRING} (.{1,}/)+(motd|etc|bin)[NC,OR] RewriteCond %{QUERY_STRING} (localhost|loopback|127.0.0.1)[NC,OR] RewriteCond %{QUERY_STRING} (<|>|%0A|%0D|%3C|%3E|%00)[NC,OR] RewriteCond %{QUERY_STRING} concat[^(]*([NC,OR] RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR] RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC,OR] RewriteCond %{QUERY_STRING} -[sdcr].*(allow_url_include|allow_url_fopen|safe_mode|disable_functions|auto_prepend_file) [NC,OR] RewriteCond %{QUERY_STRING} (;|<|>|'|"|)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/*|union|select|insert|drop|delete|update|cast|create|char|convert|alter|declare|order|script|set|md5|benchmark|encode)[NC,OR] RewriteCond %{QUERY_STRING} (sp_executesql)[NC] RewriteRule ^(.*)$ - [F,L] # END BPSQSE BPS QUERY STRING EXPLOITS 55 BulletProof Security adds 43 lines of rules to the .htaccess file!
  • 56. 16 Build your own firewall • CHECK OUT…  The 5G 2013 list: http://perishablepress.com/5g- blacklist-2013/  The htaccess file generated by BulletProof Security  WordPress Codex 56
  • 57. 17 Hide the .htaccess file itself! • HOW? # STRONG HTACCESS PROTECTION <Files ~ "^.*.([Hh][Tt][Aa])"> order allow,deny deny from all satisfy all </Files> 57
  • 58. 18 Protect your WP-Admin area • Problem with login limits plugins: –Query database for every request –Run a lot of server processes –Fill up your MySQL database 58
  • 59. 18 Protect your WP-Admin area 59 WP-Admin MySQL Database
  • 60. 18 Protect your WP-Admin area STEP 1: Use your hosting control panel to password protect the WP-Admin directory 60
  • 61. 18 Protect your WP-Admin area End up with this: 61
  • 62. 18 Protect your WP-Admin area • STEP 2: New htaccess file in the WP-Admin folder: AuthType basic AuthUserFile "/home/example.co.uk/wp-admin//.htpasswd" AuthGroupFile /dev/null AuthName "ENTER YOUR LOGIN DETAILS" Require valid-user <Files admin-ajax.php> Order allow,deny Allow from all Satisfy any </Files> ErrorDocument 401 /401error.html 62
  • 63. 18 Protect your WP-Admin area • STEP 3: Add this to your root htaccess: <Files wp-login.php> AuthType Basic AuthUserFile "/home/example.co.uk/wp-admin//.htpasswd" AuthGroupFile /dev/null AuthName "ENTER YOUR LOGIN DETAILS" Require valid-user </Files> ErrorDocument 401 /401error.html 63
  • 64. 18 Protect your WP-Admin area 64 Presented to the user:
  • 65. 18 Protect your WP-Admin area 65 Create a custom 401 error page:
  • 66. 18 Protect your WP-Admin area • Benefits: –Blocks bad bots at server-level –Less server resources needed than firing up WordPress –Works ok with public logins if using a front- end login form (e.g. ‘Theme My Login’ plugin with the front-end widget) 66
  • 67. 19 Block PHP in Uploads folder • WHY? Uploads folder can be used by other users. • HOW?  Create a .htaccess file in the WP-Content/Uploads folder, with the following: <Files *.php> Deny from All </Files> 67
  • 68. 20 Tighten PHP configuration • WHY? Helps block PHP code injection vulnerabilities caused by bad input filtering. • HOW?  Add a php.ini file in your root directory and paste in some code… 68
  • 69. 20 Tighten PHP configuration ; Disable allow_url_fopen in php.ini for security reasons allow_url_fopen = Off ; Disable allow_url_include in php.ini for security reasons allow_url_include = Off ; Disable display_errors in php.ini for security reasons display_errors = Off log_errors = On 69
  • 70. 21 Create your own encryption keys • WHY? Makes an attackers job harder. • HOW?  Open up wp-config.php, scroll down to “Authentication Unique Keys and Salts”.  Generate your own keys at: https://api.wordpress.org/secret-key/1.1/salt/ 70
  • 71. 22 Move WP-Config location • WHY? Take wp-config.php out of a publicly accessible location. • HOW? Move it one level up, outside of your public_html folder: 71
  • 72. 23 Folder permissions • WHY? Can be a security hole if permissions are not strong enough. • HOW?  Use your FTP software’s CHMOD feature. 72
  • 73. 23 Folder permissions  All folders should have a CHMOD of 755.  All "wp-" PHP files = 644.  wp-config.php = 640.  htaccess files = 644.  robot.txt = 755.  sitemap.xml = 666. 73
  • 74. Don’t forget the basics: • Keep WordPress and your plugins updated. • Have a secure password. • Get decent quality hosting.
  • 75. www.primaryimage.com Twitter: @primaryimage Also find us on Facebook, Google+ & LinkedIn