Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MageCart Defense Strategies

Tom Robertshaw
September 05, 2019

MageCart Defense Strategies

The fight goes on to protect our stores from malicious attackers. But what if your store has been compromised for the last month sending every customer's credit card details to China and you didn't even know it? Not all breaches advertise themselves. MageCart is a common attack that can silently be sending credit card information to a third party server during the checkout. What can we do to protect ourselves as well as be alerted if our sites been compromised?

Tom Robertshaw

September 05, 2019
Tweet

More Decks by Tom Robertshaw

Other Decks in Technology

Transcript

  1. 1. What is MageCart? 2. How do I protect against

    it? 3. What’s my responsibility as a site developer? Overview
  2. Malaria Transferred through mosquito bites Lots of bites but only

    a small number cause infection Infection through a third-party
  3. Brute Force Attacks Automated attacks of weak admin credentials or

    unpatched applications Target unhealthy hosts
  4. JS that duplicates form submissions to a dead drop Invisible

    to the merchant and customer MageCart
  5. Injects script foobar.com/js/extjs/fix-defer-after.js Looks for payment form & saves values

    to cookie Adds image with src=deaddrop.com?paymentdetails=encoded_data ...but only if dev tools isn’t open Example
  6. 1. Identify, preserve & remove cylon 2. Investigate activity &

    breach 3. Add further protections 4. Report 5. Monitor Attack Response
  7. Keep dependencies patched and up-to-date Secure admin passwords IP protect

    admin area, magmi and other admin tools Remove Magento 1 downloader MageCart Protections
  8. Technology comes with security risk & training burden Prepare for

    worst case scenario The rational strategy is to have an intruder alarm Assume vulnerabilities
  9. A CSP gives the browser a whitelist of sites that

    requests can be made to Anything else is blocked Content Security Policies
  10. The wearing medieval armour to go to the store approach

    to security We need to balance security with user needs Overkill
  11. content-security-policy -report-only: default-src 'self' 'unsafe-inline' *.sagepay.com www.gstatic.com www.google.com *.newrelic.com *.nr-data.net;

    report-uri https://xcvb435746uwefddfgjk654.report-uri.com/r/d/csp/reportOnly CSP Report Only Example
  12. Example CSP Report { "document-uri": "https://tomrobertshaw.net/", "referrer": "", "violated-directive": "style-src-elem",

    "effective-directive": "style-src-elem", "original-policy": "default-src 'self' 'unsafe-inline' 'unsafe-eval'; report-uri https://test-report.trackcsp.com/v1/494b06af-eb50-4c85-9097-aa7c31e591b9", "disposition": "report", "blocked-uri": "https://fonts.googleapis.com/css?family=Open+Sans:400,400italic", "status-code": 0, "script-sample": "" }
  13. Results in a huge number of reports In practice is

    very noisy, e.g. browser extensions Need a tool to analyze Collecting Reports
  14. 1. MageCart can be a silent killer 2. Good security

    hygiene reduces attack vectors 3. Security Monitoring fundamental part of application stack Summary