The new PCI DSS Version 4.0 Skimming Requirements Demystified

With the help of my work colleagues, Rob Jepson and Tom Kinnaird (thank you both), this blog post will cover the following topics to help the reader understand why additional online skimming requirements have been introduced within PCI DSS Version 4.0 and what entities need to do to meet them.

  • What is Online Skimming?
  • Why should I be worried about this particular threat?
  • Online skimming compromises
  • How exactly does online skimming work?
  • But I have implemented an iframe, does this still leave me vulnerable?
  • What are the new PCI DSS Version 4.0 requirements?
  • What is meant by “Payment Page”?
  • SAQ Alignment
  • Do these two new PCI DSS Version 4.0 Requirements apply to SAQ A?
  • What options do I have to meet these new requirements?
  • Wait! If these scripts are in scope, does this make the supplier a service provider?
  • My Ramblings

What is Online Skimming?

Online skimming is a technique that makes use of malicious code within legitimate e-commerce sites designed to capture card information that consumers enter to make payments for goods and/or services through the compromised e-commerce website. The threat actor responsible for inserting the malicious code will either store the card information until they retrieve it or will exfiltrate the information to a remote location for easy retrieval.

Online skimming isn’t a new concept with early backdoor skimming software first being reported in April 2000 within a piece of software named “cart32”,which was an off the shelf commercial shopping cart.  This backdoor skimming code had been reportedly exposing credit card information for more than a year [1].

Magecart has become synonymous to this style of attack, which is traced back to 2014 [1], with Magento becoming a big target of these attacks in 2015 [2] after a serious RCE (Remote Code Execution) vulnerability was identified called Shoplift/SUPEE 5344.  Magecart attacks can be linked to 12 cybercrime groups involved in compromising e-commerce sites with the purposes of leveraging online skimming attacks from them.

Magecart attacks can be orchestrated via frontend and backend attacks through browser scripts (e.g. JavaScript) or server-side code (e.g. PHP) respectively.  Although Magecart attacks are typically associated with frontend browser-based attacks. In a publication by Sansec [2] there appears to be a shift to server-side attacks quoting around 64% seen by Sansec.

Why should I be worried about this particular threat?

In September 2019, Visa released a blog post entitled “Visa EMV chip cards help reduce counterfeit fraud by 87 percent” [3].  EMV (Europay, Mastercard and Visa), named after the three companies who were responsible for developing the standard, is a technical standard developed in 1994 to create smart payment cards and supporting technologies that can be used by card reader vendors to interact with them.  EMV leverages an embedded microchip (EMV Contact Chip) on the debit/credit card used to promote secure payment functionality for card-present payments, transforming the security of card-present payments to combat fraud.  EMV technologies have evolved to enhance payment security in other areas of the payment card ecosystem to include technologies for card-not-present (CNP) payment channels, through technologies such as EMV 3-D Secure, EMV QR Codes, EMV Secure Remote Commerce, EMV Mobile and EMV Payment Tokenisation technologies [4].

In addition to this, in 2012 the PCI Security Standards Council (PCI SSC) announced the release of a new standard called the P2PE (Point-to-Point Encryption) standard.  This standard is designed to provide assurances that at the point of interaction with a payment card, the data is immediately encrypted in a way that makes it near impossible (in today’s computing) to decrypt the information without the decryption keys, which are secured in a third-parties secured decryption environment.  In essence, the idea was to make the data useless if it was captured by threat actors, so it couldn’t be monetised in anyway.  A noteworthy point is that EMV does not look at the protection of the transmission of card data, but the expectation is that this will be handled by the devices themselves, especially if they meet other PCI SSC standards, such as PTS (PIN Transaction Security).

The Visa EMV blog [3] states that U.S fraud was slashed by 87% in March 2019 compared to that of September 2015 due to EMV technology. 

Why is all this relevant?  Since these newer technologies have been released to improve the security of card-present channels, trends have traditionally shifted to online e-commerce compromises.  This makes sense since threat actors and criminal organisations will look for the easiest targets, which currently are e-commerce payment channels.  As shown from the UK Finance’s “Fraud – The Facts 2022” [5] report, there has been an increased trend in e-commerce fraud losses on UK-issued cards between 2012 (£139.6m) to 2020 (£377.2m), before seeing a 10% drop in 2021 (£339.2), which isn’t too surprising since the overall fraud losses on UK-issued cards dropped by 7% that year.  E-commerce still accounts for just under 65% of all fraud losses on UK-issued cards in 2021.

Online skimming compromises

According to a news story by Bleeping Computer in Nov 2021 titled “UK govt warns thousands of SMBs their online stores were hacked” [6], more than 4,000 online retailers were informed of a Magecart compromise by the UKs National Cyber Security Centre (NCSC). The report goes on to say that the NCSC monitored these e-commerce sites since April 2020, issuing warnings to the owners.  Interestingly, NCSC identified that most sites were compromised via a known vulnerability in Magento which is an e-commerce platform commonly used by online retailers.

