Skip to content

Case 04 / WooCommerce / Checkout security

How we removed a fake card form from WooCommerce checkout

A customer was asked for a card number and CVC on a page that should have redirected to the payment provider. The owner saw a normal checkout. We followed the difference between those two sessions back to a saved WordPress record.

Reported by
A shopper checking out as a guest
Source identified
A database-backed code snippet
Recovery check
Guest checkout and a provider test payment

A customer saw a card form the owner could not see

The first report came from a customer. When they selected card payment, fields for the card number, expiry date and security code (CVC) appeared on the store’s own checkout page. The owner knew what the payment flow should look like. This store sent shoppers to the payment provider’s hosted page. There was no reason to enter a CVC on the merchant’s website.

The owner tried the same purchase while signed in. The product went into the cart, the total recalculated and checkout redirected to the provider as usual. The account used to manage the shop therefore gave the owner a convincing but incomplete picture of what customers were seeing.

We agreed with the owner to identify the source of the unexpected fields, remove it and verify that ordinary orders and payments still worked. We also needed to establish what the available evidence could tell us about the administrative change and any possible exposure before the report.

The checkout we investigated
ComponentConfiguration in this store
StoreWordPress and WooCommerce with the classic checkout shortcode, [woocommerce_checkout].
Payment methodA redirect to the provider’s hosted payment page. The merchant’s checkout did not collect the CVC.
Reported differenceA guest saw additional fields after selecting card payment. The signed-in owner saw the usual redirect.

We paused the affected payment method and preserved the evidence

With the owner and the people responsible for payments, we temporarily disabled the affected method. The unexpected fields were enough to justify pausing it while we investigated. At that point we had yet to establish which component introduced them.

Before cleaning anything, we preserved copies of the files and database, the gateway configuration, the time of the report, the available server and WordPress activity logs, a view of the page and the information about the suspect script. We kept the evidence outside the public website and excluded customer card details. Preserving the original record also let us look for related changes after removing it from the store.

We kept the current order database in place. Restoring an earlier snapshot at this stage could have discarded legitimate orders, refunds and inventory movements recorded since the backup. We used a separate copy for the investigation.

The same cart produced different checkouts

We held the product, delivery choice and payment method constant and compared an administrative session with a fresh guest session. We repeated the guest check in another session. The extra fields appeared after the payment method was selected in both guest checks. The owner’s session continued to take the expected path.

What the session comparison established
Session or checkWhat we observedWhy it mattered
Signed-in administratorNormal checkout, followed by the provider redirect.The owner’s session alone could miss the symptom.
Fresh guest browserCard fields appeared within the store.The symptom could be seen independently of the reporting customer’s browser.
Second guest sessionThe same extra form appeared again.A one-off browser fault became less likely.
Gateway configurationThe configured method redirected shoppers to the provider.Local card fields did not belong to the intended flow.

The gateway settings and the cache checks did not account for the difference. We moved the comparison to an isolated copy. This installation used classic checkout. A store using the WooCommerce Checkout block could render payment components differently.

The browser showed where the extra fields came from

We compared the HTML initially returned by the server with the document displayed by the guest’s browser after the payment choice. The initial HTML contained no extra card fields. They appeared in the live document after JavaScript ran.

The browser’s network log showed a script request to a domain outside the store’s approved payment and analytics services. The request’s initiator pointed back to a short piece of JavaScript in the checkout page. That gave us a specific piece of evidence to look for in WordPress.

Reviewing the preserved script connected the request to the form. The script created the unexpected fields, read their values and prepared a request to an unrelated destination. We used test data on the isolated copy and blocked outbound traffic to that destination. This established what the code was designed to do. Whether it had transmitted a particular customer’s details remained unknown.

What changed between the response and the screen
  1. Initial HTMLThe response contained no extra card fields.
  2. Guest browserSelecting the payment method triggered an unapproved script request.
  3. Rendered checkoutThe unexpected fields appeared on the merchant’s page.

The script loader was stored in a WordPress database record

We checked the active theme’s functions.php and checkout templates for the external reference. It was absent from those files. We widened the investigation to components that can print code from stored settings.

A custom-code plugin held a saved JavaScript snippet in the database. The loader in that record matched the one seen in the browser. The record also accounted for the difference between the guest and administrative sessions. We found no corresponding modification in the plugin files we examined.

Following the external request back into WordPress
EvidenceFinding
BrowserThe network initiator identified a loader embedded in the checkout response.
Theme and plugin filesThe inspected theme templates did not contain the external reference. The checked plugin files showed no corresponding change.
Stored plugin recordThe database entry contained the matching loader and supplied it to the checkout page.
Cached copiesPreviously generated responses could still contain the old output and needed checking after cleanup.

A clean file scan could have missed the source completely. Reinstalling the same plugin files would also have left the saved record to investigate. The record established where the loader was stored. To investigate how the entry had changed, we turned to the activity log.

Disabling one record removed the loader

On the isolated copy, we disabled only the identified record. We kept the theme, payment gateway and outbound network restrictions the same. The embedded loader disappeared from fresh HTML responses, and the browser stopped attempting to request the associated script.

This gave us a causal test. The guest observations explained when the symptom appeared. The browser initiator identified the loader. The matching database entry identified its source. Disabling that entry changed the output while the other relevant conditions stayed the same. Verification of the repaired payment flow was a separate step.

The activity log linked the edit to an administrator account

