SlideShare a Scribd company logo
1 of 46
WordPress Security
Dealing with Today‟s Hacks
SUCURI@WORDCAMP# WHOIS
PEREZBOX

 ID: Tony Perez
 WHO: The Hulk
 Username: Perezbox
 Process: Sucuri
 Services: InfoSec,
 Harley‟s, MMA, Guns
 GeoIP: Menifee,
 California

                       @sucuri_security @perezbox #wclv   10/13/2012
@sucuri_security @perezbox #wclv   10/13/2012
Why listen to me? You don‟t have to,
                 but…
I am not a designer or developer, my passion is Information
Security, specifically Web Security
Not an expert, passionate enthusiast
I don‟t like people, I like packets, signatures and terminal.
Seriously though, our company:
   Remediate 200 – 300 infected websites a day,
      24/7/365
   Perform 2 million + malware website scans a month
   Support all CMS platforms and customapplications (e.g.,
   WordPress, Joomla, osCommerce, vBulletin, Drupal, .NET,
   etc… )

                                  @sucuri_security @perezbox #wclv   10/13/2012
Thoughts To Kick Things
             Off
Information Security is about risk reduction.
If you‟re looking for the “silver bullet” this is the wrong
talk for you.
To think that you will never be infected or that you are
immune to hacks is like saying you will never be sick.
   If someone tells you the opposite you should slap them
   and have them pay you for wasting your time.

Prevention is ideal, detection is key… bats were
created for ________ people…


                                @sucuri_security @perezbox #wclv   10/13/2012
Know Your Enemy
They have more time and
resources

They are intelligent

Majority of attacks are
automated

Goal is to impact as many
people as possible

Mindset – Own one, own them
all…

It‟s not personal, it‟s
business…                     @sucuri_security @perezbox #wclv   10/13/2012
Ok, so what‟s the problem?
TODAY‟s ISSUES:
  The Ecosystem /
  Environment
  Access Control
  Software Vulnerabilities
  Administration
  Credential Management
  Extensibility

                             @sucuri_security @perezbox #wclv   10/13/2012
Today‟s Focus
Ecosystem / Environment

Access Control

Dealing with Hacks




                          @sucuri_security @perezbox #wclv   10/13/2012
The EcoSystem / Environment
Apache
   Malicious module injects iFrames
   http://blog.unmaskparasites.com/2012/09/10/malicious-apache-
   module-injects-iframes/

phpMyAdmin
   Mirror Hacked
   http://sourceforge.net/blog/phpmyadmin-back-door/

PHP-CGI
   Remote Code Execution
   http://blog.sucuri.net/2012/05/php-cgi-vulnerability-exploited-in-the-
   wild.html

Plesk
   Vulnerable to SQLi attacks
   http://blog.sucuri.net/2012/06/plesk-vulnerability-leading-to-
   malware.html
                                           @sucuri_security @perezbox #wclv   10/13/2012
Uh, what about
WordPress?




                 @sucuri_security @perezbox #wclv   10/13/2012
Logical Architecture

 Linux Operating System
                     Apache                               MySQL           PHP




WordPress   CPANEL    Plesk   phpMyAdmin      PHP-CGI       Modules      Modules




                                           @sucuri_security @perezbox #wclv        10/13/2012
The EcoSystem / Environment
 What can you do?
    Not much… completely outside of your control if you‟re
    using a shared or managed host


 But, you can reduce risk...
    Use a Dedicated / VPS Environment
       But recognize the responsibility that this entails, if you
       what I mentioned previously doesn‟t make sense, skip
       to next step
    Go with a Managed Host
       Doesn‟t mean you‟ll be safer, but it does mean you‟ll
       have resources to lean on
                                  @sucuri_security @perezbox #wclv   10/13/2012
Access is Key
On the Server:
   Kill accounts that are not in use
   FTP is the devil – slap yourself and switch to SFTP
   Filter Shell / SFTP by IP & Keys, Keys at a minimum
   Disable Authentication via Passwords on server

WordPress Admin:
   Multi-Factor Authentication on wp-admin
      Apache “Basic Access Authentication”
   Two-Factor Authentication on wp-login.php
      Duo Two-Factor Authentication Plugin

Employ least privileged:
   Users with the “administrator” are not needed for every day
   tasks
   Learn to use Editor, Author, Contributor, Subscriber
                                   @sucuri_security @perezbox #wclv   10/13/2012
Gah!?!?!?!?!?!?!




         @sucuri_security @perezbox #wclv   10/13/2012
WordPress Loving
        Infections
Defacements

Backdoors

Pharma Hack

Injections
   iFrame Specifically

Malicious Redirects

Phishing

                         @sucuri_security @perezbox #wclv   10/13/2012