Many large and high-profile organisations have suffered at the hand of Magecart, these companies include:

British Airways

British Airways (BA) made an apology after 380,000 customers’ credit card details were stolen over only a two week period [7] in 2018.  As reported in ‘The Register’ [8] bookings between the 21st August 2018 and the 5th September 2018 were affected by a server-side Magecart hack.  More alarmingly, this same article, claims that BA was also saving domain administrative credentials and card details in plaintext, which both breach PCI DSS Requirements.

In addition to the Account Data Compromise (ADC) complications that would have resulted in negative PR and fines from the card brands, BA was also reportedly looking at a £183m GDPR (General Data Protection Regulation) fine from the UK’s ICO (Information Commissioners Office). [9] It was later announced that due to the economic impact of Covid-19 to the airline industry, the ICO reduced the fine to £20m, [10] which is still a considerable fine.

The attack is reported [11] to have started through the compromise of a BA network account issued to a third-party cargo-handling firm, Swissport, employee.  Once entering BA’s Citrix environment, the attacker was able to breach the wider network and stumble across a cleartext Domain Administrator credential.  The attacker not only gained access to service logs containing plaintext payment card details, but also the website source code, which was used to plant a card skimmer into the payment page used within the public facing e-commerce platform.

Ticketmaster

Ticketmaster succumbed to a client-side Magecart attack, which was reported by The Register, potentially impacted 9 million customers details, and cost the company a £1.25m fine by the UKs ICO, not including other potential fines and reputational damages. [12]  This attack was carried out by compromising a 3rd party chatbot service called Inbenta. A compromise of this chatbot’s JavaScript code allowed for the Magecart’s digital card-skimming code to appear on Ticketmaster’s payment pages, thereby impacting every payment being made through the e-commerce site.  Ticketmaster’s announcement [13] provided a timeline of between September 2017 and the 23rd of June 2018, interestingly a DARKReading article “Ticketmaster Breach Part of Massive Payment Card Hacking Campaign” [14] highlights that the command-and-control server used by Magecart had been operational since late 2016.  This same article also highlights that SociaPlus, another third-party supplier to Ticketmaster, was also breached by Magecart.

Newegg

Newegg reportedly became another Magecart stat after a digital card skimmer was identified and removed on the 18th of September 2018, which had been reportedly active since the 13th of August 2018, according to a TechTarget report. [15]  With this attack, the threat actors registered a new domain; neweggstats.com and a valid SSL Certification, exfiltrating data via the URL; https://neweggstats.com/GlobalData/.  This attack was a server-side attack since the payment page on the webserver was compromised to host the malicious JavaScript code.

Others

There are many other examples of organisations becoming victim to these digital card skimmer attacks such as, PulseTV between November 2019 and August 2021, Tupperware in 2020, Segway in 2022, Emma Sleep Co between the 27th of January 2022 and 22nd of March 2022 and many more.

How exactly does online skimming work?

In essence, online credit card skimming occurs when malicious code is injected into a website to steal credit card information from visitors.

A high-level overview of the skimming process follows similar steps to other (hacking attempts | exploits), with the key exception of the exploitation targeting end users (cardholders) rather than the organisation:

  • Identification: An attacker identifies one or more target web applications; this could be a site with a vulnerability identified by the threat actor or identifying a target that handles a lot of payments.

The webapp will, of course, need to take card payments.

  • Exploitation: The attacker then identifies and exploits a vulnerability to inject malicious code into the application (the ‘skimmer’) which is designed to collect and exfiltrate payment card information through hidden mechanisms.
  • Exfiltration: When a user visits the compromised website and enters their payment card information, the skimmer then collects this data and sends it back to the attacker’s server.

Identification

Skimmers will be looking to perform attacks on web applications that are either low-hanging fruit with easy-to-exploit vulnerabilities, or high-traffic payment domains. Often, targeted applications are both.

Because of the nature of supply chain attacks, compromising a commonly used JavaScript included within a CDN (Content Delivery Network), would allow an attacker to spread their malware across many domains simultaneously.

Exploitation

Exploitation can be client-side or server-side. The distinction between these is important: client-side attacks do not involve touching anything on the server, so it is not possible to detect any changes on the filesystem. These attacks are generally supply-chain in nature, targeting third party sites that host JavaScript files included on a page – e.g. CDN or third-party advertisement.

The HTML on the page would look something like this:

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>

Advertisements are another very common technique for getting skimmers on a site, as reported by The Register [17], around 17-per cent of malware-laden ads examined by the firm also contained Magecart skimmers.

As discussed earlier, server-side attacks involve gaining access to the websites’ code based and making changes to the website itself.

