Skip to content
MonSpark home

Why a Content Security Policy alone does not meet PCI DSS 11.6.1

A Content Security Policy (CSP) helps with PCI DSS 6.4.3 and 11.6.1, but it does not meet 11.6.1 alone. A CSP tells the browser which sources can supply scripts and which hosts the page can contact. It does not see a changed file at an allowed URL, and it does not alert on header changes. Requirement 11.6.1 asks for exactly that: detect changes to script contents and security-impacting HTTP headers as the browser receives them, and alert your personnel. The PCI SSC guidance agrees: a CSP needs complementary processes.

What PCI DSS 11.6.1 asks for

Requirement 11.6.1 asks for a change and tamper detection mechanism on payment pages. The PCI SSC information supplement Payment Page Security and Preventing E-Skimming quotes the requirement. The mechanism must:

  • Alert personnel to unauthorized modification of the security-impacting HTTP headers and the script contents of payment pages, as the consumer browser receives them. This includes indicators of compromise, changes, additions and deletions.
  • Evaluate the received HTTP headers and payment pages.
  • Run at least once a week, or at a frequency that a targeted risk analysis under Requirement 12.3.1 sets.

The guidance names three signals: a header or a script newly appears, is changed, or is deleted. It also lists the CSP itself as a security-impacting header.

The requirement became mandatory on 31 March 2025. Before that date, it was a best practice (PCI SSC podcast transcript).

Requirement 6.4.3 is the preventive partner. It asks for authorization, integrity and a justified inventory for each payment page script.

What a Content Security Policy does

A CSP is a set of directives that a site sends to the browser, usually in the Content-Security-Policy response header (MDN CSP guide). The browser then limits what the page can load and execute.

Allow lists for scripts, connections and frames

The MDN directive reference lists the directives that matter on a payment page:

  • script-src sets the valid sources for JavaScript.
  • connect-src limits the URLs that scripts can contact with fetch(), XMLHttpRequest, WebSocket, EventSource and sendBeacon() (MDN).
  • frame-src sets the valid sources for iframes.
  • form-action limits the targets of form submissions.

A skimmer must send the card number somewhere, so connect-src matters on a payment page. The CSP Level 3 specification says that a CSP can mitigate data exfiltration with allow lists of servers. It also warns that a policy without default-src cannot do this. The least restrictive directive sets the real limit.

A CSP can also use nonces or hashes instead of host names. A hash-based policy lets a script run only when its hash matches the value in the policy (MDN CSP guide).

Report-only mode and violation reports

A CSP has two modes. The Content-Security-Policy header enforces the policy. The Content-Security-Policy-Report-Only header monitors it. In that mode, the browser reports violations but blocks nothing (CSP Level 3).

Reports go to the endpoint that the report-to directive names (MDN CSP guide).

The PCI SSC guidance gives the CSP fair credit. It says the CSP "can be quite effective for script authorization and, to some extent, script integrity". Its Table 4 lists the CSP as a control for script integrity, inventory, alerting and script content changes.

What a CSP cannot see

The same guidance lists the limits. A CSP cannot create a list of unauthorized scripts. It cannot alert on changes to security-impacting HTTP headers. It keeps no baseline of normal activity across sessions. It cannot confirm that a script changed its internal function, unless the script also contacts a disallowed domain.

A changed file at an allowed URL

A location-based policy allows content from each listed source (MDN CSP guide). Suppose Acme allows https://cdn.example.net/widget.js on its checkout at shop.example. An attacker changes the file on that host. The URL stays the same, so the browser runs the new code. No violation occurs, so no report goes out.

The new code can then read John Doe's card number during his $129.00 order. If it sends the data to a host that the policy allows, the CSP stays silent.

Hash-based policies close part of this gap. A changed file gets a new hash, and the browser blocks it. But MDN notes that you must calculate the hash again after each change to the script. The PCI SSC guidance adds that a CSP with hashes is hard to maintain in dynamic environments.

Inline code when 'unsafe-inline' is allowed

If a policy contains default-src or script-src, inline scripts do not run unless the policy allows them (MDN CSP guide). The 'unsafe-inline' keyword removes this restriction. MDN warns that this keyword "defeats much of the purpose of having a CSP". With it, a changed inline block on the payment page passes the policy. Nonces or hashes close this gap, because browsers ignore 'unsafe-inline' when a directive also contains one.

What an allowed script reads in the page

A CSP decides which code loads and where requests go. It does not decide what allowed code does inside the page. MDN explains that code in a page can do anything that the site's own code can do, including access to page content. Thus an allowed script can read the card number field. The directive reference has no directive that limits which script reads which form field. The PCI SSC guidance recommends that you baseline script behavior and limit script access to sensitive data.

Header changes and deletions

A CSP is itself a header. If a deploy removes it or makes it weaker, the browser applies what it receives. The guidance states that a CSP cannot detect deletions of security-impacting headers. Requirement 11.6.1 asks for exactly that signal, for the CSP and for headers such as Strict-Transport-Security.

Where Subresource Integrity helps

Subresource Integrity (SRI) puts a hash in the integrity attribute of a <script> or <link> element (MDN SRI). The browser calculates the hash of the fetched file and compares it with the attribute. If the values do not match, the browser refuses to load the file. For a pinned library version on a CDN, SRI closes the gap of a changed file at an allowed URL.

The PCI SSC guidance calls SRI simple to configure for static scripts. It helps with third-party scripts only if their updates are predictable and infrequent.

Where Subresource Integrity fails

SRI needs a fixed file. The guidance calls SRI "not practical for rapidly changing scripts or content that changes unpredictably". Its example is dynamic third-party scripts. Each vendor release changes the hash, and the browser then blocks the script.

SRI checks only an element that has an integrity attribute. A script that another script adds at run time gets no check, unless that code sets the attribute.

The guidance also says that SRI fails silently, with no native alert and no reporting. Newer web platform features make this gap smaller. The Integrity-Policy header blocks and reports scripts that load without integrity metadata. The CSP Level 3 draft adds hash reports, which send the hash of each loaded script to a reporting endpoint. A system still has to compare these signals with an approved list and alert a person.

What 11.6.1 asks for in addition to CSP and SRI

Keep the CSP and SRI as the preventive layer. The guidance states that the mechanism "can be a single or multiple mechanisms that collectively meet the requirement". Add these parts:

  1. A baseline. Record a hash for each approved script version and the expected value of each security-impacting header.
  2. A comparison with what the browser receives. Load the payment page as a browser does, or watch real visitor sessions. The guidance calls this agentless and agent-based webpage monitoring.
  3. All three change types. Detect new, changed and deleted items, for scripts and for headers.
  4. An alert to a named owner. The guidance points to Requirement 11.1.2 for roles and responsibilities in Requirement 11.
  5. A schedule. Weekly is the minimum without a targeted risk analysis. The guidance recommends frequent or even real-time monitoring where feasible.

CSP violation reports are a good input to this mechanism. But they do not replace the baseline and the comparison.

How MonSpark uses the CSP as one layer

MonSpark Client-Side Protection builds a CSP header from the scripts and hosts that you approve. It gives you a report-only version to test first. It also collects your CSP and SRI violation reports.

For 11.6.1, MonSpark compares the content of each script, not only its URL. It keeps a SHA-256 hash for each script version and compares it on every scan. A new, changed or removed script, or a changed header, opens an incident. Escalation policies send it by email, Slack, Microsoft Teams, Discord, Telegram, webhook, SMS or phone call.