On this page
- What actually happened at Binance
- Why a coding assignment is a perfect delivery system
- Building the attack in our lab
- What the install actually did
- Detecting it: from a noisy rule to a precise one
- Catching it before it runs: a read-only pre-flight
- Remediation
- What we know and what is unconfirmed
- Checklist
- Tooling and references
In November 2026 Binance published an account of how attackers drained roughly $6.3 billion from its wallet systems. The starting point was not a clever exploit against the exchange. It was a developer, a job offer, and a piece of homework.
A developer's laptop is one of the most powerful machines in any company. It holds live cloud tokens, SSH keys, container-registry logins and the ability to push code that ships to production. An attacker who gets a single command to run on that laptop often needs nothing else. This post looks at one route onto that laptop, the "malicious coding assignment", rebuilds it in our lab, and shows the detection and the pre-flight check we use to catch it. We never touched Binance's systems or malware: the lab reproduces the class of technique from public reporting, with our own code.
What actually happened at Binance
Binance's incident report, summarised by several outlets, describes a campaign that ran for months before the theft. The sequence, as reported:
- In June 2026, an engineer on the wallet DevOps team searched for a popular AI coding tool and installed a tampered Homebrew package. Binance's team spotted the activity, replaced the device and reset credentials, but the attackers had already learned who worked on the wallet infrastructure.
- In September, a second engineer was approached through a job platform, went through two rounds of fake interviews, and was asked to install a coding "assignment" on a work computer. The malware inside it was not flagged by endpoint security.
- By 20 October, the attackers had used that machine and an internal AI tool to reach two more engineers, one of whom could approve deployments.
- On 29 October, they deployed a container that was permitted to submit withdrawal requests to the wallet-signing service, and moved funds out of five hot wallets.
The FBI has attributed the activity to a North Korean group; North Korea denies it, and Binance has not tied the employee compromise to a named campaign. The "fake interview, rigged assignment" pattern matches a long-running operation that researchers call Contagious Interview, which has pushed hundreds of malicious packages to public registries and used booby-trapped take-home tasks to compromise developers. Treat the specific numbers and the attribution as reported, not confirmed by us. The technique in the middle, though, is well documented and easy to reproduce, so that is what we built.
Why a coding assignment is a perfect delivery system
A take-home task is the one time a developer is expected to clone an unfamiliar repository and run it quickly, under time pressure, on a real machine. Three ordinary features of a modern project turn that into code execution, and none of them is a bug.
1. Package-manager lifecycle scripts. package.json can declare scripts that a package manager runs for you — preinstall, install, postinstall, prepare. They exist so native modules can compile. They also run automatically, with the developer's privileges, during npm install. A dependency can carry its own postinstall, so the script need not even be in the top-level package.json the candidate reads.
// vendor/ui-lint-helper/package.json — a dependency the task quietly pulls in
{
"name": "ui-lint-helper",
"version": "2.4.1",
"scripts": { "postinstall": "node lib/cfg.js" }
}
2. Local dependencies. The top-level package.json points at that dependency with a file: path, so there is no registry version to check, no published source to diff, and nothing to flag as a typosquat.
// package.json the candidate opens — looks like an ordinary task
"dependencies": { "ui-lint-helper": "file:./vendor/ui-lint-helper" }
3. Editor folder-open tasks. VS Code (and forks such as Cursor) read a .vscode/tasks.json from the repository. A task with "runOn": "folderOpen" is eligible to run as soon as the folder is opened. The workspace-trust prompt is the one barrier, and a candidate who has just been told "open this and get started" is primed to click through it.
// .vscode/tasks.json — runs before the candidate types anything
{ "version": "2.0.0", "tasks": [{
"label": "prepare", "type": "shell", "command": "node vendor/ui-lint-helper/lib/cfg.js",
"runOptions": { "runOn": "folderOpen" },
"presentation": { "reveal": "never", "echo": false }
}]}
So there are two independent triggers — install and folder-open — and the payload sits in a file: dependency that neither a registry scan nor a casual read of the main package.json will surface.
Building the attack in our lab
We built a small "wallet dashboard" take-home task in our sandbox: a tidy package.json, a src/ with a TODO, the vendor/ui-lint-helper dependency above, and the .vscode/tasks.json. We also built a fake developer home directory with dummy credential files (~/.ssh/id_ed25519, ~/.kube/config, ~/.docker/config.json) so we could watch what a payload would reach.
The payload itself (lib/cfg.js) is deliberately defensive-grade. It makes no network connection. It only checks which credential files are readable and which secret-shaped environment variables exist, then writes that to a local log. That is enough to prove the access a real stealer would abuse, without being a stealer:
// lib/cfg.js — a stand-in stager: it records reachability locally, exfiltrates nothing
const fs = require("fs"), os = require("os"), path = require("path");
const home = os.homedir();
const targets = [".ssh/id_ed25519", ".kube/config", ".docker/config.json", ".aws/credentials"];
const reachable = targets.filter((t) => { try { fs.readFileSync(path.join(home, t)); return true; } catch { return false; } });
const envNames = Object.keys(process.env).filter((k) => /TOKEN|SECRET|KEY|PASSWORD/i.test(k));
fs.appendFileSync(process.env.LAB_CANARY_LOG, JSON.stringify({ reachable, envNames }) + "\n");
We then did the one thing a candidate does: npm install. That is all it took.
$ npm install --no-audit --no-fundadded 1 package in 1s# the postinstall ran; here is what it recorded, locally:$ cat ~/logs/canary.jsonl{ "reachable": [".ssh/id_ed25519", ".kube/config", ".docker/config.json"], "envNames": ["NPM_TOKEN", "AWS_ACCESS_KEY_ID", "WALLET_DEPLOY_TOKEN"]}[!] HIGH: an install-time script read every credential store we planted and enumerated secret env varsA real payload replaces that appendFileSync with an HTTPS request. Nothing else about the chain changes.
What the install actually did
To build a detection we needed ground truth, not guesses. We traced the install with strace -f (following child processes) and turned the raw syscalls into EDR-style events with a small parser. Here is the process tree the install produced, reconstructed from the trace:
# normalised events: image, pid<-ppid, and credential files openednpm 761 install --no-audit --no-fund node 761 /opt/node22/bin/npm install ... sh 773 <- 761 sh -c node lib/cfg.js # the postinstall hook node 774 <- 773 node lib/cfg.js [+] openat ~/.ssh/id_ed25519 [+] openat ~/.kube/config [+] openat ~/.docker/config.jsonThe signal is clear: a package manager (npm) spawned a shell, which ran a short-lived node that opened three different credential stores within milliseconds. That is not what a build script does.
To be sure we were not about to write a rule that screams at every normal install, we captured a benign baseline: a real project whose esbuild dependency runs an install.js, plus a prepare script of our own. It spawns the same shape of child processes — npm → sh -c → node install.js — but it never touches ~/.ssh, ~/.kube or ~/.docker. The difference between malicious and benign is not "a script ran". It is "a script ran and read credentials".
Detecting it: from a noisy rule to a precise one
We wrote the detection three times against both traces (one malicious, one benign) so the false positives are real measurements, not a claim.
Version 1 — "a lifecycle script ran". Flag any shell a package manager spawns during install. On our benign project it fired twice (the esbuild installer and our prepare script) and caught the attack once. Useless: it alerts on every healthy npm install in the company.
Version 2 — "a credential file was read during install". Better, but it still fired on the benign install, because npm itself reads ~/.npmrc (which holds the registry auth token) on every run. One false positive per install is still one too many.
Version 3 — "code the install handed control to read a credential store". Walk each credential-read back up the process tree. Alert only when the reader descends from a shell that a package manager spawned for a lifecycle script — and exclude the package manager's own reads of ~/.npmrc. This is the rule that separates the two cleanly:
$ python3 detect_install_hooks.py v3 events-benign.jsonl events-assignment.jsonlevents-benign.jsonl: 0 alert(s)events-assignment.jsonl: 1 alert(s) [!] HIGH pid=773 install hook read credentials: 'sh -c node lib/cfg.js' -> ~/.ssh/id_ed25519, ~/.kube/config, ~/.docker/config.jsonThe core of the rule is a parent-walk; the heuristic that kills the false positives is the lineage check, not a longer keyword list:
def lifecycle_root(pid, proc):
"""Return the lifecycle `sh -c` this pid descends from, or None."""
while pid in proc:
p = proc[pid]
parent = proc.get(p["ppid"])
if p["image"] == "sh" and parent and parent["image"] in PKG_MGRS and "install" in parent["cmdline"]:
return p
pid = p["ppid"]
return None
# alert on a credential read only when lifecycle_root(reader) is not None
In a real estate you do not need strace. The same logic maps onto any EDR that records process lineage and file access. The shape to hunt for is: npm/yarn/pnpm/bun → shell → interpreter → read of ~/.ssh, ~/.aws, ~/.config/gh, browser profile or keychain, excluding the package manager's own ~/.npmrc read. Translate it into your query language and alert on it. When we help teams stand up a managed detection and response capability, developer-endpoint telemetry like this is one of the first data sources we onboard, precisely because it catches the step before the attacker has credentials.
Catching it before it runs: a read-only pre-flight
Detection fires after code runs. Better to review a strange repository without running anything first. We wrote a small read-only auditor that lists every place a repository would cause code to execute — lifecycle scripts, non-registry dependencies, .vscode folder-open tasks, committed git hooks and bundled dependency trees — and never installs, opens or executes a thing.
$ python3 repo_audit.py ~/interviews/wallet-ui-taskRepo audit: ~/interviews/wallet-ui-task [!] non-registry dependency: dependencies: ui-lint-helper -> file:./vendor/ui-lint-helper [!] .vscode task runs on folder open: .vscode/tasks.json has a task with runOn: folderOpen [!] committed dependency tree: vendor/ (review its package.json scripts)Every one of the three triggers we planted shows up, before a single line of the repository runs. The whole check is file reads:
def check_vscode_tasks(root, findings):
text = read(os.path.join(root, ".vscode", "tasks.json"))
if "folderOpen" in text.replace(" ", ""):
findings.append((".vscode task runs on folder open",
".vscode/tasks.json has a task with runOn: folderOpen"))
In our engagements this is the check we run on any "assignment", proof-of-concept or customer-supplied repository before it goes near a real workstation.
Remediation
In order of impact:
- Install with scripts off by default. Set npm to refuse lifecycle scripts (
npm config set ignore-scripts true) and runnpm install --ignore-scriptsas the norm; allow scripts only for packages you have reviewed. In our lab,--ignore-scriptsstopped the payload dead — the canary log stayed empty. - Use a package manager that blocks build scripts by default. pnpm (v10+) does this out of the box. In the same lab,
pnpm installon the malicious repo printedIgnored build scripts: ui-lint-helperand ran nothing until explicitly approved. - Never auto-run editor tasks. Keep VS Code Workspace Trust on, and set Task > Allow Automatic Tasks to off, so a
folderOpentask cannot run on open. Review unfamiliar repositories in a browser-based viewer (such as github.dev) that has no shell. - Do untrusted work in a disposable, locked-down environment. A container or VM with no SSH keys, no cloud tokens and no outbound access to anything but the registry turns "code ran as the developer" into a shrug. Dev Containers make this routine.
- Cut what a payload can take and where it can send it. Short-lived cloud credentials, hardware-backed SSH keys, and egress controls on developer networks all shrink the prize. The Binance chain mattered because one laptop's access led, step by step, to deploy rights over a signing service.
What we know and what is unconfirmed
- Confirmed by reporting: Binance has described a months-long campaign beginning with a tampered developer tool and a fake-interview coding assignment, ending in a large theft from hot wallets on 29 October 2026. The Contagious Interview technique of booby-trapped take-home tasks is widely documented.
- Attributed, not confirmed by us: the North Korea attribution comes from the FBI; Binance has not named the group, and the exact dollar figure varies between outlets ($6.3bn–$6.43bn).
- Our lab: the lure, the payload, the traces, the detection and the auditor are all our own work, built to model the technique, not Binance's specific malware. The credential files were dummy values; nothing was exfiltrated.
If your developers are ever asked to run unfamiliar code as part of recruitment, procurement or a proof of concept, treat that repository the way we treat it in a penetration test: assume it runs on open, and check before you trust. For the fundamentals that blunt this whole class of attack, see the security basics that stop most real-world attacks.
Checklist
-
ignore-scriptsis the default for developers; scripts are allow-listed, not opt-out. - VS Code Workspace Trust is on and automatic tasks are disabled.
- Untrusted repositories are opened and run only in a disposable, credential-free environment.
- EDR alerts when a package-manager child process reads
~/.ssh,~/.aws,~/.config/gh, a browser profile or a keychain. - Developer cloud and registry credentials are short-lived; egress from dev networks is restricted.
Tooling and references
- Our
repo_audit.pypre-flight and thedetect_install_hooks.pylineage rule (shown above), tested against the traces in this post. - npm docs: scripts and lifecycle hooks.
- VS Code docs: Workspace Trust and Tasks.
- MITRE ATT&CK: Compromise Software Supply Chain (T1195.001).
Written by
Huzaifa Hafeez
Chief Technology Officer, FutaqSec