Exfiltration

Depending on the skill of the attacker and the opportunistic nature of the attack, skimmer attacks will generally follow the same process of encoding / encrypting data and sending it to an attacker domain, styled to look like a request to the organisation.

In the British Airways attack, stolen data was exfiltrated through the domain ‘www.baways.com’ [17].  As already discussed, in the Newegg compromise, the ‘neweggstats.com’ domain was used.

But I have implemented an iframe, does this still leave me vulnerable?

A crucial security mechanism in securing web applications is the same-origin policy (SOP) [18], which is designed to restrict JavaScript interactions with data of different origins.  Within the context of the same-origin policy, an origin is identified through the protocol, hostname, and port number the resource is using.  Therefore, the following URLs are said to be the same origin:

https://pciramblings.com/home.php

https://pciramblings.com/index.php

However, the following URL would not match the same-origin policy due to the protocol (http) not matching:

http://pciramblings.com/contactme.php

Where iframes are concerned, the same-origin policy helps to protect the iframe that is loaded from the payment provider, since the same-origin policy will not allow JavaScript code within the parent page to interact with the resources of the iframe, thereby protecting the data being inputted.

Note: It is worth pointing out that same-origin policy only restricts access to data and doesn’t restrict access to embedded resources between different origins; for example, CSS (Content Style Sheets), images and scripts.

Whilst iframes do increase the complexity of the attack of the payment process, making it harder for an attacker to simply read the input card details due to the discussed same-origin policy, once a skimmer is installed an attacker already has arbitrary code execution on the user’s machine. This vulnerability is commonly referred to as ‘Cross Site Scripting’ and could be exploited to compromise the user in a multitude of ways, including through browser exploits and creating fake payment pages.

This means that iframe-based solutions are not a direct mitigation to skimming attacks, as the injection of a skimmer on a vulnerable web application is the by-product of a deeper vulnerability present in the system. Further to this – if the iframe is served from a compromised domain, or if the attacker can find a way to inject malicious code into the iframe such as through a PostMessage-based exploit, then the payment card information can still be stolen. If an attacker is able to add custom code to a web application, it could even be possible for them to use browser exploits on out-of-date & vulnerable browsers which could be used by a visitor of the application – leading to their machine being infected with malware.

Sometimes the strictness of the SOP implementation can hamper application functionality of modern web apps, therefore there are various mechanisms to ‘relax’ this implementation allowing “defined” domains to share data.  These mechanisms include Cross-Origin Resource Sharing (CORS), Cross-Domain Messaging (postMessage), JSON with Padding (JSONP) and through a mechanism of setting document.domain.  Incorrectly configuring these options can leave the website open to SOP attacks.

What are the new PCI DSS Version 4.0 requirements?

PCI DSS Version 4.0 introduced two new requirements specifically designed to mitigate the risk of online skimming attacks.  Although these new requirements are future dated to the 31st of March 2025, meaning from the 1st April 2025 entities must have these requirements in place, it is recommended to implement these new requirements as soon as possible.

Under “Requirement 6: Develop and Maintain Secure Systems and Software” is the following future dated requirement:

‘6.4.3 All payment page scripts that are loaded and executed in the consumer’s browser are managed as follows:

• A method is implemented to confirm that each script is authorized.

• A method is implemented to assure the integrity of each script.

• An inventory of all scripts is maintained with written justification as to why each is necessary.’

Under “Requirement 11: Test Security of Systems and Networks Regularly” is the following future dated requirement:

‘11.6.1 A change- and tamper-detection mechanism is deployed as follows:

• To alert personnel to unauthorized modification (including indicators of compromise, changes, additions, and deletions) to the HTTP headers and the contents of payment pages as received by the consumer browser.

• The mechanism is configured to evaluate the received HTTP header and payment page.

• The mechanism functions are performed as follows:

– At least once every seven days

OR

– Periodically (at the frequency defined in the entity’s targeted risk analysis, which is performed according to all elements specified in Requirement 12.3.1).’

Let’s look at these two new requirements in more detail:

Requirement 6.4.3

This requirement is looking for entities to provide adequate management of all scripts within the payment page loaded into the cardholder’s browser.  This requirement goes hand in hand with Requirement 11.6.1 since an authorisation process for scripts needs to be in place to enable alerting mechanisms to be built to identify where new, unknown, or modified scripts appear within the payment page.

As can be seen from the requirement itself, the expectation is that the entity must:

  • Have a mechanism of ensuring that each script that the entity is expecting within the payment page, has been authorised.
  • Have a mechanism of ensuring the integrity of each script that loads within the payment page can be validated to ensure no unauthorised modifications have been made.
  • Have a mechanism in place to maintain an inventory of all the scripts that are authorised for use within payment pages along with a way of recording the business justification for each script.  My view on this requirement is that it will force entities to think if scripts are actually necessary for the payment functionality or not. By reducing the number of scripts being used on payment pages, entities are reducing their attack surface and therefore reducing the risk of a compromises through these scripts.

