identifying a compromised wordpress site

75
Identifying a Compromised WordPress Site @ chrisburgess # wpmelb

Upload: chris-burgess

Post on 15-Apr-2017

2.452 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Identifying a Compromised WordPress Site

Identifying a Compromised WordPress Site

@chrisburgess #wpmelb

Page 2: Identifying a Compromised WordPress Site

Prevention is the holy grail, however it’s not the topic of this

talk.

Page 3: Identifying a Compromised WordPress Site

You can’t always prevent, so you must detect.

Page 4: Identifying a Compromised WordPress Site

Even if we’re doing everything possible to harden and maintain our

installations, we should still care about security to monitor our high

value sites.

Page 5: Identifying a Compromised WordPress Site
Page 6: Identifying a Compromised WordPress Site

Is Penetration Testing Worth it? There are two reasons why you might want to conduct a penetration test. One, you want to know whether a certain vulnerability is present because you're going to fix it if it is. And two, you need a big, scary report to persuade your boss to spend more money. If neither is true, I'm going to save you a lot of money by giving you this free penetration test: You're vulnerable. Now, go do something useful about it. -- Bruce Schneier

http://www.schneier.com/blog/archives/2007/05/is_penetration.html

Page 7: Identifying a Compromised WordPress Site

The following examples are often the first signs of a

successful attack.

Page 8: Identifying a Compromised WordPress Site
Page 9: Identifying a Compromised WordPress Site
Page 10: Identifying a Compromised WordPress Site
Page 11: Identifying a Compromised WordPress Site
Page 12: Identifying a Compromised WordPress Site

Ahrefs and Google Search Console

Page 13: Identifying a Compromised WordPress Site

Real example of anchor text from Ahrefs

Page 14: Identifying a Compromised WordPress Site

Real example of a malicious plugin.

Page 15: Identifying a Compromised WordPress Site

Real example of a malicious plugin.

Page 16: Identifying a Compromised WordPress Site

This shouldn’t be the first sign of a compromised site. There

are usually plenty of early warning signs.

Page 17: Identifying a Compromised WordPress Site

But first…

Page 18: Identifying a Compromised WordPress Site
Page 19: Identifying a Compromised WordPress Site

Links to the Quora Article

•  https://www.quora.com/I-am-powering-a-banks-website-using-WordPress-What-security-measures-should-I-take

•  https://ma.tt/2015/04/a-bank-website-on-wordpress/

•  https://wptavern.com/banking-on-wordpress-matt-mullenweg-weighs-in-on-security-concerns

Page 20: Identifying a Compromised WordPress Site

h"ps://www.quora.com/I-am-powering-a-banks-website-using-WordPress-What-security-measures-should-I-take/answer/Karol-Krol?srid=uD68

Page 21: Identifying a Compromised WordPress Site

Let’s ask another question. Is Linux secure? Is Django secure? Is iOS

secure? Is MySQL secure? Is Drupal secure? Is Node.JS secure? Is <insert browser> secure? Is

Android secure? Is Rails secure? Is Windows Server secure? Is Shopify

secure? You get the idea…

This can get subjective, since some have a much better track record than others, and

some are designed with security as a priority.

Page 22: Identifying a Compromised WordPress Site

So.. banks aside, what would constitute as a high value

target?

Page 23: Identifying a Compromised WordPress Site

High traffic sites, anything with Personally Identifiable

Information (PII), software vendors, service providers?

Page 24: Identifying a Compromised WordPress Site
Page 25: Identifying a Compromised WordPress Site
Page 26: Identifying a Compromised WordPress Site
Page 27: Identifying a Compromised WordPress Site

Credit card numbers aren’t the only form of sensitive

information.

Page 28: Identifying a Compromised WordPress Site

It’s really easy to say “something isn’t secure”.

Page 29: Identifying a Compromised WordPress Site

It’s much harder to actually build something that is secure (knowing that there’s no such

thing as absolute security).

Page 30: Identifying a Compromised WordPress Site

The best answer is that if security is important, you need

“people” working on it.

Page 31: Identifying a Compromised WordPress Site

The Internet is a hostile environment. We need to have a healthy respect for this fact.

Page 32: Identifying a Compromised WordPress Site

The current dilemma…

Page 33: Identifying a Compromised WordPress Site

Hosting Providers

Page 34: Identifying a Compromised WordPress Site

Plugins

Page 35: Identifying a Compromised WordPress Site

Systems and Services

Page 36: Identifying a Compromised WordPress Site

Users

Page 37: Identifying a Compromised WordPress Site

Good Developers

Page 38: Identifying a Compromised WordPress Site

Good Support, Ops and SysAdmins

Page 39: Identifying a Compromised WordPress Site

A high value business needs good people, from all of these disciplines, working together.

Page 40: Identifying a Compromised WordPress Site

h"p://www.sentrillion.com/images/img_defense-in-depth.jpg

Page 41: Identifying a Compromised WordPress Site

Real example of a malicious file

Page 42: Identifying a Compromised WordPress Site