Before We Dive In
LINUX / UNIX:
  CURL
  FIND
  GREP
  DIFF




                 @sucuri_security @perezbox #wclv   10/13/2012
Command Usage – Hunting TimThumb

# grep -Eir --include "*thumb.php" 'define.*VERSION' .

                               - Then –
# curl -D - -A "Windows"
http://timthumb.googlecode.com/svn/trunk/timthumb.php>/path-to-
file/timthumb.php




                                        @sucuri_security @perezbox #wclv   10/13/2012
Command Usage – Identify Change

   Detect Recent Changes

find -type f -ctime -0 | more    - OR -        find ./ -mtime -1

-ctime = -0 (past 24 hours) | -1 (last 24 hours)

-mtime = -1 (1 day) | -2 (2 days)

   Detect Differences

diff –qr /path/dir1 /path/dir2



                                    @sucuri_security @perezbox #wclv   10/13/2012
Defacements
Hacktivism at its finest… you now support a cause!?!?!




                                   @sucuri_security @perezbox #wclv   10/13/2012
Defacements
Hacktivism 101
   Annoying as S*&T

Places to look:
   Index.html
   Index.php
      Root Directory
      Wp-Content
      Theme Directory

GREP is your friend:
   grep –ri „sniper399‟ .


                            @sucuri_security @perezbox #wclv   10/13/2012
Backdoors
It‟s ok to cry a little… 




                             @sucuri_security @perezbox #wclv   10/13/2012
Backdoors
        Common terms:
              Is_bot
              Eval
              Base64_decode
              Fopen
              Fclose
              readfile
              Edoced_46esad
              Exec
              System
              Shell_exec
              Gzuncompress
              popen
              FilesMan



grep -RPl --include=*.{php} "(system|exec|passthru|shell_exec|base64_decode|eval|) *(" /var/www
                                                        @sucuri_security @perezbox #wclv      10/13/2012
Pharma Hack
Erectile Dysfunction pills are leading ads.. Who knew.. 




                                    @sucuri_security @perezbox #wclv   10/13/2012
Pharma Hack
Multi-million $ Business
Rarely Distribute Malware
Impression based Affiliate Marketing
Google‟s Search Engine Result
Pages (SERP)
Odds of malware distribution are
actually low
Tricks:
    Embedded within core files
    Look for “.tmp” directories = >


                                      @sucuri_security @perezbox #wclv   10/13/2012