Requirement 11.6.1

This new requirement has been added to ensure entities are able to monitor payment pages and HTTP headers to detect any signs of changes or tampering.  This must be able to be done at least weekly or using a “frequency” determined by a risk assessment.  The mechanism to achieve this must be able to alert personnel if unauthorised modifications are detected.

What is meant by “Payment Page”?

You’ll notice within these two new PCI DSS Version 4.0 requirements that both refer to the term “Payment Page”.  I thought it would be worthwhile going through what is meant by a payment page.

The PCI DSS Version 4.0 ‘Appendix G – PCI DSS Glossary of Terms, Abbreviations, and Acronyms’ defines a “Payment Page” as:

“A web-based user interface containing one or more form elements intended to capture account data from a consumer or submit captured account data. The payment page can be rendered as any one of:

  • A single document or instance,
  • A document or component displayed in an inline frame within a non-payment page,
  • Multiple documents or components each containing one or more form elements contained in multiple inline frames within a non-payment page.”

Let’s look at each of these rendered options in a little more detail:

A single document or instance

This rendering option displays a web page served from the Merchant website containing a form element allowing the cardholder to input their card information for direct submission to a payment provider (payment gateway) via either a;

  • ‘Direct Post’ (also referred to as ‘browser API’ or ‘silent order post’),
  • ‘JavaScript created form’,

as shown in the diagram below;

or a direct submission to the merchant website itself known as ‘The API’ or ‘merchant gateway’ rendering option, as shown in the diagram below.

A document or component displayed in an inline frame within a non-payment page

This rendering option displays a web page served from the Merchant website that contains an inline frame (iframe) that is loaded with contents entirely from the payment provider. Transaction information is shared with the payment provider to allow the iframe to be built.  The cardholder inputs their card information into the form within the iframe, which is then submitted directly to the payment provider, as depicted below;

Multiple documents or components each containing one or more form elements contained in multiple inline frames within a non-payment page

This iframe is the equivalent of a new browser window being opened by the payment provider and ‘embedded’ into the page. To the end user it’s invisible, but to the browser it looks like a completely different web application – this means that the browser’s security system, the Same Origin Policy, kicks in and prevents any information from the iframe window (/context) from being accessed by the merchant’s window (/context)

This provider iframe is populated with details of the requested transaction communicated with by the Merchant. Once the payment transaction has been completed by the cardholder in the provider’s iframe context, the provider then confirms the transaction details server-side to the merchant’s server, confirming that the transaction has been successful.

Because payment details are only placed in the context of an iframe, the browser’s same origin policy prevents the merchant’s code from being able to access any of the user’s payment details. Instead, the impetus of security is on the payment provider’s application as the card details are only sent to the provider, not the merchant.

The main advantage to this rendering option is that it provides much more flexibility into the design of the payment page since each field is an iframe and can therefore be placed anywhere on the page.

This is depicted below:

Additional information can be found within the PCI SSC’s FAQ 1438 entitled “Now is the Payment Page Determined for SAQ A Merchants Using iframe”

SAQ alignment

A Self-Assessment Questionnaire (SAQ) is a defined subset of PCI DSS Requirements that have been set by the PCI SSC (Payment Card Industry Standards Security Council) and the participating card schemes, based upon the risks posed by that type of payment functionality. Entities that meet the eligibility criteria of how the payment channel is setup and operates, can complete the relevant SAQ as part of the entities reporting requirements of demonstrating compliance to the PCI DSS. The exception is SAQ D, since this is the SAQ that is used when none of the other smaller SAQs can be used. SAQ D contains all the PCI DSS Requirements.

Depending upon which rendering option is used for the e-commerce payment channel, will determine which SAQ it will align to. Three SAQs are linked to e-commerce payment channels; these are SAQ A, SAQ A-EP and SAQ D. The following table shows which rendering option aligns to which SAQ.

SAQRendering Options
SAQ AThis SAQ is used for e-commerce payment channels that leverage iframe technologies as the rending option. It is worth pointing out that SAQ A is also used for redirect technologies, whereby the cardholder is transferred directly to the payment gateways own payment page as part of the payment journey.
SAQ A-EPThis SAQ is used where the e-commerce payment channel utilises the Direct Post or JavaScript rendering options.
SAQ DThis SAQ contains all the PCI DSS Requirements and is used by entities leveraging The API rendering option.

Do these two new PCI DSS Version 4.0 Requirements apply to SAQ A?