You can’t rely only on tools, they won’t always detect a

compromise.

Page 43: Identifying a Compromised WordPress Site

Most WordPress security tools work by using signatures.

For context, Kaspersky AV for Windows currently has around

500,000 signatures.

Page 44: Identifying a Compromised WordPress Site

Scanning your site with online tools work only if your site has active malware, is defaced or

blacklisted.

Page 45: Identifying a Compromised WordPress Site

If a site has been compromised, it cannot be trusted.

Page 46: Identifying a Compromised WordPress Site

example.com/index.php

Page 47: Identifying a Compromised WordPress Site

example.com/otherapp/

Page 48: Identifying a Compromised WordPress Site

example.com/*

Page 49: Identifying a Compromised WordPress Site

example.com/*

Page 50: Identifying a Compromised WordPress Site

Isolation

Look out for a shared web root, addon domains in cPanel, or other web apps in

subfolders.

Page 51: Identifying a Compromised WordPress Site

We’re going to assume a fresh WordPress install, or restoration from a clean backup is needed

Page 52: Identifying a Compromised WordPress Site

Places/things to check… •  Content/files (htaccess, index.php, sitemap.xml, anything

custom) •  Running processes •  Running scripts, open files (look at full paths in processes) •  Memory •  Cron jobs •  Database •  Date and timestamps •  Suspicious plugins •  Suspicious directories/files •  Sitemaps/SERPs •  WordPress Admin Users •  Other users in GSC/WMT •  Code audit

Page 53: Identifying a Compromised WordPress Site

Checking Content

•  grep •  Screaming Frog (useful for finding JS) •  Sucuri SiteCheck •  UnmaskParasites.com •  Safe Browsing Site Status (Google)

Page 54: Identifying a Compromised WordPress Site
Page 55: Identifying a Compromised WordPress Site
Page 56: Identifying a Compromised WordPress Site
Page 57: Identifying a Compromised WordPress Site
Page 58: Identifying a Compromised WordPress Site
Page 59: Identifying a Compromised WordPress Site

Once the server has been compromised, it cannot be

trusted.

Page 60: Identifying a Compromised WordPress Site

Tools for Detection

•  System Monitoring •  Integrity Monitoring •  Firewalls •  IDS/IPS •  Malware Scanners •  Logging

Page 61: Identifying a Compromised WordPress Site

System Monitoring

•  Resources (Bandwidth/CPU/RAM/IO) •  Logins •  Processes

Page 62: Identifying a Compromised WordPress Site

Integrity Monitoring

•  git •  wp-cli •  Any diff tools •  Plugins •  Tripwire (and similar)

Page 63: Identifying a Compromised WordPress Site

wp-cli’s Verify Checksums

$ wp core verify-checksums Success: WordPress install verifies against checksums.

Thanksto@davemacforthisKp!

Page 64: Identifying a Compromised WordPress Site

Firewalls

•  Network Firewalls •  Web Application Firewalls •  Security Services

Page 65: Identifying a Compromised WordPress Site

IDS/IPS

•  Typically at the host level •  OSSEC

Page 66: Identifying a Compromised WordPress Site

Malware Detection

•  Security Plugins •  Commercial AV •  Public Site Scanning •  Google Search Console •  ConfigServer eXpliot Scanner (for WHM/

cPanel) •  Maldet/ClamAV

Page 67: Identifying a Compromised WordPress Site

Logging

•  /var/log (access, error, php) •  Centralised Logging or Log Shipping

(Papertrail, Loggly, Splunk, Logstash etc.) •  Audit trails (Stream/WP Audit Trail etc.)

Page 68: Identifying a Compromised WordPress Site

WPScan WordPress Scanner

Page 69: Identifying a Compromised WordPress Site

WPSecurityBloggers.com

Page 70: Identifying a Compromised WordPress Site

Use a security plugin (or manually harden)

https://www.wordfence.com/

https://sucuri.net/

https://ithemes.com/security/

Page 71: Identifying a Compromised WordPress Site

Final Words… Security issues typically occur because of certain patterns. Cleaning, restoring or rebuilding doesn’t address that. Compromised sites are much more likely to become compromised again. Get everyone on board to take security seriously.

Page 72: Identifying a Compromised WordPress Site

Prevention and Response

Hardening/Prevention: •  https://codex.wordpress.org/

Hardening_WordPress Post-hack/Response: •  https://sucuri.net/website-security/what-

to-do-after-a-website-hack/

Page 73: Identifying a Compromised WordPress Site

•  WordPress.org – wordpress.org/about/security – wordpress.org/news/category/security

•  Verizon DBIR http://www.verizonenterprise.com/

•  verizon-insights-lab/dbir/ •  Sucuri https://sucuri.net/ •  WP White Security

https://www.wpwhitesecurity.com/ •  OWASP http://owasp.org/

Page 74: Identifying a Compromised WordPress Site

wpmelb.org/slack

Page 75: Identifying a Compromised WordPress Site

Thanks and stay safe!

@chrisburgess #wpmelb