osec.one case analysis cover: Ledger Connect Kit 2023, a former employee's npm account and five hours of wallet drainers

On the morning of 14 December 2023 someone phished a former Ledger employee. That person's npm account could still publish @ledgerhq/connect-kit, the library that shows the "connect your Ledger" dialog on decentralised-finance (DeFi) websites. Within two hours the attacker had published three malicious versions. Nobody at those websites deployed anything: a small loader in their pages fetched the newest 1.x version from a public CDN every time a visitor opened the page, so the wallet drainer arrived by itself.

Ledger puts the impact at about $600,000 in user assets, says the malicious file was removed within 40 minutes of Ledger learning of it, and counts about five hours from the npm compromise to full resolution because of CDN caching. This write-up rebuilds the timeline from the npm registry's own publish times, explains why sites that "pin their dependencies" were hit anyway, and maps each step to the control that would have stopped it.

Five steps: a former employee is phished; the npm access was never revoked; three malicious connect-kit versions are published; the loader on each dApp fetches connect-kit@1 from jsDelivr; visitors sign approvals that a drainer contract sweeps
Five steps from a phishing email to drained wallets. No dApp shipped a new build.

The timeline, from the registry

The publish times below come from the npm registry's time field for @ledgerhq/connect-kit (UTC, to the second). Ledger's incident report gives the same events in CET (UTC+1).

14 Dec 2023, UTCEventSource
6, 12, 13 DecAn npm package with a random name, 2e6d5f64604be31, is published three times (1.0.0-1.0.2); 1.1.5 and 1.1.6 later pull the drainer from itnpm registry, Sonatype
morningFormer employee phished; attacker gets into their npm accountLedger
08:49:04connect-kit 1.1.5 publishednpm registry
09:44:571.1.6 publishednpm registry
10:37:241.1.7 published, drainer embeddednpm registry
10:43Blockaid's scanner flags hey.xyz (vendor's own account)Blockaid
11:00-13:00The window in which Revoke.cash users could have been hitRevoke.cash
12:28Blockaid posts publicly, after telling LedgerBlockaid
12:45Ledger awareLedger
13:18:351.1.8 (clean) published by a Ledger developer accountnpm registry
13:55Tether freezes the attacker's USDTLedger
15:17GitHub advisory GHSA-g9hp-hq3h-h6hx (malware, critical) for >=1.1.5, <=1.1.7GitHub
15 Dec, 10:18connect-kit-loader 1.1.8 pins @1.1.8 instead of @1npm registry

The arithmetic:

• First malicious publish to clean release: 08:49:04 → 13:18:35 = 4 h 29 min on npm.
• Ledger aware to clean release: 12:45 → 13:18 = 33 min (Ledger says "within 40 minutes").
• Drainer embedded (1.1.7) to the first outside alert: 10:37 → 10:43 = 6 min. Alert to Ledger being aware: about 2 h, the slowest link in the chain.
• Add CDN caching after 13:18 and Ledger's "about 5 hours" ends around 13:49 UTC. Ledger estimates active draining at under two hours in total.

Step 1: an npm account that outlived the job

Ledger's report says internal access is removed automatically when someone leaves, but outside services such as npm "must be handled manually with an employee offboarding checklist", and "in this individual case, the access was not manually revoked". The account had two-factor authentication. Ledger's report gives two explanations for getting past it: the timeline says a session token was used, the root-cause section says an API key tied to the account. Either way, npm accepted a credential that did not need a second factor at publish time.

What breaks this step:

1. Remove leavers from the npm organisation on their last day. npm's documentation: when a user loses access to a package or org, their granular access tokens lose it too. Removing the member from @ledgerhq would have killed the key.
2. Put npm, PyPI, GitHub, the CDN and DNS on the offboarding checklist, by name, with a second person ticking them.
3. Set the package to "Require two-factor authentication and disallow tokens". This blocks every token, including granular tokens flagged to bypass 2FA, so a stolen token can't publish.
4. Review who can publish every quarter: npm access list collaborators @scope/pkg and the org's member list. Anyone who hasn't published in a year doesn't need the right.

Step 2: three versions, two ways to load the drainer

Sonatype's analysis found that 1.1.5 and 1.1.6 fetched the payload from the separate random-named package, while 1.1.7 carried it inline (SlowMist describes 1.1.5 as a test-like message, so the two accounts differ on the first version). The payload replaced the real connect dialog with a fake one. Once a visitor connected a wallet, it asked for:

• token approvals and permit signatures for ERC-20 tokens and NFTs, which let the attacker's contract move them later;
• a fake "claim" transaction or plain transfers for native coins.