The more observant amongst you may notice that the payment page definition on the use of iframes above, don’t quite align to these new PCI DSS Version 4.0 requirements.  A payment page is classed as the iframe containing the payment form, which to align to SAQ A, must be built entirely from the payment gateway, as highlighted under the following eligibility criteria statement from SAQ A:

‘All elements of the payment page(s)/form(s) delivered to the customer’s browser originate only and directly from a PCI DSS compliant TPSP/payment processor.’

What does this mean? These two new PCI DSS Requirements only apply to the payment page, which as already highlighted above, applies to the iframe itself.  As stated within the eligibility criteria of SAQ A, all elements of the payment page must be built only using code from the payment gateway, therefore the entity itself cannot have any code or scripts running within this iframe.

So, how do these two new requirements apply in SAQ A? SAQ A contains the following statements against both these two new requirements:

‘Note: For SAQ A, Requirement 6.4.3 applies to a merchant’s website(s) that includes a TPSP’s/payment processor’s embedded payment page/form (for example, an inline frame or iFrame).’

‘Note: For SAQ A, Requirement 6.4.3 applies to a merchant’s website(s) that includes a TPSP’s/payment processor’s embedded payment page/form (for example, an inline frame or iFrame).’

My interpretation of this is that these two new requirements apply only to the parent web page containing the iframe payment form.

Note: Interestingly, these two new requirements don’t apply to redirect payment mechanisms that also align to SAQ A.

What options do I have to meet these new PCI DSS requirements?

The following sub sections cover mechanisms that can be leveraged to meet these newly introduced PCI DSS Version 4.0 requirements.

For Requirement 6.4.3

A mechanism is implemented into the HTTP protocol designed to confirm that each script is authorized by preventing undefined scripts from running. These techniques are discussed as follows:

  • Content Security Policy (CSP): Implement a CSP to specify which sources of content are allowed to load on your web pages, thereby preventing unauthorized scripts from being executed.  Additionally, it can be used to define where data is allowed to be sent to through a POST request.

A mechanism is implemented into the HTTP protocol designed to assure the integrity of each script.

  • Implement Subresource Integrity (SRI): SRI is a security feature that enables browsers to verify the integrity of resources fetched from third-party sources. By including an integrity attribute with a cryptographic hash in your script tags, you can ensure that the script’s contents have not been altered.

Unfortunately, the final bullet point in Requirement 6.4.3 is more of a manual process, an entity will need to create a detailed inventory of all scripts loaded within payment pages, including their sources and purposes. Regularly review this inventory and update it as necessary to ensure that only authorized and necessary scripts are running on your payment pages.  A robust process should be implemented to ensure this inventory gets updated when scripts are updated, added, or removed.

For Requirement 11.6.1

As we have discussed above, one of the security techniques built into the HTTP Protocol is CSP, designed to identify what scripts are allowed to run.  Although CSP is typically implemented through HTTP Headers, it can also be implemented using a HTML meta element, although you do lose some CSP functionality.  One of the reasons PCI DSS Requirement 11.6.1 has been included into the standard is to ensure that any anti-skimming security measures implemented, such as CSP, are being delivered correctly and have not been interfered with.  If the HTTP headers, or the page contents are not as expected, this could be an indicator of compromise and therefore needs to be flagged and investigated as part of an incident response process.

Looking at the PCI DSS guidance for Requirement 11.6.1, the intention of this requirement is to detect changes and indicators of malicious activity at the consumer browser (client-side), and not server-side. It is acknowledged in the guidance that active content can be pulled into the page from multiple internet locations, making it much harder to identify malicious activity through third-party JavaScripts.  There have been many attacks whereby third-party scripts have been compromised, which quite often is outside of the control of the entity that is consuming them, since the scripts are hosted at third-party locations. One might think it is easy to control by hosting the scripts on the local web server, however some providers require scripts to be consumed from the third parties’ locations.

The guidance highlights several techniques that can be used to help meet the individual points of Requirement 11.6.1.  These include:

  • Utilising the report-to / report-uri CSP directives to report CSP violations;
  • Identifying changes to CSP itself to detect tampering;
  • Performing external monitoring of received web pages to detect changes in JavaScript in payment pages and alert personnel;
  • Embedding tamper-resistant, tamper-detection scripts into payments pages that can alert and block malicious script behaviour; and/or
  • Reverse proxies and Content Delivery Networks (CDNs) can detect changes in scripts and alert staff.

Looping back on the discussion of intent, i.e being able to detect this activity at the browser, once the page is fully constructed, I’ve been struggling with some of the techniques identified in the guidance.  My biggest confusion has been around the reverse proxies and CDNs ability to detect changes in scripts.  This seems straight forward in that scripts are retrieved through these technologies; however, would this not fall over where scripts are being hosted on third-party services? I’ve had many a conversation with various colleagues on this point and Cloudflare has a solution whereby CSP is pushed out through the CDN to enable alerting mechanisms to help meet these requirements.  Through Cloudflare’s Page Shield service, the ‘Content-Security-Policy-Report-Only’ CSP header is included within the HTTP responses to help provide notification mechanisms.  Additionally, the service includes additional security mechanisms to identify known malicious script locations, script changes, etc…

