SlideShare a Scribd company logo
How to Investigate and
Recover from a Security Breach
Real-life Experiences with WordPress
Otto Kekäläinen
@ottokekalainen
WordCamp Nordic
March 8, 2019
● A CEO who codes at Seravo.com
● Written WP themes and plugins,
contributed to WordPress Core,
MySQL, MariaDB, Debian, Ubuntu,
Linux kernel, AppArmor…
● Linux and open source advocate
Otto Kekäläinen
I’ve spoken many
times about what
WordPress site
owners should
focus on to keep
their site secure...
wordpress.tv/?s=otto+kekäläinen
...but not today.
This talk is
different.
This talk is about Friday,
November 9th
2018.
Premium hosting
and upkeep for
WordPress
HTTP/2
TESTED
UPDATES
24/7 UPKEEP
Upkeep:
If a site goes down,
we bring it up again.
Covers security
incidents.
2018-11-09 11:37:48 <redacted>.seravo.com ALERT ! ! !
2018-11-09 11:40:26 <redacted>.seravo.com ALERT ! ! !
2018-11-09 11:40:42 <redacted>.seravo.com ALERT ! ! !
2018-11-09 11:42:37 <redacted>.seravo.com ALERT ! ! !
Just one ordinary Friday (not even 13th!)
Weird siteurl – on all 4 sites!
Mistake by site admin? – No way
Targeted attack on one and same company? –
Plausible, but weird modus of operandi
Security breach? – Definitely!
$ wp option get siteurl
http://erealitatea.net
High alert – 4 sites down for investigation
1. First responder notifies security officer on-call
2. Process list saved and further PHP execution frozen
3. Customer notified about on-going security incident
4. Response escalation: 3 investigators working in parallel
11:55
Security breach investigation questions
● What is happening? Is it stopped?
● What happened before? When did this start?
● Is there malicious code somewhere? Backdoors
planted?
● What files or database contents has changed? Which
changes are malicious?
● Who did what? What IP addresses and other
identifiers are linked to what actions?
Security breach investigation questions
● How did they get in?
● What level of access did they gain?
● What data could have leaked?
● What was their motive?
● What damage was caused?
Investigation and recovery steps
1. Make a new backup
2. Compare backups
wp-backup-list-changes
diff -ur wordpress backup/wordpress
3. Check last WP and SSH logins
Store current state
Reveal file and database
changes
Detect unauthorized use based
on anomalies in timestamps or IP
geolocation
Investigation and recovery steps
4. wp core verify-checksums
wp plugin verify-checksums --all
wp package install seravo/wp-checksum
wp checksum all --details
Compare WordPress core,
plugin and theme files to
their original versions as
downloaded from wp.org
Modified plugin code found
..but was a false alert, modification most likely a mistake
by real plugin author who released two plugin variants
published with same version number.
$ wp checksum diff plugin entry-views inc/widget-entry-views.php
Executing diff /tmp/1541763665-4CBDYu.tmp
wordpress/htdocs/wp-content/plugins/entry-views/inc/widget-entry-views.php
49c49
< $this->WP_Widget(
---
> parent::__construct(
13:31
Investigation and recovery steps
5. wp user list
6. wp db query
'SELECT post_modified, id, post_title,
post_name, post_type FROM wp_posts
ORDER BY id DESC LIMIT 50;'
View recent new users
View recent new contents
Two suspected attacker user accounts
Variants of trollherten and different .ru email addresses
found on multiple of the investigated sites.
$ wp user list
+----+---------------+--------------+----------------------+---------------------+---------------+
| ID | user_login | display_name | user_email | user_registered | roles |
+----+---------------+--------------+----------------------+---------------------+---------------+
| 12 | t2trollherten | | trollherten@mail.com | 2018-11-08 13:36:03 | administrator |
| 13 | t3trollherten | | t3trollherten@bk.ru | 2018-11-08 14:42:09 | administrator |
+----+---------------+--------------+----------------------+---------------------+---------------+
Bingo!
usernames, timestamps,
IP addresses, email
+----+---------------+--------------+----------------------+---------------------+---------------+
| ID | user_login | display_name | user_email | user_registered | roles |
+----+---------------+--------------+----------------------+---------------------+---------------+
| 12 | t2trollherten | | trollherten@mail.com | 2018-11-08 13:36:03 | administrator |
| 13 | t3trollherten | | t3trollherten@bk.ru | 2018-11-08 14:42:09 | administrator |
+----+---------------+--------------+----------------------+---------------------+---------------+
These can be given to grep /data/log for log data mining
The entry
109.234.37.214 - - [08/Nov/2018:15:36:02 +0200] "GET / HTTP/1.1" 200 19027 "-" 0.301
109.234.37.214 - - [08/Nov/2018:15:36:02 +0200] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 36 "-" 0.220
109.234.37.214 - - [08/Nov/2018:15:36:03 +0200] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 36 "-" 0.258
109.234.37.214 - - [08/Nov/2018:15:36:04 +0200] "POST /wp-login.php?action=register HTTP/1.1" 302 5 "-" 0.648
109.234.37.214 - - [08/Nov/2018:15:36:04 +0200] "GET /wp-login.php?checkemail=registered HTTP/1.1" 200 1463
"https://<redacted>/wp-login.php?action=register" 0.129
109.234.37.214 - - [08/Nov/2018:15:36:04 +0200] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 36 "-" 0.163
109.234.37.214 - - [08/Nov/2018:15:36:04 +0200] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 36 "-" 0.167
$ host 109.234.37.214
214.37.234.109.in-addr.arpa domain name pointer host-109-234-37-214.hosted-by-vdsina.ru.
User agent was:
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"
POST /wp-admin/admin-ajax.php
● Seravo does not log POST requests for good reasons
● So what was the payload that granted magic powers
to the attacker?
● Luckily we have other PHP and database logs...
Anomalies in database use
● Weird empty WordPress options value updates
● Unusual requests to database table wpgdprc_access_requests
● What plugin does that belong to?
$ grep -rF wpgdprc_access_requests wp-gdpr-compliance/
wp-gdpr-compliance/Includes/AccessRequest.php:
return $wpdb->base_prefix . 'wpgdprc_access_requests';
wp-gdpr-compliance/uninstall.php:
$wpdb->query("DROP TABLE IF EXISTS
`{$wpdb->base_prefix}wpgdprc_access_requests`");
14:03
Hmm..
Recent
wp-gdpr-compliance
plugin code
changes smell
like SQL injection
fixes
Point of entry known
● The plugin WP GDPR Compliance Plugin most likely route
● Fix: remove it from all 4 sites
$ wp plugin deactivate --uninstall wp-gdpr-compliance
14:35
More information started coming in
● When the US woke up (in European afternoon) and published blogs the
Sucuri RSS feed we subscribe showed interesting stuff:
blog.sucuri.net/2018/11/erealitatea-net-hack-corrupts-websites-wit
h-wp-gdpr-compliance-plugin-vulnerability.html
● Then more and more other reports were found:
a. www.wordfence.com/blog/2018/11/privilege-escalation-flaw-in-
wp-gdpr-compliance-plugin-exploited-in-the-wild/
b. vitalisec.blogspot.com/2018/11/wp-gdpr-plugin-attack.html
c. wpvulndb.com/vulnerabilities/9144
Vulnerability details
● A SQL injection flaw in WP GDPR Compliance allowed a remote
attacker to set arbitrary WP option values
a. First allow anybody to register with users_can_register=1
b. Then set default_role=”administrator” for all new users
c. Register an account, log in and do whatever an admin can do
● Reported to wpvulndb.com by Adrian Mörchen / moewe.io
● Fixed in WP GDPR Compliance version 1.4.3
Fix issue globally for all our customers
commit 2ffb891415628ead16263e1fa09d78dac9e5dcdd
Author: Ville Korhonen
Date: Fri Nov 9 14:51:18 2018 +0200
Add WP GDPR Compliance plugin to urgent updates
WP GDPR Compliance < 1.4.3 has critical SQL injection
flaw which allows simple privilege escalation.
<https://plugins.trac.wordpress.org/changeset/1970313>
Added to Seravo’s update systems as an urgent update
14:51
Investigation and recovery steps
7. Based on findings, clean up the site
a. Recover clean version from backups
b. Remove malicious code and content
manually
8. As a precaution, reset all WordPress user
sessions and passwords
wp-reset-all-passwords
In this case option A was not
possible, but luckily option B
was quite easy as backups
showed only one potential
malware file was injected.
Investigation and recovery steps
9. As extra precaution, scan the site for
malware one more time when it is
otherwise deemed to be clean
Using Seravo’s custom
made WordPress/PHP
malware scanner
2018-11-09 15:26:22 <redacted>.seravo.com RESOLVED
2018-11-09 15:17:49 <redacted>.seravo.com RESOLVED
2018-11-09 15:29:03 <redacted>.seravo.com RESOLVED
2018-11-09 15:20:24 <redacted>.seravo.com RESOLVED
All sites clean and finally back online
Investigation and recovery steps
10. Elevated monitoring and follow-up for
site once it has been re-opened, just in
case there was more attack avenues not
discovered during the investigation.
During the investigation Seravo sent 8 status update e-mails to the site
owner and the customer mobilized their own team to support the effort and
they also sent us valuable additional information. A few additional emails
from Seravo to the customer followed over the weekend and next week to
confirm all necessary measures had been completed.
Notification e-mail from new registration of
‘trollherten’ users
● Later we found out the site owner did get an email
notification from WordPress about the new user
named “trollherten” but since the e-mail was vague
and did not contain any alarming information, the
person who read the e-mail ignored it.
Luckily this was not a targeted attack
● Most likely the attacker just wanted to own the site
and use it to redirect traffic, spam, mount more
attacks against other sites etc.
● The site itself or the data it had was not the target and
most likely not used.
Be prepared: no security is perfect
● No plugin author makes perfect code.
● All plugins on the site were updated a
week earlier, the vulnerability was used
close to zero-day.
● Unreasonable for site admin to read
deeply all notification e-mails.
● Fact: sometimes even good security isn’t
enough. One also needs to have a
security incident response plan.
● We do. Do you?
Thank you!
@ottokekalainen

More Related Content

PDF
Improving WordPress performance (xdebug and profiling)
PDF
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
PDF
Use Xdebug to profile PHP
PDF
Search in WordPress - how it works and howto customize it
PDF
Less and faster – Cache tips for WordPress developers
PDF
Seravo.com: WordPress Security 101
PDF
Automatic testing and quality assurance for WordPress plugins
PDF
10 things every developer should know about their database to run word press ...
Improving WordPress performance (xdebug and profiling)
The 5 most common reasons for a slow WordPress site and how to fix them – ext...
Use Xdebug to profile PHP
Search in WordPress - how it works and howto customize it
Less and faster – Cache tips for WordPress developers
Seravo.com: WordPress Security 101
Automatic testing and quality assurance for WordPress plugins
10 things every developer should know about their database to run word press ...

What's hot (20)

PPTX
Anthony Somerset - Site Speed = Success!
PDF
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
PDF
Modern Web Application Development Workflow - EclipseCon US 2014
PPTX
Xdebug, KCacheGrind and Webgrind with WampServer
PPTX
Drupal Development Tips
PDF
Scalable talk notes
PDF
Developers, Be a Bada$$ with WP-CLI
PDF
Care and feeding notes
PPTX
Improving WordPress Performance: Xdebug and PHP profiling
PPTX
SQL Server - CLR integration
PDF
Jenkins Setup Document
PPT
Bigger Stronger Faster
PDF
How I learned to stop worrying and love the .htaccess file
PPT
Front End Website Optimization
PDF
Modern Web Application Development Workflow - EclipseCon France 2014
PPTX
Building a PWA - For Everyone Who Is Scared To
ODP
Front-End Performance Optimizing
PDF
How to make your Webpack builds 10x faster
PPTX
High Performance Snippets
PDF
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Anthony Somerset - Site Speed = Success!
Gestione avanzata di WordPress con WP-CLI - WordCamp Torino 2017 - Andrea Car...
Modern Web Application Development Workflow - EclipseCon US 2014
Xdebug, KCacheGrind and Webgrind with WampServer
Drupal Development Tips
Scalable talk notes
Developers, Be a Bada$$ with WP-CLI
Care and feeding notes
Improving WordPress Performance: Xdebug and PHP profiling
SQL Server - CLR integration
Jenkins Setup Document
Bigger Stronger Faster
How I learned to stop worrying and love the .htaccess file
Front End Website Optimization
Modern Web Application Development Workflow - EclipseCon France 2014
Building a PWA - For Everyone Who Is Scared To
Front-End Performance Optimizing
How to make your Webpack builds 10x faster
High Performance Snippets
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Ad

Similar to How to investigate and recover from a security breach in WordPress (20)

PPTX
Malware Detection with OSSEC HIDS - OSSECCON 2014
PDF
WordPress Security Presentation
PDF
Fix me if you can - DrupalCon prague
PDF
Responsible [digital] Home Ownership
PDF
WordPress News, Views and Stuff October 2016
PDF
Heroku Tips and Hacks
PDF
Automated Server Administration for DevSecOps
PDF
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
PDF
Blinded Stack Overflow: Just Another Common Technique
PPTX
October Patch Tuesday Analysis 2018
PDF
Backing up your WordPress website – it’s not optional
PDF
A Year in the Empire
PDF
What You Need to Know About WordPress & WooCommerce Plugins.pdf
PPTX
Patch Tuesday Analysis - December 2015
PPTX
Webhooks
PPTX
WordPress Security 101
PDF
Next Video Build:UCAN Build Apps with IPFS and W3UI Slides
PPTX
Word campktm speed-security
PPTX
August Patch Tuesday Analysis
PPTX
Security Function
Malware Detection with OSSEC HIDS - OSSECCON 2014
WordPress Security Presentation
Fix me if you can - DrupalCon prague
Responsible [digital] Home Ownership
WordPress News, Views and Stuff October 2016
Heroku Tips and Hacks
Automated Server Administration for DevSecOps
5 年後還是新手 - WordPress Plugin 開發大冒險 - GOTY
Blinded Stack Overflow: Just Another Common Technique
October Patch Tuesday Analysis 2018
Backing up your WordPress website – it’s not optional
A Year in the Empire
What You Need to Know About WordPress & WooCommerce Plugins.pdf
Patch Tuesday Analysis - December 2015
Webhooks
WordPress Security 101
Next Video Build:UCAN Build Apps with IPFS and W3UI Slides
Word campktm speed-security
August Patch Tuesday Analysis
Security Function
Ad

More from Otto Kekäläinen (20)

PDF
FOSDEM2021: MariaDB post-release quality assurance in Debian and Ubuntu
PDF
MariaDB quality assurance in Debian and Ubuntu
PDF
DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?
PDF
Technical SEO for WordPress - 2019 edition
PDF
How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...
PDF
DebConf 2019 MariaDB packaging in Debian BoF
PDF
The 5 most common reasons for a slow WordPress site and how to fix them
PDF
Technical SEO for WordPress
PDF
Automatic testing and quality assurance for WordPress plugins and themes
PDF
WordPress-tietoturvan perusteet
PDF
Technical SEO for WordPress - 2017 edition
PDF
Improving WordPress Performance with Xdebug and PHP Profiling
PDF
MariaDB adoption in Linux distributions and development environments
PDF
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
PDF
WordPress security 101 - WP Turku Meetup 2.2.2017
PDF
Find WordPress performance bottlenecks with XDebug PHP profiling
PDF
Testing and updating WordPress - Advanced techniques for avoiding regressions
PDF
Git best practices 2016
PDF
MariaDB Developers Meetup 2016 welcome words
PDF
MariaDB in Debian and Ubuntu: The next million users
FOSDEM2021: MariaDB post-release quality assurance in Debian and Ubuntu
MariaDB quality assurance in Debian and Ubuntu
DebConf 2020: What’s New in MariaDB Server 10.5 and Galera 4?
Technical SEO for WordPress - 2019 edition
How MariaDB packaging uses Salsa-CI to ensure smooth upgrades and avoid regre...
DebConf 2019 MariaDB packaging in Debian BoF
The 5 most common reasons for a slow WordPress site and how to fix them
Technical SEO for WordPress
Automatic testing and quality assurance for WordPress plugins and themes
WordPress-tietoturvan perusteet
Technical SEO for WordPress - 2017 edition
Improving WordPress Performance with Xdebug and PHP Profiling
MariaDB adoption in Linux distributions and development environments
WordPress security 101 - WP Jyväskylä Meetup 21.3.2017
WordPress security 101 - WP Turku Meetup 2.2.2017
Find WordPress performance bottlenecks with XDebug PHP profiling
Testing and updating WordPress - Advanced techniques for avoiding regressions
Git best practices 2016
MariaDB Developers Meetup 2016 welcome words
MariaDB in Debian and Ubuntu: The next million users

Recently uploaded (20)

PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
medical staffing services at VALiNTRY
PDF
AI in Product Development-omnex systems
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Transform Your Business with a Software ERP System
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PPTX
ai tools demonstartion for schools and inter college
How to Choose the Right IT Partner for Your Business in Malaysia
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Wondershare Filmora 15 Crack With Activation Key [2025
Design an Analysis of Algorithms I-SECS-1021-03
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
ManageIQ - Sprint 268 Review - Slide Deck
medical staffing services at VALiNTRY
AI in Product Development-omnex systems
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Odoo Companies in India – Driving Business Transformation.pdf
Transform Your Business with a Software ERP System
Design an Analysis of Algorithms II-SECS-1021-03
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
ai tools demonstartion for schools and inter college

How to investigate and recover from a security breach in WordPress

  • 1. How to Investigate and Recover from a Security Breach Real-life Experiences with WordPress Otto Kekäläinen @ottokekalainen WordCamp Nordic March 8, 2019
  • 2. ● A CEO who codes at Seravo.com ● Written WP themes and plugins, contributed to WordPress Core, MySQL, MariaDB, Debian, Ubuntu, Linux kernel, AppArmor… ● Linux and open source advocate Otto Kekäläinen
  • 3. I’ve spoken many times about what WordPress site owners should focus on to keep their site secure... wordpress.tv/?s=otto+kekäläinen
  • 4. ...but not today. This talk is different.
  • 5. This talk is about Friday, November 9th 2018.
  • 6. Premium hosting and upkeep for WordPress HTTP/2 TESTED UPDATES 24/7 UPKEEP
  • 7. Upkeep: If a site goes down, we bring it up again. Covers security incidents.
  • 8. 2018-11-09 11:37:48 <redacted>.seravo.com ALERT ! ! ! 2018-11-09 11:40:26 <redacted>.seravo.com ALERT ! ! ! 2018-11-09 11:40:42 <redacted>.seravo.com ALERT ! ! ! 2018-11-09 11:42:37 <redacted>.seravo.com ALERT ! ! ! Just one ordinary Friday (not even 13th!)
  • 9. Weird siteurl – on all 4 sites! Mistake by site admin? – No way Targeted attack on one and same company? – Plausible, but weird modus of operandi Security breach? – Definitely! $ wp option get siteurl http://erealitatea.net
  • 10. High alert – 4 sites down for investigation 1. First responder notifies security officer on-call 2. Process list saved and further PHP execution frozen 3. Customer notified about on-going security incident 4. Response escalation: 3 investigators working in parallel
  • 11. 11:55
  • 12. Security breach investigation questions ● What is happening? Is it stopped? ● What happened before? When did this start? ● Is there malicious code somewhere? Backdoors planted? ● What files or database contents has changed? Which changes are malicious? ● Who did what? What IP addresses and other identifiers are linked to what actions?
  • 13. Security breach investigation questions ● How did they get in? ● What level of access did they gain? ● What data could have leaked? ● What was their motive? ● What damage was caused?
  • 14. Investigation and recovery steps 1. Make a new backup 2. Compare backups wp-backup-list-changes diff -ur wordpress backup/wordpress 3. Check last WP and SSH logins Store current state Reveal file and database changes Detect unauthorized use based on anomalies in timestamps or IP geolocation
  • 15. Investigation and recovery steps 4. wp core verify-checksums wp plugin verify-checksums --all wp package install seravo/wp-checksum wp checksum all --details Compare WordPress core, plugin and theme files to their original versions as downloaded from wp.org
  • 16. Modified plugin code found ..but was a false alert, modification most likely a mistake by real plugin author who released two plugin variants published with same version number. $ wp checksum diff plugin entry-views inc/widget-entry-views.php Executing diff /tmp/1541763665-4CBDYu.tmp wordpress/htdocs/wp-content/plugins/entry-views/inc/widget-entry-views.php 49c49 < $this->WP_Widget( --- > parent::__construct(
  • 17. 13:31
  • 18. Investigation and recovery steps 5. wp user list 6. wp db query 'SELECT post_modified, id, post_title, post_name, post_type FROM wp_posts ORDER BY id DESC LIMIT 50;' View recent new users View recent new contents
  • 19. Two suspected attacker user accounts Variants of trollherten and different .ru email addresses found on multiple of the investigated sites. $ wp user list +----+---------------+--------------+----------------------+---------------------+---------------+ | ID | user_login | display_name | user_email | user_registered | roles | +----+---------------+--------------+----------------------+---------------------+---------------+ | 12 | t2trollherten | | trollherten@mail.com | 2018-11-08 13:36:03 | administrator | | 13 | t3trollherten | | t3trollherten@bk.ru | 2018-11-08 14:42:09 | administrator | +----+---------------+--------------+----------------------+---------------------+---------------+
  • 20. Bingo! usernames, timestamps, IP addresses, email +----+---------------+--------------+----------------------+---------------------+---------------+ | ID | user_login | display_name | user_email | user_registered | roles | +----+---------------+--------------+----------------------+---------------------+---------------+ | 12 | t2trollherten | | trollherten@mail.com | 2018-11-08 13:36:03 | administrator | | 13 | t3trollherten | | t3trollherten@bk.ru | 2018-11-08 14:42:09 | administrator | +----+---------------+--------------+----------------------+---------------------+---------------+ These can be given to grep /data/log for log data mining
  • 21. The entry 109.234.37.214 - - [08/Nov/2018:15:36:02 +0200] "GET / HTTP/1.1" 200 19027 "-" 0.301 109.234.37.214 - - [08/Nov/2018:15:36:02 +0200] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 36 "-" 0.220 109.234.37.214 - - [08/Nov/2018:15:36:03 +0200] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 36 "-" 0.258 109.234.37.214 - - [08/Nov/2018:15:36:04 +0200] "POST /wp-login.php?action=register HTTP/1.1" 302 5 "-" 0.648 109.234.37.214 - - [08/Nov/2018:15:36:04 +0200] "GET /wp-login.php?checkemail=registered HTTP/1.1" 200 1463 "https://<redacted>/wp-login.php?action=register" 0.129 109.234.37.214 - - [08/Nov/2018:15:36:04 +0200] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 36 "-" 0.163 109.234.37.214 - - [08/Nov/2018:15:36:04 +0200] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 36 "-" 0.167 $ host 109.234.37.214 214.37.234.109.in-addr.arpa domain name pointer host-109-234-37-214.hosted-by-vdsina.ru. User agent was: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36"
  • 22. POST /wp-admin/admin-ajax.php ● Seravo does not log POST requests for good reasons ● So what was the payload that granted magic powers to the attacker? ● Luckily we have other PHP and database logs...
  • 23. Anomalies in database use ● Weird empty WordPress options value updates ● Unusual requests to database table wpgdprc_access_requests ● What plugin does that belong to? $ grep -rF wpgdprc_access_requests wp-gdpr-compliance/ wp-gdpr-compliance/Includes/AccessRequest.php: return $wpdb->base_prefix . 'wpgdprc_access_requests'; wp-gdpr-compliance/uninstall.php: $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->base_prefix}wpgdprc_access_requests`");
  • 24. 14:03
  • 26. Point of entry known ● The plugin WP GDPR Compliance Plugin most likely route ● Fix: remove it from all 4 sites $ wp plugin deactivate --uninstall wp-gdpr-compliance
  • 27. 14:35
  • 28. More information started coming in ● When the US woke up (in European afternoon) and published blogs the Sucuri RSS feed we subscribe showed interesting stuff: blog.sucuri.net/2018/11/erealitatea-net-hack-corrupts-websites-wit h-wp-gdpr-compliance-plugin-vulnerability.html ● Then more and more other reports were found: a. www.wordfence.com/blog/2018/11/privilege-escalation-flaw-in- wp-gdpr-compliance-plugin-exploited-in-the-wild/ b. vitalisec.blogspot.com/2018/11/wp-gdpr-plugin-attack.html c. wpvulndb.com/vulnerabilities/9144
  • 29. Vulnerability details ● A SQL injection flaw in WP GDPR Compliance allowed a remote attacker to set arbitrary WP option values a. First allow anybody to register with users_can_register=1 b. Then set default_role=”administrator” for all new users c. Register an account, log in and do whatever an admin can do ● Reported to wpvulndb.com by Adrian Mörchen / moewe.io ● Fixed in WP GDPR Compliance version 1.4.3
  • 30. Fix issue globally for all our customers commit 2ffb891415628ead16263e1fa09d78dac9e5dcdd Author: Ville Korhonen Date: Fri Nov 9 14:51:18 2018 +0200 Add WP GDPR Compliance plugin to urgent updates WP GDPR Compliance < 1.4.3 has critical SQL injection flaw which allows simple privilege escalation. <https://plugins.trac.wordpress.org/changeset/1970313> Added to Seravo’s update systems as an urgent update
  • 31. 14:51
  • 32. Investigation and recovery steps 7. Based on findings, clean up the site a. Recover clean version from backups b. Remove malicious code and content manually 8. As a precaution, reset all WordPress user sessions and passwords wp-reset-all-passwords In this case option A was not possible, but luckily option B was quite easy as backups showed only one potential malware file was injected.
  • 33. Investigation and recovery steps 9. As extra precaution, scan the site for malware one more time when it is otherwise deemed to be clean Using Seravo’s custom made WordPress/PHP malware scanner
  • 34. 2018-11-09 15:26:22 <redacted>.seravo.com RESOLVED 2018-11-09 15:17:49 <redacted>.seravo.com RESOLVED 2018-11-09 15:29:03 <redacted>.seravo.com RESOLVED 2018-11-09 15:20:24 <redacted>.seravo.com RESOLVED All sites clean and finally back online
  • 35. Investigation and recovery steps 10. Elevated monitoring and follow-up for site once it has been re-opened, just in case there was more attack avenues not discovered during the investigation. During the investigation Seravo sent 8 status update e-mails to the site owner and the customer mobilized their own team to support the effort and they also sent us valuable additional information. A few additional emails from Seravo to the customer followed over the weekend and next week to confirm all necessary measures had been completed.
  • 36. Notification e-mail from new registration of ‘trollherten’ users ● Later we found out the site owner did get an email notification from WordPress about the new user named “trollherten” but since the e-mail was vague and did not contain any alarming information, the person who read the e-mail ignored it.
  • 37. Luckily this was not a targeted attack ● Most likely the attacker just wanted to own the site and use it to redirect traffic, spam, mount more attacks against other sites etc. ● The site itself or the data it had was not the target and most likely not used.
  • 38. Be prepared: no security is perfect ● No plugin author makes perfect code. ● All plugins on the site were updated a week earlier, the vulnerability was used close to zero-day. ● Unreasonable for site admin to read deeply all notification e-mails. ● Fact: sometimes even good security isn’t enough. One also needs to have a security incident response plan. ● We do. Do you?