The Magecart Epidemic
In 2018, British Airways suffered a breach that resulted in a £20 million ($26M) penalty under the UK GDPR. Over 429,000 customers had their complete credit card numbers and 3-digit CVVs stolen during online flight bookings.
How Magecart Operates
Unlike traditional server database hacks, **Magecart** is a digital credit card skimmer that runs directly inside the victim's web browser.
The attackers compromised British Airways' static file server and edited a single file: `modernizr-2.6.2.min.js`. They appended only **22 lines of JavaScript**. Whenever a traveler clicked "Make Payment", the script captured the card details from the form fields and transmitted them in an encrypted payload to a malicious domain: `baways.com` (deliberately registered to mimic British Airways).
The Devastating Nature of CVV Theft
Normally, e-commerce databases are legally forbidden by PCI-DSS from storing the 3-digit CVV security code on the back of a credit card. However, because Magecart intercepts data *as the customer types it into their browser before transmission*, the attackers acquired complete CVVs, enabling immediate fraudulent transactions worldwide.
How to Bulletproof Checkout Forms
- **Subresource Integrity (SRI)**: Attach `integrity="sha384-..."` hashes to all external script tags. If a script is modified by even one character, modern browsers refuse to execute it.
- **Payment Iframes**: Never build custom HTML input fields for credit cards. Always embed Stripe Elements or Braintree Hosted Fields. These fields reside inside cross-origin iframes that cannot be read by scripts running on your website.