Another technique I’ve been struggling with a little is performing external monitoring. My initial thoughts on this were to run regular scans of the payment pages to monitor for changes in the scripts and headers. My initial concerns were around where payment pages are behind multi-form pages that are part of the customer journey before being presented with the payment page(s).  Some vulnerability scanning tools can find this problematic and may struggle to hit the correct pages. The exact wording of the following bullet point within the guidance helps to clarify this a little:

  • External monitoring by systems that request and analyze the received web pages (also known as synthetic user monitoring) can detect changes to JavaScript in payment pages and alert personnel.

Synthetic user monitoring (aka synthetic monitoring or synthetic transaction monitoring) is something I had never come across before so needed to delve into what this was. In essence, it is a technique used to simulate user interactions with an application to collect various data, for example, response times, errors, availability, etc….  In this case of PCI DSS Requirement 11.6.1, between a user and the e-commerce website. This monitoring is achieved using scripted user interactions with the website.  In theory, the scripted requests should be able to walk through multi-form pages to land at the payment page(s) so the fully retrieved page can be analysed.

I’ve had a quick look to see if I can find any synthetic user monitoring products that may be able to help with this requirement and, most of the products I’ve found seem to focus more on performance metrics.  The exception being (although there are probably others out there) a product by RapidSpike, which seems to include Magecart style detection.

Note: ASV Scanning is not designed to fulfil PCI DSS Requirement 11.6.1 as it is unable to perform the payment page analysis required to detect script/header changes.

Let’s now discuss the individual elements of PCI DSS Requirement 11.6.1 and how one could meet these individual requirement objectives:

  • The mechanism is configured to evaluate the received HTTP header and payment page.

The listed techniques included in the guidance highlights several commercial options which will all fully or partially meet this requirement.  This includes commercial tooling like the RapidSpike solution discussed earlier along with Cloudflare, and both JScrambler and Report-Uri (doesn’t appear to report on HTTP header modifications) which I’ll discuss later on.

The issues I’m having is around the use of CSP and SRI alone, which configured correctly can be used to evaluate JavaScript discrepancies, I’ve been unable to identify an inbuilt HTTP security feature that can detect CSP tampering and HTTP header evaluation. The only potential way to achieve this is to build a JavaScript component, protected by both CSP and SRI, that is able to evaluate the received header and compare this against what should be received and alert to any discrepancies.

  • To alert personnel to unauthorized modification to the HTTP headers and the contents of payment pages as received by the consumer browser.

The CSP directives; report-to and report-uri are used to report CSP violations which will flag JavaScript code that isn’t permitted to run, providing CSP is configured correctly.  I don’t believe this will help report HTTP header modifications or CSP changes, which as discussed above will require a programmatic technique through some JavaScript. These two directives will trigger reporting each time CSP issues are picked up within the customer browser.

For SRI, reporting of failures need to be programmatically written by capturing the error event.

External monitoring through synthetic user monitoring, embedded tamper resistant/detection scripts and CDNs will provide the ability to notify personnel of unauthorised modifications.

  • The mechanism functions are performed at least once every seven days or periodically

Although the requirement calls out for “at least once every seven days”, this is another example of where the PCI DSS Version 4.0 includes an option of a target risk analysis by including the “periodically” option. The recommendation would be to carry out this targeted risk analysis to identify what a suitable timeframe is for “periodically”.  Based on your targeted risk analysis, adjust the frequency of your change- and tamper-detection mechanisms accordingly, which may be less than every seven days, depending upon various factors, such as the transaction volume of the e-commerce site.

By implementing these measures, you can better ensure that your environment remains secure and compliant with the new PCI DSS Version 4.0 requirements. These hardening techniques greatly improve the client-side security of the application, so I would personally recommend implementing all measures.

Commercial Solutions

Although the above highlights some techniques organisations can leverage to meet these new PCI DSS v4.0 requirements, it will very much depend upon the complexities of the JavaScript dependencies used by the organisation. If an organisation leverages a lot of JavaScript code, and more importantly, many teams can be involved in commissioning new JavaScript functionality, it can be very difficult to manage.  These HTTP techniques can also be very easy to misconfigure, thus giving a false sense of security.  Third-party commercial (and free) tooling can be a huge help with the management of this.  In theory, these new requirements only apply to the “Payment Page”, so organisations can reduce their use of JavaScript functionality within these payment pages to make the management more simplistic, however often you will get push back from other teams, for example Marketing, who will insist that JavaScript is necessary in all pages, including the payment page.  In addition to this, why limit this to the payment page when often other potentially sensitive information is available within the website that is also at risk of these threats, therefore tooling will make it much simpler to implement these additional security features against the entire website, providing an additional layer of protection and mitigations.

