Credit card data hack on WooCommerce

How Can Hackers Steal Credit Card Data From Your WooCommerce Store?

If you have credit card form on your WooCommerce Checkout page, it is time to worry. We have noticed that a large part of the Payment Gateway plugins allows customers to enter credit card information on the same checkout page. Though if you did not save this data in your online store, in case of favourable opportunities, it could be read and saved to a file on another server. If hackers manage to find a vulnerability in your online store, it is very likely that it will be possible to inject a keylogger that can steal your customers’ credit card data.

How hackers can steal credit card data 1

The difference between entering data in your WooCommerce store and payment provider page

When you have credit card input fields on the checkout page, these fields can be affected by JavaScript or PHP code. This risk disappears when you need to enter credit card details on another page, for example PayPal, or when the credit card form is loaded from a different site as an iframe. If you do not know how these fields are displayed on your website, we recommend contacting your online store administrator to explain if there is a risk of data leakage.

An example of how credit card details can be stolen

You have credit card fields on the checkout page, and you use some plugins, and one of them has a vulnerability such as “stored XSS”, which is quite often found in various plugins. We remind you that the more plugins you use, the greater the risk of having security issues. Always evaluate your plugins. “Stored XSS” vulnerability allows the hacker to place a keylogger in your online store and affect the credit card’s input fields, i.e. send them to the hacker.

Let’s say you are using the Advanced Search for WooCommerce plugin, where we recently have found the “Stored XSS” vulnerability. This plugin has a Custom CSS field where the CSS code can be saved. The existing “Stored XSS” vulnerability allows changing this field even if the user is not logged-in on the website. The hacker places a keylogger (JavaScript script) that will be loaded on each page, including the payment page.

Keylogger is uploaded using the security vulnerability in Advanced Search for WooCommerce plugin.

How hackers can steal credit card data 2

The uploaded keylogger looks like this. It is loaded on every page including the checkout page.

How hackers can steal credit card data 3

The JavaScript keylogger code looks like this:

How hackers can steal credit card data 4

When the “Place Order” button is pressed, this code collects the credit card details, i.e. the cardholder’s name, card number, expiry date and security code, and sends these data using the HTTP POST method to the file on the hacker’s server.

Then, on the hacker’s server, all of this data is stored in the credit_cards.txt file, the PHP code looks like this:

How hackers can steal credit card data 5

All saved data can be viewed in the credit_cards.txt file.

How hackers can steal credit card data 6
Darius S.

Similar Posts

WordPress 5.0 to 5.0.1

WordPress 5.0 and its vulnerabilities found in the first week of release

The long awaited WordPress version 5.0 has finally become available from the 2018 December 6. Some users waited for this version with ...

WordPress Security category

WordPress security and performance – two closely related subjects

WordPress security and WordPress performance are two main topics that bother website owners every day. Everyone wants a fast and secure ...

WordPress site hacked after restore

My WordPress website got hacked after restore. Again! Why?

Quite often we hear about the repeated security incidents related to WordPress sites. This is not something specific to WordPress sites, ...