Transcend Docs

Walk through a client-side attack

Follow one attacker through the controls in airgap.js, and see which control stops each attempt, what you see afterward, and what still gets through.

This page follows one attacker through your page. After reading it, you can match each attempt to the airgap.js setting that stops it, and say what you would see afterward.

The attack is web skimming. An attacker gets a script onto your checkout page, often through a third-party vendor. The script reads the form and sends the data to a server that the attacker controls. The same pattern has other names, such as Magecart and formjacking.

Run it yourself

The airgap security demo is a small page that makes attempts 1 to 3 below, plus one call to an approved host as a control. It runs in four modes: off, report-only, block, and block with navigation control.

What the attacker tries

AttemptWhat the script does
1Loads an image from a host you never approved, with the data in the URL.
2Calls fetch on an unapproved host from an injected inline script.
3Sets location to an unapproved host, with the form fields in the query string.
4Sends the data to a host you approved, but to the attacker's own account on it.
5Sends an email address or card number to a third-party host that your rules allow.

Which control stops each attempt

AttemptNothing installedReport-onlyBlock unknown requestsBlock plus navigation control
1Data leaves.Data leaves. Host listed.Stopped. The host appears in Triage.Stopped.
2Data leaves.Data leaves. Host listed.Stopped. The host appears in Triage.Stopped.
3Data leaves.Data leaves.Data leaves. The page is replaced.Stopped. The navigation host appears in Triage.
4Data leaves.Data leaves.Data leaves. The host is approved.Data leaves. The host is approved.
5Data leaves.Data leaves.Data leaves if the host is approved.Data leaves if the host is approved.

Attempts 4 and 5 need a request override. See Attempt 4 and Attempt 5.

Use Block to enforce

Report-only mode tries to allow every request. Use it to build an inventory, not to stop an attack. See Inventory a site in report-only mode.

Attempts 1 and 2: unapproved hosts

Set the Unknown Request Policy to Block. airgap.js blocks requests to hosts that are not in your data flows.

In the browser, the Network tab shows no request to the host. In Triage, the host appears as a new host, so you learn that something tried to reach it. See Block unknown requests.

Attempt 3: navigation

A navigation replaces the page, so request rules do not see it. Turn on navigation control to treat it as a request. airgap.js then cancels a navigation to an unknown host. See Stop exfiltration through navigation.

Navigation control needs the Navigation API for full coverage. In an older browser, it covers only form submissions and window.open().

Attempt 4: an approved host with the wrong account

A host in your data flows is allowed for every request. A script can use that to send data to its own account on a vendor you approved. A host rule cannot tell your account from the attacker's.

A request override can. It reads the URL and blocks any request with an account that is not yours. See Pin the analytics account.

Attempt 5: sensitive data sent to an allowed host

An override can also read the content of a request. Block an email address, a card number, or a session token that is headed to a host outside your site. See Write request overrides.

What you see afterward

ControlWhere to look
Block unknown requestsTriage lists the new host. The Network tab shows no request.
Generated CSPThe browser fires a securitypolicyviolation event. airgap.js sends the blocked host to telemetry.
Navigation controlTelemetry lists the navigation host. The page stays in place.
Request overrideThe Network tab shows no request.

Telemetry sends only the host and scheme of each request. It never sends the path or query string, so a stolen card number in a URL does not reach telemetry.

What this does not stop

  • A compromised script on an allowed host can still run. airgap.js authorizes by URL and host. It does not hash script contents or read what a script does. Use Subresource Integrity and a nonce-based script-src in your header for that.
  • A script that loads before airgap.js is not regulated. airgap.js must be the first script on the page.
  • Overrides cannot wait. A rule runs in the page and cannot call a remote service. It sees only text bodies.
  • Browser actions are out of reach. Typing in the address bar and the back and forward buttons are not covered by navigation control.

See the security overview for the full list.

On this page