JScrambler

One such third-party tooling is JScrambler that can quickly assist with JavaScript integrity monitoring, though there are open-source tools available which are potentially more technical to implement, as John Elliot describes in his video “Understanding the New PCI DSS Requirements to Prevent E-commerce Skimming Attacks” (a highly recommended watch).  Let us look at John’s explanation of JScrambler in greater detail:

  • Requirement 6.4.3 (Webpage Integrity) consists of four (4) main elements; Inventory, Authorised, Necessary and Integrity, which JScrambler covers.  Since JScrambler is loaded into the webpage, it can build an inventory of all JavaScript code within the page in real time.  Since an inventory is being built in real time, an organisation can record authorisation of scripts.  If a new script appears, JScrambler can be configured to allow the script to run for a configurable period before authorisation is required, or it can be configured to block the script until authorisation is recorded. Within the inventory, JScrambler includes the ability to record a business justification for each script.  Finally, integrity is covered by JScramblers ability to delve into the functionality of the script by analysing the functionality and behaviour of the script to determine if the script is doing anything that is questionable and can block the script if it determines that it is acting in a malicious way.
  • Requirement 11.6.1 (Detect Changes) again John discusses four (4) main elements; Page Content, HTTP Headers, 7 days or periodically and Alert.  The first two elements are covered in JScrambler through the JScramblers ‘Webpage Integrity’, page content changes and HTTP Header changes are detected in real time.  JScrambler is working on an update which will collate changes across the customer base to provide recommendations if script changes can be deemed as safe or not.  As an example, if JQuery provides an update to the script, which is seen across the customer base and an analysis of the functionality and behaviour doesn’t flag anything, JScrambler will be able to provide feedback on the change to suggest that it is probably safe to authorise. Since JScrambler is running within each webpage, this is ‘Realtime’ and therefore goes above and beyond the 7 days or periodically requirement of Requirement 11.6.1.  Finally, Alerting is built into JScrambler that can provide email alerts, shown within the JScrambler dashboard, and can be pushed into a SIEM solution. 

JScrambler can also identify and block malicious activity along with malicious access into form fields.

Report-Uri

Report-URI is another tool that provides protections against Magecart style attacks, allowing you to meet these new PCI DSS Version 4.0 requirements.  Report-URI’s ScriptWatch, is designed to monitor JavaScript dependencies in real time detecting new dependencies and changes in existing ones, providing alerts and auditing capabilities. What I like about Report-URI is an additional tool called, Data Watch, which tracks client-side communications and can provide alerts if data is sent to new destinations.

Wait! If these scripts are in scope, does this make the supplier a service provider?

This was an interesting question that someone posted on a LinkedIn post. The reason this was posted is because a service provider is not just a 3rd party entity that processes, transmits, or stores cardholder data on behalf of its customer, but is also an entity that can impact upon the security of cardholder data of its customer.  As we have discussed within this blog, JavaScripts can pose a security risk to the e-commerce payments, hence why this question was raised.

Although many organisations will utilise commercial JavaScripts within their e-commerce platforms, there are a lot of opensource JavaScripts that are used; for example, JQuery, Bootstrap, Angular, etc… where you would struggle to fulfil the PCI DSS service provider requirements.  I don’t believe the intention of the PCI SSC and Card Brands was to include the JavaScript developers into scope, these two PCI DSS Requirements were simply included to provide protection mechanisms to this specific threat vector.

My Ramblings

Overall, I think these additional requirements are a great addition to the PCI DSS, this attack vector has been an ongoing issue for many years, so it is great to see it being addressed.  Although there are techniques already built into the HTTP Protocol itself to deal with the technical elements of PCI DSS Requirement 6.4.3, PCI DSS Requirement 11.6.1 seems to still be a challenge. I have struggled to identify a way to leverage security features built into the HTTP Protocol itself to check for issues with both the headers and JavaScripts.  My only conclusion is that third-party commercial tooling must be used to allow you to meet the full intent of Requirement 11.6.1.

There are definite benefits in looking at commercial tooling to help manage the volumes of JavaScript code that can exist in large and complex e-commerce deployments.  The additional benefit of this is that it can be much easier to manage across the entire website, instead of limiting it to just the payment pages. At the end of the day, this attack vector can also be used to access other data, or to deploy other attacks and therefore organisations should be looking at this across the entire website.

Finally, I would love to see JavaScript functionality stripped back from the payment pages. Reducing your attack surface, greatly reduces the risk of a successful attack against this attack vector.

PCI SSC Online Skimming Blog Post