We compared the snippet’s change history with the available WordPress activity log. The edit was recorded under an administrator account, and the session details differed from the owner’s usual sign-ins. That justified investigating privileged access. The records did not establish who used the account or how access was obtained.

We reviewed WordPress accounts and permissions, access to hosting and SFTP/SSH, extension changes, connected tag managers and the CDN configuration. We also reviewed who could create or edit custom code. Those privileges mattered because they could change the page seen by a shopper without changing a theme file.

We ended active administrative sessions, reviewed privileges, enabled multifactor authentication and rotated the credentials or secrets within the identified scope. The available records did not distinguish a compromised password from a hijacked session or another route.

From the recorded edit to the access review
  1. Activity logThe snippet edit was recorded under an administrator account.
  2. Access reviewWe reviewed privileged accounts and code-editing permissions and ended active administrator sessions.
  3. Evidence limitThe records did not identify who used the account or how they gained access.

We removed the record from production and checked related components

After documenting the record and examining other possible sources on the protected copy, we removed the malicious entry from the live configuration. We made the agreed access changes and cleared server and CDN caches before requesting fresh checkout responses.

We examined core, plugins, the theme, uploads, must-use plugins, scheduled tasks and related database records. We checked connected services, payment keys and webhook destinations. No other active component tied to this particular injection was found in the locations examined.

What checksum verification covered

We ran two read-only checksum checks from a trusted environment. They covered WordPress core and plugins with published reference checksums.

wp core verify-checksums --include-root
wp plugin verify-checksums --all

For proprietary or custom components, we needed a clean vendor package or another trusted baseline. Checksums cover the files for which a reference exists. They cannot validate the contents of a saved database snippet. We therefore repeated the guest checkout check against freshly generated pages as part of the cleanup.

We preserved live orders and verified the whole payment flow

A working redirect alone would not tell the owner whether WooCommerce had recorded the order or received the payment notification. Before reconciling transactions, we established which WooCommerce order store was authoritative and how synchronization was configured. With High-Performance Order Storage (HPOS), the dedicated order tables may be authoritative. A check limited to wp_posts would then be incomplete.

What we reconciled before putting the method back into service
AreaCheck
Orders and paymentsCurrent orders and statuses, payments, refunds and unfinished operations in the active order store.
Background processingAction Scheduler jobs, transactional emails and exchanges with connected services.
Provider eventsWebhook destinations, the relevant secrets and receipt of payment notifications.
CatalogStock levels, reservations and discounts associated with the order flow.

Using the provider’s authorized test mode, we checked order creation, the payment-status change and notification delivery. We also checked declined payment, refund handling and the related background work. No genuine card details were needed for these checks. The live database retained orders created since the evidence copy was taken.

What we could establish about customer data

The preserved script could read the unexpected fields and prepare a request to a third party. We therefore treated possible customer exposure as a separate question from restoring checkout. We compared the timestamp of the snippet change with customer reports and available logs to narrow the possible period of activity. Those records did not give us a reliable start date.

A request sent directly from a shopper’s browser to another server might never appear in the store’s access logs. An absence of matching entries could neither confirm nor rule out a transfer. Together with the owner, we passed the findings to the payment provider. The preserved material included the code, logs and network evidence without cardholder details.

Guests could pay through the provider again

We returned to the scenario the customer had reported. In the guest sessions we checked, the unexpected fields were gone. The browser no longer requested the identified script and the normal redirect to the hosted payment page worked. The store kept its existing gateway.

Final checks against the original incident
CheckVerified outcome
Guest checkoutThe reported fields did not appear when the affected method was selected.
Page and network responseFresh HTML contained no matching loader, and the associated external script was no longer requested.
Test paymentThe order was created, its status updated and the expected notification arrived.
Files and databaseThe saved record was removed. No additional active component linked to this incident was found in the locations checked.
Administrative accessActive administrative sessions were ended and the relevant accounts and code-editing permissions reviewed.

We set up continued monitoring for changes to checkout and its network connections. These tests verified the state of the repaired store. The origin of the administrative access and possible historical transfers remained open questions.

Why removing the visible fields would have left the job unfinished

Two checks that would usually reassure an owner both had blind spots here. Signing in as the administrator concealed the customer’s symptom. Checking the filesystem left the stored database entry outside the comparison. Following the guest browser’s request back to WordPress connected these pieces of evidence.

Removing the form visually would have left its source in place. Finding the record let us remove the cause, review the access that could change it, and verify actual order and payment processing before the owner resumed taking card payments.

Questions store owners and developers ask

Why did the owner see a normal checkout?

The stored snippet behaved differently in the administrative and guest sessions we examined. A fresh guest saw the foreign form after selecting card payment. The signed-in owner continued to see the expected checkout.

Why did checking the WordPress files miss the source?

The loader was stored as plugin data in the database. The relevant plugin files could match their originals while the plugin still printed the contents of the saved record.

Did this prove the custom-code plugin was vulnerable?

The record was changed under an administrative account. The evidence did not establish how that access was obtained or identify a flaw in the plugin.

Would deleting the database record and clearing the cache be enough?

Those steps removed the known loader. We also reviewed privileged access and other possible sources, then verified guest checkout, payment notifications, refunds and background order processing.

Can a clean checkout prove that no card details were stolen earlier?

The post-cleanup checks establish current behavior. Historical exposure requires separate evidence, including whatever the payment provider and the available logs can establish for the relevant period.

Are shoppers seeing unexpected card fields?

Tell us which payment method is affected and what the shopper sees before the redirect. Describe the symptom without including passwords or card details.

Discuss a checkout issue