Keeping a WooCommerce webshop up to date and secure

ACME starts as a webshop built on WordPress and WooCommerce, with about thirty plugins. Most attacks on shops like this use known weaknesses in plugins that were not updated, or stolen administrator passwords. This chapter tells how ACME's shop was broken into through an old plugin in 2020, and what a small shop does to prevent it: few plugins kept up to date, protected administrator accounts, card payments left to the payment provider, and backups that have been tested.

· By Marius-Florin Cristian

Part 2 of the series Building a security program for a growing company: The assembly line: building and delivering software securely.
  1. Keeping a WooCommerce webshop up to date and secure (you are here)
  2. Deploying through a CI pipeline instead of by hand TBA
  3. Handling passwords, keys and other secrets TBA
  4. Code review as a security control TBA
  5. Code your product uses but your team did not write: libraries, licences and the SBOM TBA
  6. Shipping only what the product needs to run (container images) TBA
  7. Access to the production systems (Kubernetes) TBA
  8. Delivering software that customers run on their own servers TBA
  9. Updates and support periods for software on customer sites TBA
  10. Receiving and handling vulnerability reports TBA
  11. Supplier security requirements from an industrial customer in 2020 TBA

ACME in 2020: three people, a WordPress webshop with WooCommerce and about thirty plugins on one rented server, selling smart plugs and meters to households. Card payments happen on the payment provider's page.

Plugins, updates and backups

Plugin
Code from another company that adds a feature to the shop, such as a contact form or a file manager. It runs inside the shop with the same rights as the shop.
Update
A new version of WordPress, a plugin or a theme. Many updates fix weaknesses that are already public, so attackers know about them as well.
Staging site
A private copy of the shop where updates are tried before they reach the real one.
Backup
A copy of the shop's files and database, kept somewhere other than the shop's server, that can be restored.
Multi-factor sign-in
Signing in with a password plus a second proof, such as a code from an app on the phone.

The incident in September 2020

In 2019 Andrew installed File Manager, a popular plugin, to edit the shop's files from the browser. He used it twice and forgot about it. At the start of September 2020 attackers began exploiting a flaw in File Manager versions before 6.9, which let anyone upload and run their own code on a site without signing in (CVE-2020-25213). The plugin had about 700,000 installations, and attackers were using the flaw before most sites had installed the fixed version.

ACME's webshop in 2020, and the attack path through an old plugin Customers order on ACME's WordPress and WooCommerce shop, which keeps customers and orders in its database and redirects them to the payment provider's page to pay. The attacker uploads code through an old File Manager plugin on the same server, copies customer data from the database and changes the redirect so that some customers land on a fake payment page on the attacker's own site. Public internet ACME's rented server Payment provider Attacker's site orders redirect to pay reads, writes uploads code copies data changed redirect Customer Attacker WordPress and WooCommerce Old File Manager plugin Customers and orders Payment page Fake payment page
ACME's shop in 2020. The dashed red path is the attack through the old plugin. Open the diagram full size

On ACME's server, the attacker uploaded a small program that gave them control of the shop. They copied the customer table and changed the checkout so that some customers were sent to a fake payment page that looked like the real one.

Each level saw something different:

Changes after the incident

Most of the changes cost little, and together they close the path the attacker used:

Who reads these records

ReaderWhat they ask forWhat answers it
Payment providerThat card data never touches the shop, and that the shop's own site cannot be used to attack the payment pageThe hosted payment page setup, the update log and the file checks
GDPR, the data protection authoritySecurity of processing, and the notice of a breach within 72 hours where feasibleThe breach record, the notice sent and the changes made afterwards
CustomersThat their data is safe, and that they hear about it when it is notThe privacy notice, and the letter they received
Later business customersHow updates and administrator access are handledThe update log and the list of administrator accounts (chapter 3.1)

Cost

These are estimates. Depending on the company and how it operates, the real numbers can be higher or lower.

Setting up
One to two days for the staging site, the backups away from the server and multi-factor sign-in.
Each week
One to two hours for the updates and the file check, plus the restore test once a month.
Skill
Someone who runs WordPress sites and knows the shop's plugins.
Money
A few euros a month for the staging site and the backup storage. Several feeds of plugin weaknesses have a free tier.
Too early
None of this is too early for a shop that takes orders.

Keeping all of this under control also takes attention, beyond the hours. It can break the concentration needed for product work or for leading new business, and in a small company the same person often does both.

Limits

This chapter covers a shop on WordPress and WooCommerce. A hosted shop platform takes over the updates and part of the risk, under its own contract. The payment provider's self-assessment rules change from time to time, so check the current form with the provider. The incident at ACME is made up, and the File Manager flaw it uses is real.

Previous: Proactive, application and detective security in a growing company All chapters Next: Deploying through a CI pipeline instead of by hand TBA