On the 1st August 2019, the PCI Security Standards Council (PCI SSC) released a new blog post called “The Threat of Online Skimming to Payment Security” and a PCI SSC bulletin “THE THREAT OF ONLINE SKIMMING TO PAYMENT SECURITY” discussing the emerging threat of online skimming.

There have been many high-profile e-commerce compromises, especially ones linked to the Magecart “Skimming” attacks discussed within the PCI SSC released blog/bulletin.  Some companies hit by this attack include; British Airways, Ticketmaster, OXO, Feedify and Newegg.

So, what is Magecart?

Magecart is a term being used to describe an attack involving the use of malware within a website that is used to skim cardholder information being submitted by the end-user.  The aim is to use the malware to skim end-users card details and any other personal information that can be used to facilitate online payments.  The malicious code could be added directly to the e-commerce site through a site compromise or can be included as part of a compromised third-party script that is loaded by the e-commerce site.  Often, third-party scripts are added to e-commerce sites to perform functionality such as; advertising, live chat functionality, web tracking functionality, etc.

Although Magecart is being used to describe this specific type of attack, Magecart is also a term given to the cybercriminal group responsible for these types of attacks.  According to the ‘Inside Magecart: Profiling the Groups Behind the Front Page Credit Card Breaches and the Criminal Underworld that Harbors Them’ joint research paper by RiskIQ and Flashpoint, this term is used to encompass at least seven cybercriminal groups using this technique of utilising card skimmers on compromised e-commerce sites.

The RiskIQ / Flashpoint paper identifies the first Magecart group emerging in 2015, however acknowledges that it may have been active since 2014 based on when domain names used by the group were created.

There are some key points for this type of attack;

  1. iframe and redirect payment techniques are less susceptible to this type of attack, if cardholders are using compliant web browsers.  This attack relies on the malicious JavaScript (JS) being able to interact with the payment information to skim this information during the payment journey.  Within an iframe, the ‘Same Origin Policy (SOP)’ ensure the JS cannot interact with the iframe, providing a compliant web browser is used by the cardholder.  For the JS to be able to manipulate iframe/redirect payment functionality, the payment journey would need to be manipulated to allow for the payment to still succeed. There is still a risk of compromise of CHD (Cardholder Data) from iframe and redirect payment functionality and therefore organisations may look to go above and beyond SAQ A as discussed in one of my previous posts “Why the PCI DSS Version 3.2.1 SAQ A update isn’t enough!”.
  2. Where a Direct Post, JavaScript or API payment technique is used to process the payment, entities should not remotely load any scripts into the payment page.  CSP (Content Security Policies) should be used to restrict this to protect from compromised third-party scripts or scripts hosted in less secure environments.  CSP can be used to also white-list trusted sources, however the recommendation would be to keep all scripts on the e-commerce site which can be validated by the entities staff before being uploaded to the site.
  3. FIM should be used to detect changes within the e-commerce source code to help identify the inclusion of malicious code.
  4. The PCI SSC released article suggests that where externally hosted third-party scripts are included within the e-commerce payment flow, these third-parties should be classed as PCI DSS Service Providers.  This does meet the “or can impact upon the cardholder data or CDE” caveat of a Service Provider (See Third-Party Service Providers) therefore this needs to be seriously considered by all organisations running e-commerce websites.  The only possible exception to this could be for iframe/redirect functionality as the use of third-party scripts shouldn’t have access to the contents of the iframe. It is however worth confirming this with the Acquirer or card brand since scripts loaded into the parent page could be feasibly used to alter the payment flow.

My Final Ramblings

A lot of the advice within the PCI SSC blog post should be implement as part of PCI DSS as these attacks would realistically only work (and be sustainable) against Direct Post, JavaScript and API e-commerce payment channels.  These types of channels will align against either SAQ A-EP (Self-Assessment Questionnaire) or SAQ D whose PCI DSS requirements cover the points within the PCI SSC Magecart Bulletin’s Detection and Prevention best practices sections.

Additionally, my previous post; “Hacking E-Commerce Payment Channels” discusses a lot of these points.

It is worth noting that iframe and redirect payment channels are deemed by the PCI SSC and Card Brands as lower risk thank the other e-commerce payment techniques, they still need to be adequately secured.  These e-commerce sites can still be compromised and modified to expose cardholder data.  For me, the main difference is that it is much harder to compromise the site and maintain the payment functionality. In 2016, Foregenix released an alert entitled “Major UK Payment Service Provider iFrame Man-In-The-Middle Breach” that demonstrated an attack which compromised an iframe deployment, whilst still being able to facilitate a payment proving that a determined attacker could feasibly maintain the payment functionality.

It is therefore important to consider security of iframe/redirect deployments as you would any other website within the organisation.  This is something I touch upon within the following blog article; “Why the PCI DSS Version 3.2.1 SAQ A update isn’t enough!”