Now on Demand Ransomware Resilience & Recovery Summit - All Sessions Available
Connect with us

Hi, what are you looking for?

SecurityWeekSecurityWeek

Application Security

Hunting for Magecart With URLscan.io

Hunting Magecart with URLscan.io

Hunting Magecart with URLscan.io

Magecart — originally the name applied to a single criminal gang but now the umbrella term for a JavaScript-based web skimming attack — has emerged as a major threat to the security of payment card details. Once the skimmer code has been inserted into the payment function of a website, its operation can be silent and efficient, with neither the website operator nor the consumer victim knowing that plaintext card details have been stolen.

Content Security Policy (CSP, which controls the resources that are allowed to load) and Subresource Integrity (SRI, which verifies the integrity of delivered resources) are useful defenses against Magecart attacks; but are not considered to be foolproof and may be beyond the reach of small retailers. The result is the buying consumer has no way of knowing whether a favored online retailer has been compromised or not.

Trustwave has now published a how-to guide where anyone — consumers or small retailers — can check for the presence of Magecart using the free URLscan.io service. It is not the idea that is new, but the guide. ‘Jake’ started a Twitter thread titled ‘Magecart Hunting Thread’ on December 3, 2019: “This is a thread about how to hunt and find #Magecart infected sites using @URLscan.” The Twitter thread is well-suited to tech-savvy threat hunters; the Trustwave blog provides step-by-step instructions for almost anyone.

URLscan provides an automated scan and analysis of websites via standard browsing. It records and displays the activity of the page, including the domains and IP addresses contacted, and the resources — including scripts — requested from those domains. While it offers professional commercial services, it also provides a free-to-use Public Scan of specified URLs.

Trustwave’s approach is to enter the retailer’s URL into URLscan and run a public scan. At the bottom of the scan is a section titled Domain & IP information, which are those domains that have performed requests on the site. The first task is to look for anything that looks odd. In Trustwave’s example the majority of requests have come from a single source, with two more coming from Google and Facebook. This could be considered normal behavior. The last entry, however, stands out. It could be anything, says Trustwave, “an externally loaded ad or resource, but we’ll need to dig deeper to find out.”

Clicking the HTTP option at the top of the URLscan page shows that the source of this entry is scriptvault.org/src, located in France — but, of course, it could still be anything. To the right of the HTTP are a series of sub-options. One is labeled ‘Script’. Since Magecart is a JavaScript attack, this is the one to click. This provides access to the scripts used in the exchange between the website and the source via a new ‘Show response’ option. 

In the Trustwave example, all but one of the scripts provided come from a single IP address. The odd one out is our suspect site in France. “In normal circumstances,” says Trustwave, “this script file would be loaded from the same domain as all the other script files. This is a big red flag.”

Advertisement. Scroll to continue reading.

The ‘Show response’ option will display the script itself. It is an obfuscated Magecart script — and the presence of obfuscation in what should be a legitimate script is a huge clue.

Trustwave’s next step is to see if the payment script is also falsified. Here the relevant script is ccard.js, and the same process displays a known skimmer called Inter — in this instance not obfuscated. “As further evidence that this script is malicious,” says Trustwave, “we can look into the ‘Gate’ field which contains the exfiltration URL.”

This is specified as 93 187 129 249. A subsequent WHOIS lookup says that this IP is registered in Hong Kong, providing strong evidence that card payment details are being scraped and sent to a location in the far east.

While skimming domains are regularly taken down by the authorities, Trustwave fears that this is just a game of whack-a-mole — new domains rapidly get created. “The only reliable way of preventing Magecart,” it says, “is to detect, fix, and harden the security of websites.” The process described in Trustwave’s guide will help consumers (and hunters) to detect infected websites and tell them not to provide any payment details. If the infection is also reported to the website, the website can take the necessary steps to first remove the skimmer, and then harden the site.

Related: Magecart Skimmers Found on Salesforce’s Heroku Platform 

Related: Magecart Hackers Target Mobile Users of Hotel Websites 

Related: Magecart Attack on eCommerce Platform Hits Thousands of Online Shops 

Related: Historical Breadcrumbs Link Magecart 5 to Carbanak Group 

Written By

Kevin Townsend is a Senior Contributor at SecurityWeek. He has been writing about high tech issues since before the birth of Microsoft. For the last 15 years he has specialized in information security; and has had many thousands of articles published in dozens of different magazines – from The Times and the Financial Times to current and long-gone computer magazines.

Click to comment

Trending

Daily Briefing Newsletter

Subscribe to the SecurityWeek Email Briefing to stay informed on the latest threats, trends, and technology, along with insightful columns from industry experts.

Join the session as we discuss the challenges and best practices for cybersecurity leaders managing cloud identities.

Register

SecurityWeek’s Ransomware Resilience and Recovery Summit helps businesses to plan, prepare, and recover from a ransomware incident.

Register

People on the Move

MSSP Dataprise has appointed Nima Khamooshi as Vice President of Cybersecurity.

Backup and recovery firm Keepit has hired Kim Larsen as CISO.

Professional services company Slalom has appointed Christopher Burger as its first CISO.

More People On The Move

Expert Insights

Related Content

Application Security

Cycode, a startup that provides solutions for protecting software source code, emerged from stealth mode on Tuesday with $4.6 million in seed funding.

Application Security

Virtualization technology giant VMware on Tuesday shipped urgent updates to fix a trio of security problems in multiple software products, including a virtual machine...

Application Security

Fortinet on Monday issued an emergency patch to cover a severe vulnerability in its FortiOS SSL-VPN product, warning that hackers have already exploited the...

Application Security

PayPal is alerting roughly 35,000 individuals that their accounts have been targeted in a credential stuffing campaign.

Application Security

A CSRF vulnerability in the source control management (SCM) service Kudu could be exploited to achieve remote code execution in multiple Azure services.

Application Security

GitHub this week announced the revocation of three certificates used for the GitHub Desktop and Atom applications.

Application Security

Drupal released updates that resolve four vulnerabilities in Drupal core and three plugins.