Pharma Hack, cntd..
Try using CURL to emulate Google and
Windows:
Curl –L –A
“Googlebot/2.1(+http://www.google.com/bot.html)”
http://someinfectedwebsite.com
    Google Webmaster Tools
      Fetch as Google Bot

Check your Theme Index.php file for things like
this:
   <?php
   $wp__theme_icon=@create_function(”,@file_get
   _contents(‘/public_html/wp-content/themes/my-
                           @sucuri_security @perezbox #wclv   10/13/2012
   really-good-
Pharma Hack, cntd..




          @sucuri_security @perezbox #wclv   10/13/2012
Injections
It only hurts for a minute…




                              @sucuri_security @perezbox #wclv   10/13/2012
Injections
Invisible iFrame‟s - Executing on your browser
Contributing to Drive-by-Downloads, Pharma, XSS,
CSRF
Places to check – Pages that generate content:
   JS files, Header.php, Index.php, Function.php,
   Footer.php




                               @sucuri_security @perezbox #wclv   10/13/2012
Injections, cntd…
PHP iFrame Injection
=>
   Count##.php
   Check all Index.php /
   Theme JS files
   Example below:




                           @sucuri_security @perezbox #wclv   10/13/2012
Injections, cntd…
Pharma Link Injections
=>

Drive-By-Downloads




                         @sucuri_security @perezbox #wclv   10/13/2012
Malicious Redirects
WTF?!?! Why don‟t I understand what it says?




                                  @sucuri_security @perezbox #wclv   10/13/2012
Malicious Redirects
Redirects your user to a domain distributing malware,
fundamentally different than an ifram injection that
executes in your browser
8 out of 10 times, check your .htaccess file – all of them
    # find /var/www –name .htaccess –type f | wc –l

Check for backdoors also – often a sign of a bigger issue




                                @sucuri_security @perezbox #wclv   10/13/2012
Phishing
Biggest growing problem, exceptionally difficult to detect…




                                    @sucuri_security @perezbox #wclv   10/13/2012
Phishing
Growing at a faster pace than traditional web-
malware

No impact to readers, but tied to SPAM bots
sending out emails like this:




                          @sucuri_security @perezbox #wclv   10/13/2012
Phishing, cntd…




        @sucuri_security @perezbox #wclv   10/13/2012
Demonstration
Bringing the Point Home




                          @sucuri_security @perezbox #wclv   10/13/2012
Demo Objective
Use good tools for bad things – wpscan
Enumerate the users
Brute Force the User accounts password
Insert an arbitrary Backdoor Shell for Remote
Execution
Deface the Website
Insert another Shell Backdoor that provides an
interface

        I have 5 minutes – Ready?
                             @sucuri_security @perezbox #wclv   10/13/2012
Keeping it Real
Remember the risk discussion?




                                @sucuri_security @perezbox #wclv   10/13/2012
Guard Access
Revisit Slide 12 – access, access, access
    It always comes down to access


We have to change the way we treat and think about access.
All access – Server / Application



We are going through the same mistakes servers and
desktops were making in the 90‟s with access.



Know where you are surfing the web, do you really need to
log in as an admin at the coffee shop?


                                 @sucuri_security @perezbox #wclv   10/13/2012
Password Dilemma
15 character pass
      3 months to crack

Long / Complex / Unique
      Key to Passwords

Prefer Password Manager
      You don‟t? ok..
      Passphrases work too
           iLuvWCLVegas:2012:HrtAttckGrll

Come up with a process that works, stick to it:
      One scheme:
           Remember 8 characters
           Write Down 8 characters
           Save 20 characters
      Second scheme:
           Remember 20 characters
           Prefix characters with site name
           End sequence with some date


                                                  @sucuri_security @perezbox #wclv   10/13/2012
Kill PHP Execution
Kill PHP Execution
   Directories:
     WP-INCLUDES
     WP-CONTENT
     UPLOADS – At a minimum


                  <Files *.php>
                  Deny from all
                  </Files>



                           @sucuri_security @perezbox #wclv   10/13/2012
Disable Theme / Plugin Editor
 I‟d take it a step further and remove the ability to
 install, but that‟s just me.
            Modify WP-CONFIG.PHP With:
 Disable the Plugin / Theme Editor
    Define(„DISALLOW_FILE_EDIT‟,true);

                    - OR -


 Disable the Plugin / Theme Update and Installation
    Define(„DISALLOW_FILE_MODS‟,true);



                               @sucuri_security @perezbox #wclv   10/13/2012
Update
Oldest version found in production – 1.5
Leading cause of cross-site contamination issues
Perhaps the simplest of tasks, yet we still find this:




                              @sucuri_security @perezbox #wclv   10/13/2012
Plugins That Help
     Clients                Non-Clients

Sucuri Security     Duo Two-Factor
Premium             Authentication

Duo Two-Factor      Limit Login Attempts
Authentication
                    Theme-Check
Theme-Check
                    BackupBuddy
BackupBuddy
                    Akismet
Akismet


                  @sucuri_security @perezbox #wclv   10/13/2012
Need a Hand?
   Support Forums                      Online Resources

Hacked –                           Sucuri Blog: http://blog.sucuri.net
http://wordpress.org/tags/ha
cked                               SiteCheck Scanner:
                                   http://sitecheck.sucuri.net

                                   Unmask Parasites:
                                   http://unmaskparasites.com
Malware –
http://wordpress.org/tags/ma       Perishable Press:
lware                              http://perishablepress.com/category/
                                   web-design/security/

                                   Secunia Security Advisories:
                                   http://secunia.com/community/advis
BadwareBusters –                   ories/search/?search=wordpress
https://badwarebusters.org



                               @sucuri_security @perezbox #wclv          10/13/2012
Sucuri
          Tony Perez
            http://sucuri.net |
          http://blog.sucuri.net

                  Twitter:

            @sucuri_security

  @perezbox and @tonyonsecurity




@sucuri_security @perezbox #wclv   10/13/2012

More Related Content

What's hot

Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012
Michele Orru
 
Word press security
Word press securityWord press security
Word press security
Jigar Pandya
 
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian CrenshawTakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
EC-Council
 
Hacktivity2011 be ef-preso_micheleorru
Hacktivity2011 be ef-preso_micheleorruHacktivity2011 be ef-preso_micheleorru
Hacktivity2011 be ef-preso_micheleorru
Michele Orru
 
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download DetectionDrivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Wayne Huang
 

What's hot (20)

Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012Advances in BeEF - AthCon2012
Advances in BeEF - AthCon2012
 
Word press security
Word press securityWord press security
Word press security
 
Be ef presentation-securitybyte2011-michele_orru
Be ef presentation-securitybyte2011-michele_orruBe ef presentation-securitybyte2011-michele_orru
Be ef presentation-securitybyte2011-michele_orru
 
Preconnect, prefetch, prerender...
Preconnect, prefetch, prerender...Preconnect, prefetch, prerender...
Preconnect, prefetch, prerender...
 
Docker Plugin For DevSecOps
Docker Plugin For DevSecOpsDocker Plugin For DevSecOps
Docker Plugin For DevSecOps
 
10 things you are doing wrong in Joomla
10 things you are doing wrong in Joomla10 things you are doing wrong in Joomla
10 things you are doing wrong in Joomla
 
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011REST in ( a mobile ) peace @ WHYMCA 05-21-2011
REST in ( a mobile ) peace @ WHYMCA 05-21-2011
 
Security Theatre - PHP UK Conference
Security Theatre - PHP UK ConferenceSecurity Theatre - PHP UK Conference
Security Theatre - PHP UK Conference
 
Anatomy of PHP Shells
Anatomy of PHP ShellsAnatomy of PHP Shells
Anatomy of PHP Shells
 
TechCrunch Early Stage 2020 - How to prioritize security at your startup
TechCrunch Early Stage 2020 - How to prioritize security at your startupTechCrunch Early Stage 2020 - How to prioritize security at your startup
TechCrunch Early Stage 2020 - How to prioritize security at your startup
 
Security Theatre - Benelux
Security Theatre - BeneluxSecurity Theatre - Benelux
Security Theatre - Benelux
 
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome ExtensionsI'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
I'm in ur browser, pwning your stuff - Attacking (with) Google Chrome Extensions
 
WORDPRESS SECURITY: HOW TO AVOID BEING HACKED
WORDPRESS SECURITY: HOW TO AVOID BEING HACKEDWORDPRESS SECURITY: HOW TO AVOID BEING HACKED
WORDPRESS SECURITY: HOW TO AVOID BEING HACKED
 
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian CrenshawTakeDownCon Rocket City: WebShells by Adrian Crenshaw
TakeDownCon Rocket City: WebShells by Adrian Crenshaw
 
Bug Bounty for - Beginners
Bug Bounty for - BeginnersBug Bounty for - Beginners
Bug Bounty for - Beginners
 
Hacktivity2011 be ef-preso_micheleorru
Hacktivity2011 be ef-preso_micheleorruHacktivity2011 be ef-preso_micheleorru
Hacktivity2011 be ef-preso_micheleorru
 
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download DetectionDrivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
 
Security Theatre - AmsterdamPHP
Security Theatre - AmsterdamPHPSecurity Theatre - AmsterdamPHP
Security Theatre - AmsterdamPHP
 
Java script, security and you - Tri-Cities Javascript Developers Group
Java script, security and you - Tri-Cities Javascript Developers GroupJava script, security and you - Tri-Cities Javascript Developers Group
Java script, security and you - Tri-Cities Javascript Developers Group
 
Ekoparty 2017 - The Bug Hunter's Methodology
Ekoparty 2017 - The Bug Hunter's MethodologyEkoparty 2017 - The Bug Hunter's Methodology
Ekoparty 2017 - The Bug Hunter's Methodology
 

Similar to WordPress Security - Dealing With Today's Hacks

Word camp orange county 2012 enduser security
Word camp orange county 2012   enduser securityWord camp orange county 2012   enduser security
Word camp orange county 2012 enduser security
Tony Perez
 
Break it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure softwareBreak it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure software
Leigh Honeywell
 

Similar to WordPress Security - Dealing With Today's Hacks (20)

Dev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT SecurityDev and Blind - Attacking the weakest Link in IT Security
Dev and Blind - Attacking the weakest Link in IT Security
 
How to hide your browser 0-days
How to hide your browser 0-daysHow to hide your browser 0-days
How to hide your browser 0-days
 
Defending Workstations - Cyber security webinar part 2
Defending Workstations - Cyber security webinar part 2Defending Workstations - Cyber security webinar part 2
Defending Workstations - Cyber security webinar part 2
 
WordPress Security Best Practices
WordPress Security Best PracticesWordPress Security Best Practices
WordPress Security Best Practices
 
Word camp orange county 2012 enduser security
Word camp orange county 2012   enduser securityWord camp orange county 2012   enduser security
Word camp orange county 2012 enduser security
 
Wordpress security
Wordpress securityWordpress security
Wordpress security
 
Art of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya MorimotoArt of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya Morimoto
 
6 - Web Application Security.pptx
6 - Web Application Security.pptx6 - Web Application Security.pptx
6 - Web Application Security.pptx
 
10 things I’ve learnt about web application security
10 things I’ve learnt about web application security10 things I’ve learnt about web application security
10 things I’ve learnt about web application security
 
Break it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure softwareBreak it while you make it: writing (more) secure software
Break it while you make it: writing (more) secure software
 
Cyber Security Workshop @SPIT- 3rd October 2015
Cyber Security Workshop @SPIT- 3rd October 2015Cyber Security Workshop @SPIT- 3rd October 2015
Cyber Security Workshop @SPIT- 3rd October 2015
 
How to hide your browser 0-day @ Disobey
How to hide your browser 0-day @ DisobeyHow to hide your browser 0-day @ Disobey
How to hide your browser 0-day @ Disobey
 
Operating Docker
Operating DockerOperating Docker
Operating Docker
 
Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011Securing Your WordPress Website - WordCamp GC 2011
Securing Your WordPress Website - WordCamp GC 2011
 
Securing Your WordPress Website by Vlad Lasky
Securing Your WordPress Website by Vlad LaskySecuring Your WordPress Website by Vlad Lasky
Securing Your WordPress Website by Vlad Lasky
 
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 Presentation
WordPress Security PresentationWordPress Security Presentation
WordPress Security Presentation
 
Anatomy of a Drupal Hack - TechKnowFile 2014
Anatomy of a Drupal Hack - TechKnowFile 2014Anatomy of a Drupal Hack - TechKnowFile 2014
Anatomy of a Drupal Hack - TechKnowFile 2014
 
Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
 
Teensy Programming for Everyone
Teensy Programming for EveryoneTeensy Programming for Everyone
Teensy Programming for Everyone
 

More from Tony Perez

WordPress Security Begins With Good Posture
WordPress Security Begins With Good PostureWordPress Security Begins With Good Posture
WordPress Security Begins With Good Posture
Tony Perez
 
Website Security - It Begins With Good Posture
Website Security - It Begins With Good PostureWebsite Security - It Begins With Good Posture
Website Security - It Begins With Good Posture
Tony Perez
 
Website Security (WordPress) - It's About the Basics
Website Security (WordPress) - It's About the BasicsWebsite Security (WordPress) - It's About the Basics
Website Security (WordPress) - It's About the Basics
Tony Perez
 
WordCamp Minneapolis 2014 - Website Security Presentation - Sucuri Security
WordCamp Minneapolis 2014 - Website Security Presentation - Sucuri SecurityWordCamp Minneapolis 2014 - Website Security Presentation - Sucuri Security
WordCamp Minneapolis 2014 - Website Security Presentation - Sucuri Security
Tony Perez
 
WordPress Security 2014 - The Basics of Security
WordPress Security 2014 - The Basics of SecurityWordPress Security 2014 - The Basics of Security
WordPress Security 2014 - The Basics of Security
Tony Perez
 
WordPress Security - Learning From Hacks
WordPress Security - Learning From HacksWordPress Security - Learning From Hacks
WordPress Security - Learning From Hacks
Tony Perez
 
Word press website security
Word press website securityWord press website security
Word press website security
Tony Perez
 
WordPress Website Security - Trends, Threats, Defenses
WordPress Website Security - Trends, Threats, DefensesWordPress Website Security - Trends, Threats, Defenses
WordPress Website Security - Trends, Threats, Defenses
Tony Perez
 

More from Tony Perez (19)

A Practical Security Framework for Website Owners
A Practical Security Framework for Website OwnersA Practical Security Framework for Website Owners
A Practical Security Framework for Website Owners
 
2017 WHD - Bridging the Divide Between Behavior and Security
2017 WHD - Bridging the Divide Between Behavior and Security2017 WHD - Bridging the Divide Between Behavior and Security
2017 WHD - Bridging the Divide Between Behavior and Security
 
Accounting for Website Security in Higher Education
Accounting for Website Security in Higher EducationAccounting for Website Security in Higher Education
Accounting for Website Security in Higher Education
 
Building a Security Framework for Websites
Building a Security Framework for WebsitesBuilding a Security Framework for Websites
Building a Security Framework for Websites
 
Navigating Online Threats - Website Security for Everyday Website Owners
Navigating Online Threats - Website Security for Everyday Website OwnersNavigating Online Threats - Website Security for Everyday Website Owners
Navigating Online Threats - Website Security for Everyday Website Owners
 
Business of People - Lessons Learned Building a Remote Workforce
Business of People - Lessons Learned Building a Remote WorkforceBusiness of People - Lessons Learned Building a Remote Workforce
Business of People - Lessons Learned Building a Remote Workforce
 
WordPress Security Begins With Good Posture
WordPress Security Begins With Good PostureWordPress Security Begins With Good Posture
WordPress Security Begins With Good Posture
 
TBEX - North America 2014 - 5 Tips to Keep Your Content and Users Safe
TBEX - North America 2014 - 5 Tips to Keep Your Content and Users SafeTBEX - North America 2014 - 5 Tips to Keep Your Content and Users Safe
TBEX - North America 2014 - 5 Tips to Keep Your Content and Users Safe
 
Website Security - It Begins With Good Posture
Website Security - It Begins With Good PostureWebsite Security - It Begins With Good Posture
Website Security - It Begins With Good Posture
 
Hacked - What do you do now?
Hacked - What do you do now?Hacked - What do you do now?
Hacked - What do you do now?
 
Website Security (WordPress) - It's About the Basics
Website Security (WordPress) - It's About the BasicsWebsite Security (WordPress) - It's About the Basics
Website Security (WordPress) - It's About the Basics
 
Website Security - Latest and Greatest (WordPress 2014)
Website Security - Latest and Greatest (WordPress 2014)Website Security - Latest and Greatest (WordPress 2014)
Website Security - Latest and Greatest (WordPress 2014)
 
WordCamp Minneapolis 2014 - Website Security Presentation - Sucuri Security
WordCamp Minneapolis 2014 - Website Security Presentation - Sucuri SecurityWordCamp Minneapolis 2014 - Website Security Presentation - Sucuri Security
WordCamp Minneapolis 2014 - Website Security Presentation - Sucuri Security
 
Joomla! Day Atlanta 2014 - Website Security - The Basics
Joomla! Day Atlanta 2014 - Website Security - The BasicsJoomla! Day Atlanta 2014 - Website Security - The Basics
Joomla! Day Atlanta 2014 - Website Security - The Basics
 
WordPress Security 2014 - The Basics of Security
WordPress Security 2014 - The Basics of SecurityWordPress Security 2014 - The Basics of Security
WordPress Security 2014 - The Basics of Security
 
WordPress Security - Learning From Hacks
WordPress Security - Learning From HacksWordPress Security - Learning From Hacks
WordPress Security - Learning From Hacks
 
Word press website security
Word press website securityWord press website security
Word press website security
 
WordPress Website Security - Trends, Threats, Defenses
WordPress Website Security - Trends, Threats, DefensesWordPress Website Security - Trends, Threats, Defenses
WordPress Website Security - Trends, Threats, Defenses
 
WordPress Security - The "No-BS" Version
WordPress Security - The "No-BS" VersionWordPress Security - The "No-BS" Version
WordPress Security - The "No-BS" Version
 

WordPress Security - Dealing With Today's Hacks

  • 2. SUCURI@WORDCAMP# WHOIS PEREZBOX ID: Tony Perez WHO: The Hulk Username: Perezbox Process: Sucuri Services: InfoSec, Harley‟s, MMA, Guns GeoIP: Menifee, California @sucuri_security @perezbox #wclv 10/13/2012
  • 4. Why listen to me? You don‟t have to, but… I am not a designer or developer, my passion is Information Security, specifically Web Security Not an expert, passionate enthusiast I don‟t like people, I like packets, signatures and terminal. Seriously though, our company: Remediate 200 – 300 infected websites a day, 24/7/365 Perform 2 million + malware website scans a month Support all CMS platforms and customapplications (e.g., WordPress, Joomla, osCommerce, vBulletin, Drupal, .NET, etc… ) @sucuri_security @perezbox #wclv 10/13/2012
  • 5. Thoughts To Kick Things Off Information Security is about risk reduction. If you‟re looking for the “silver bullet” this is the wrong talk for you. To think that you will never be infected or that you are immune to hacks is like saying you will never be sick. If someone tells you the opposite you should slap them and have them pay you for wasting your time. Prevention is ideal, detection is key… bats were created for ________ people… @sucuri_security @perezbox #wclv 10/13/2012
  • 6. Know Your Enemy They have more time and resources They are intelligent Majority of attacks are automated Goal is to impact as many people as possible Mindset – Own one, own them all… It‟s not personal, it‟s business… @sucuri_security @perezbox #wclv 10/13/2012
  • 7. Ok, so what‟s the problem? TODAY‟s ISSUES: The Ecosystem / Environment Access Control Software Vulnerabilities Administration Credential Management Extensibility @sucuri_security @perezbox #wclv 10/13/2012
  • 8. Today‟s Focus Ecosystem / Environment Access Control Dealing with Hacks @sucuri_security @perezbox #wclv 10/13/2012
  • 9. The EcoSystem / Environment Apache Malicious module injects iFrames http://blog.unmaskparasites.com/2012/09/10/malicious-apache- module-injects-iframes/ phpMyAdmin Mirror Hacked http://sourceforge.net/blog/phpmyadmin-back-door/ PHP-CGI Remote Code Execution http://blog.sucuri.net/2012/05/php-cgi-vulnerability-exploited-in-the- wild.html Plesk Vulnerable to SQLi attacks http://blog.sucuri.net/2012/06/plesk-vulnerability-leading-to- malware.html @sucuri_security @perezbox #wclv 10/13/2012
  • 10. Uh, what about WordPress? @sucuri_security @perezbox #wclv 10/13/2012
  • 11. Logical Architecture Linux Operating System Apache MySQL PHP WordPress CPANEL Plesk phpMyAdmin PHP-CGI Modules Modules @sucuri_security @perezbox #wclv 10/13/2012
  • 12. The EcoSystem / Environment What can you do? Not much… completely outside of your control if you‟re using a shared or managed host But, you can reduce risk... Use a Dedicated / VPS Environment But recognize the responsibility that this entails, if you what I mentioned previously doesn‟t make sense, skip to next step Go with a Managed Host Doesn‟t mean you‟ll be safer, but it does mean you‟ll have resources to lean on @sucuri_security @perezbox #wclv 10/13/2012
  • 13. Access is Key On the Server: Kill accounts that are not in use FTP is the devil – slap yourself and switch to SFTP Filter Shell / SFTP by IP & Keys, Keys at a minimum Disable Authentication via Passwords on server WordPress Admin: Multi-Factor Authentication on wp-admin Apache “Basic Access Authentication” Two-Factor Authentication on wp-login.php Duo Two-Factor Authentication Plugin Employ least privileged: Users with the “administrator” are not needed for every day tasks Learn to use Editor, Author, Contributor, Subscriber @sucuri_security @perezbox #wclv 10/13/2012
  • 14. Gah!?!?!?!?!?!?! @sucuri_security @perezbox #wclv 10/13/2012
  • 15. WordPress Loving Infections Defacements Backdoors Pharma Hack Injections iFrame Specifically Malicious Redirects Phishing @sucuri_security @perezbox #wclv 10/13/2012
  • 16. Before We Dive In LINUX / UNIX: CURL FIND GREP DIFF @sucuri_security @perezbox #wclv 10/13/2012
  • 17. Command Usage – Hunting TimThumb # grep -Eir --include "*thumb.php" 'define.*VERSION' . - Then – # curl -D - -A "Windows" http://timthumb.googlecode.com/svn/trunk/timthumb.php>/path-to- file/timthumb.php @sucuri_security @perezbox #wclv 10/13/2012
  • 18. Command Usage – Identify Change Detect Recent Changes find -type f -ctime -0 | more - OR - find ./ -mtime -1 -ctime = -0 (past 24 hours) | -1 (last 24 hours) -mtime = -1 (1 day) | -2 (2 days) Detect Differences diff –qr /path/dir1 /path/dir2 @sucuri_security @perezbox #wclv 10/13/2012
  • 19. Defacements Hacktivism at its finest… you now support a cause!?!?! @sucuri_security @perezbox #wclv 10/13/2012
  • 20. Defacements Hacktivism 101 Annoying as S*&T Places to look: Index.html Index.php Root Directory Wp-Content Theme Directory GREP is your friend: grep –ri „sniper399‟ . @sucuri_security @perezbox #wclv 10/13/2012
  • 21. Backdoors It‟s ok to cry a little…  @sucuri_security @perezbox #wclv 10/13/2012
  • 22. Backdoors Common terms: Is_bot Eval Base64_decode Fopen Fclose readfile Edoced_46esad Exec System Shell_exec Gzuncompress popen FilesMan grep -RPl --include=*.{php} "(system|exec|passthru|shell_exec|base64_decode|eval|) *(" /var/www @sucuri_security @perezbox #wclv 10/13/2012
  • 23. Pharma Hack Erectile Dysfunction pills are leading ads.. Who knew..  @sucuri_security @perezbox #wclv 10/13/2012
  • 24. Pharma Hack Multi-million $ Business Rarely Distribute Malware Impression based Affiliate Marketing Google‟s Search Engine Result Pages (SERP) Odds of malware distribution are actually low Tricks: Embedded within core files Look for “.tmp” directories = > @sucuri_security @perezbox #wclv 10/13/2012
  • 25. Pharma Hack, cntd.. Try using CURL to emulate Google and Windows: Curl –L –A “Googlebot/2.1(+http://www.google.com/bot.html)” http://someinfectedwebsite.com Google Webmaster Tools Fetch as Google Bot Check your Theme Index.php file for things like this: <?php $wp__theme_icon=@create_function(”,@file_get _contents(‘/public_html/wp-content/themes/my- @sucuri_security @perezbox #wclv 10/13/2012 really-good-
  • 26. Pharma Hack, cntd.. @sucuri_security @perezbox #wclv 10/13/2012
  • 27. Injections It only hurts for a minute… @sucuri_security @perezbox #wclv 10/13/2012
  • 28. Injections Invisible iFrame‟s - Executing on your browser Contributing to Drive-by-Downloads, Pharma, XSS, CSRF Places to check – Pages that generate content: JS files, Header.php, Index.php, Function.php, Footer.php @sucuri_security @perezbox #wclv 10/13/2012
  • 29. Injections, cntd… PHP iFrame Injection => Count##.php Check all Index.php / Theme JS files Example below: @sucuri_security @perezbox #wclv 10/13/2012
  • 30. Injections, cntd… Pharma Link Injections => Drive-By-Downloads @sucuri_security @perezbox #wclv 10/13/2012
  • 31. Malicious Redirects WTF?!?! Why don‟t I understand what it says? @sucuri_security @perezbox #wclv 10/13/2012
  • 32. Malicious Redirects Redirects your user to a domain distributing malware, fundamentally different than an ifram injection that executes in your browser 8 out of 10 times, check your .htaccess file – all of them # find /var/www –name .htaccess –type f | wc –l Check for backdoors also – often a sign of a bigger issue @sucuri_security @perezbox #wclv 10/13/2012
  • 33. Phishing Biggest growing problem, exceptionally difficult to detect… @sucuri_security @perezbox #wclv 10/13/2012
  • 34. Phishing Growing at a faster pace than traditional web- malware No impact to readers, but tied to SPAM bots sending out emails like this: @sucuri_security @perezbox #wclv 10/13/2012
  • 35. Phishing, cntd… @sucuri_security @perezbox #wclv 10/13/2012
  • 36. Demonstration Bringing the Point Home @sucuri_security @perezbox #wclv 10/13/2012
  • 37. Demo Objective Use good tools for bad things – wpscan Enumerate the users Brute Force the User accounts password Insert an arbitrary Backdoor Shell for Remote Execution Deface the Website Insert another Shell Backdoor that provides an interface I have 5 minutes – Ready? @sucuri_security @perezbox #wclv 10/13/2012
  • 38. Keeping it Real Remember the risk discussion? @sucuri_security @perezbox #wclv 10/13/2012
  • 39. Guard Access Revisit Slide 12 – access, access, access It always comes down to access We have to change the way we treat and think about access. All access – Server / Application We are going through the same mistakes servers and desktops were making in the 90‟s with access. Know where you are surfing the web, do you really need to log in as an admin at the coffee shop? @sucuri_security @perezbox #wclv 10/13/2012
  • 40. Password Dilemma 15 character pass 3 months to crack Long / Complex / Unique Key to Passwords Prefer Password Manager You don‟t? ok.. Passphrases work too iLuvWCLVegas:2012:HrtAttckGrll Come up with a process that works, stick to it: One scheme: Remember 8 characters Write Down 8 characters Save 20 characters Second scheme: Remember 20 characters Prefix characters with site name End sequence with some date @sucuri_security @perezbox #wclv 10/13/2012
  • 41. Kill PHP Execution Kill PHP Execution Directories: WP-INCLUDES WP-CONTENT UPLOADS – At a minimum <Files *.php> Deny from all </Files> @sucuri_security @perezbox #wclv 10/13/2012
  • 42. Disable Theme / Plugin Editor I‟d take it a step further and remove the ability to install, but that‟s just me. Modify WP-CONFIG.PHP With: Disable the Plugin / Theme Editor Define(„DISALLOW_FILE_EDIT‟,true); - OR - Disable the Plugin / Theme Update and Installation Define(„DISALLOW_FILE_MODS‟,true); @sucuri_security @perezbox #wclv 10/13/2012
  • 43. Update Oldest version found in production – 1.5 Leading cause of cross-site contamination issues Perhaps the simplest of tasks, yet we still find this: @sucuri_security @perezbox #wclv 10/13/2012
  • 44. Plugins That Help Clients Non-Clients Sucuri Security Duo Two-Factor Premium Authentication Duo Two-Factor Limit Login Attempts Authentication Theme-Check Theme-Check BackupBuddy BackupBuddy Akismet Akismet @sucuri_security @perezbox #wclv 10/13/2012
  • 45. Need a Hand? Support Forums Online Resources Hacked – Sucuri Blog: http://blog.sucuri.net http://wordpress.org/tags/ha cked SiteCheck Scanner: http://sitecheck.sucuri.net Unmask Parasites: http://unmaskparasites.com Malware – http://wordpress.org/tags/ma Perishable Press: lware http://perishablepress.com/category/ web-design/security/ Secunia Security Advisories: http://secunia.com/community/advis BadwareBusters – ories/search/?search=wordpress https://badwarebusters.org @sucuri_security @perezbox #wclv 10/13/2012
  • 46. Sucuri Tony Perez http://sucuri.net | http://blog.sucuri.net Twitter: @sucuri_security @perezbox and @tonyonsecurity @sucuri_security @perezbox #wclv 10/13/2012