The funds went through a rogue WalletConnect project to a drainer contract that split proceeds 85% to the attacker, 15% to the drainer-kit operator. Ledger and Blockaid name the kit as Angel Drainer; SlowMist pointed to the string "Inferno" in the code.

Step 3: why sites that pin dependencies were hit

DeFi sites didn't install connect-kit directly. They installed @ledgerhq/connect-kit-loader, usually pulled in by wallet libraries such as Wagmi. The loader's own version was pinned in each site's lockfile. But the loader (1.1.2, August 2023) did one thing at runtime: it added a script tag pointing at jsDelivr with a major-version range and no integrity hash.

html
<!-- what connect-kit-loader 1.1.2 injected (Aug 2023) -->
<script src="https://cdn.jsdelivr.net/npm/@ledgerhq/connect-kit@1"></script>

<!-- what loader 1.1.8 injected after the incident (15 Dec 2023) -->
<script src="https://cdn.jsdelivr.net/npm/@ledgerhq/connect-kit@1.1.8"></script>

@1 means "the newest 1.x.y on npm". Ledger described the design as a feature: dApps "always have the most recent version ... without the need to manually update package versions and release new builds". Revoke.cash, which pins its dependencies, wrote afterwards that it "failed to realise that the ledger-connect-kit library was not pinnable". Its lockfile was correct; the code its visitors ran was not in the lockfile at all.

How jsDelivr treats the two URLs (from its README; headers we fetched on 28 Oct 2026, not the 2023 values):

URL formCDN cacheCache-Control we sawCan a new npm publish change it?
connect-kit@1 (range)7 days, purgeable by requestmax-age=604800, s-maxage=43200 (7 days browser, 12 h edge)Yes, on the next cache refresh
connect-kit@1.1.8 (exact)"effectively forever"max-age=31536000, immutableNo. npm doesn't allow republishing a version number

The range URL is also why the fix took longer than the npm publish: a purge clears jsDelivr's caches, but a browser that fetched the bad file keeps it as long as its own max-age allows.

Step 4: who served it

Sonatype counted the loader as a dependency of more than 20,454 GitHub repositories; Blockaid estimated over 100 live front-ends affected.

SiteWhat happenedSource
Revoke.cashServed the drainer (via Wagmi); locked the site behind auth, removed the dependency, redeployed in about 1 hRevoke.cash retrospective
SushiSwapServed the drainer; its CTO told users not to use any dAppBlockaid, The Block
ZapperServed the drainerBlockaid
hey.xyz (Lens)Served the drainer; where Blockaid's first alert firedBlockaid
KyberSwitched its front-end offThe Block
LidoSwitched front-ends off as a precaution (not reported compromised)Cointelegraph
Balancer, PhantomReported affected by Cointelegraph; no first-party statement foundCointelegraph

The money

FigureWhoWhen
about $150,000 in the first couple of hoursBlockaid, via The Block14 Dec
about $483,000 received by the attacker address, $44,000 of it USDTDeBank, via The Block14 Dec
at least $484,000Lookonchain, via CoinDesk and Cointelegraph14 Dec
about $600,000 in assets impactedLedger20 Dec

Tether froze the attacker's USDT at 13:55 UTC; neither Ledger nor Tether published the amount, and DeBank showed $44,000 in USDT at the address. On 20 December Ledger promised to make every victim whole, customers or not, by the end of February 2024. We found no published figure for what was actually paid. No reliable victim count exists either: the "180" that circulated refers to incidents linked to the drainer contract's creator, not to wallets drained in this attack.

What Ledger changed

• 14 Dec: connect-kit developers on npm set to read-only; GitHub publishing secrets rotated; developers told to wait 24 hours before using Connect Kit again.
• 20 Dec report: an audit of access to internal and external tools, external tools added to offboarding, code signing "when relevant", more controls at the deployment stage, a third-party audit of access and distribution in early 2024, an end to blind signing.
• In the registry: every release from 1.1.9 (January 2024) on is published by a CI account, not a person. None of them carries npm provenance.

Controls for your own sites and packages

Step in this attackControlWould it have stopped it?
Ex-employee still had publish rightsRemove from the npm org on the last day (kills their granular tokens); external services on the offboarding checklistYes, outright
A token or session got past 2FAPackage setting "Require 2FA and disallow tokens"; publish only through trusted publishing (OIDC from CI, npm CLI 11.5.1+)Yes: no long-lived credential to steal
A person published from a laptopTrusted publishing plus provenance, and a policy that consumers check itOnly if real releases carry provenance and someone checks it; Ledger's releases had none, before or after
Loader fetched @1 at runtimeBundle the library at build time, or load an exact version with an integrity hashYes: a changed file fails SRI and the browser refuses to run it
Drainer asked for approvalsWallets that decode and show what a signature allows (Ledger ended blind signing)Reduces losses; doesn't stop the injection
2 h between first alert and vendor awarenessA security contact on the package (security.txt, npm/GitHub security policy) that someone watchesShortens the window

SRI is the browser-side control: <script src="https://cdn.jsdelivr.net/npm/pkg@1.2.3/dist/x.js" integrity="sha384-..." crossorigin="anonymous">. It only works on an exact version, which is the point: a range URL can't carry a hash because its content changes with every release. The free osec SRI check reads a page's script and stylesheet tags, flags third-party files without integrity and URLs whose content changes under the same address (no version in the path), and gives you the attribute to paste. It only sees tags in the HTML, so a loader like this one, which adds its tag at runtime, needs a look at the bundle too: search your built JavaScript for cdn.jsdelivr.net, unpkg.com and @latest.

How it differs from the other npm cases

• event-stream (2018): the author handed publish rights to a stranger who asked for them; the trust was given, not stolen, and the payload sat for about two months.
• Shai-Hulud (2025): a worm that stole tokens from developers and CI and republished hundreds of packages by itself.
• Ledger (2023): one forgotten credential, used once, no worm. The reach came from runtime loading of a version range, the same trust-the-URL problem as Polyfill.io, where the domain itself changed hands.

Paste a page URL and see every script and stylesheet it loads from other origins: which carry an integrity hash, which change under the same address, and the integrity attribute to add. Free, no account.

Run the SRI check

Sources

• Ledger, Security incident report (20 Dec 2023): https://www.ledger.com/blog/security-incident-report
• Ledger, letter from the Chairman and CEO (14 Dec 2023): https://www.ledger.com/blog/a-letter-from-ledger-chairman-ceo-pascal-gauthier-regarding-ledger-connect-kit-exploit
• npm registry metadata, @ledgerhq/connect-kit (publish times): https://registry.npmjs.org/@ledgerhq%2Fconnect-kit
• npm registry metadata, @ledgerhq/connect-kit-loader: https://registry.npmjs.org/@ledgerhq%2Fconnect-kit-loader
• GitHub advisory GHSA-g9hp-hq3h-h6hx: https://github.com/advisories/GHSA-g9hp-hq3h-h6hx
• Blockaid, Attack report: Ledger Connect Kit: https://www.blockaid.io/blog/attack-report-ledger-connect-kit
• Sonatype, Decrypting the Ledger Connect Kit compromise: https://www.sonatype.com/blog/decrypting-the-ledger-connect-kit-compromise-a-deep-dive-into-the-crypto-drainer-attack
• Revoke.cash, Ledger Connect Kit hack retrospective: https://revoke.cash/blog/2023/ledger-connect-kit-hack-retrospective
• SlowMist, Supply chain attack on Ledger Connect Kit: https://slowmist.medium.com/supply-chain-attack-on-ledger-connect-kit-analyzing-the-impact-and-preventive-measures-1005e39422fd
• The Block (14 Dec 2023): https://www.theblock.co/post/267614/ledger-connectkit-library-security-flaw-dapps-compromised and https://www.theblock.co/post/267691/tether-freezes-wallet-of-ledger-library-exploiter-ledger-provides-more-details
• CoinDesk (14 Dec 2023): https://www.coindesk.com/business/2023/12/14/ledger-exploit-drained-484k-upended-defi-former-staffer-linked-to-malicious-code
• BleepingComputer: https://www.bleepingcomputer.com/news/security/ledger-dapp-supply-chain-attack-steals-600k-from-crypto-wallets/
• Cointelegraph, dApps pause Ledger Connect: https://cointelegraph.com/news/decentralized-applications-pause-ledger-connect-as-exploit-fix-deployed
• npm docs, About access tokens: https://docs.npmjs.com/about-access-tokens ; Requiring 2FA for package publishing: https://docs.npmjs.com/requiring-2fa-for-package-publishing-and-settings-modification ; Trusted publishers: https://docs.npmjs.com/trusted-publishers
• jsDelivr README (caching of exact versions and ranges): https://github.com/jsdelivr/jsdelivr
• npm blog, Details about the event-stream incident: https://blog.npmjs.org/post/180565383195/details-about-the-event-stream-incident