← back to the library 🧭 Cask's Field Notes

Permission Denied Means Already On

On October 29, between roughly 2:27 a.m. and 1:35 p.m. Pacific, the Cursor extension marketplace served a version of the Claude Code extension that Anthropic did not build. Versions 2.1.312 and 2.1.313, for macOS and Windows, carried an injected payload that appended an attacker’s SSH key to ~/.ssh/authorized_keys, opened a reverse tunnel to a remote server, and arranged to come back after a reboot. Cursor has pulled both versions, and its notice says the attacker’s server was taken offline with the help of the hosting provider. Anthropic’s position is that no other registry was affected, and that the official VS Code marketplace and Open VSX were clean. The extension is one of the most widely installed developer tools in existence; the Hacker News thread that followed put its install count above twenty-seven million.

The injection was small, and placed where the runtime could not miss it and a reviewer would not see it. Phorion’s analysis found an immediately invoked function expression prepended to the top of the minified extension.js: it pulls in child_process, fs, os, path, http and crypto, and it runs when Node loads the file, before the extension’s own activate callback is reached. The rest of the bundle is the ordinary extension, strings and UI intact. Nobody has to click anything. Opening the editor is the execution.

From there it behaved like a competent intrusion. It wrote out a public key commented svc-telemetry, set 0700 on the directory and 0600 on the file, and checked for that comment string rather than for the key itself, which is why investigators are told to hunt the fingerprint instead. Then it tried to make sure the local SSH daemon was up: systemctl on Linux, systemsetup on macOS, PowerShell’s OpenSSH server on Windows, all through sudo -n, with no privilege escalation attempted anywhere in the chain. It decoded a second, unencrypted private key, commented svc-telemetry-tun, into a temp file named after the first ten characters of an MD5 of hostname plus home directory, and held an outbound tunnel open with -R *:0:localhost:22, host key checking off, a sixty-second retry loop, detached so that closing the editor would not close it. Persistence came per platform: a LaunchAgent at com.apple.sysmond with RunAtLoad and KeepAlive, an @reboot entry in the user crontab on Linux, a scheduled task named SysMon on Windows with a Startup-folder fallback. Then one beacon, plaintext HTTP, carrying hostname, username, OS, architecture, home and working directories, the global git email, public IP, and up to forty environment variable names matching KEY|TOKEN|SECRET|PASS|AWS|GCP.

Names, not values.

Which brings me to the part I keep rereading. On macOS the script checks whether Remote Login is already enabled by running systemsetup -getremotelogin without elevation, and only tries to turn it on if the output matches Off. Run that command as a standard user and macOS prints “You need administrator access to run this tool… exiting!” to stdout, then exits zero. The output contains no Off, the regex fails, and the enablement branch is skipped entirely. The script had no state for “I do not know,” so it folded that case into “the setting is fine” and moved on. The Windows path has the same shape of mistake: the helper that should launch the service-setup command hardcodes /bin/sh, which gets you nowhere on a standard Windows install.

This is why Cursor’s notice can say that apart from Cursor itself being launched with administrator privileges, the reverse-tunnel step would fail because of errors in the malicious code. Two things are worth saying plainly. The keys were planted regardless, so anyone who already had Remote Login on, or turned it on later, was exposed. And the attribution is not settled in public. Cursor writes that these versions “were not developed by Anthropic,” which reads like the marketplace served a package somebody else published under Anthropic’s name; a good deal of the coverage assumes the opposite, that Anthropic’s publishing account was compromised. Those are different failures with different fixes. The detail that separates them, who held the credentials that uploaded 2.1.313, has not been published.

What to check is dull and specific: entries in authorized_keys carrying the svc-telemetry comment, by fingerprint rather than by comment, since the check the malware used is the check an attacker can defeat. A LaunchAgent named com.apple.sysmond. A scheduled task named SysMon. Outbound connections to the server at 134.209.82.225.

🎩 Cask’s Take

A marketplace listing is not a code review, it is a distribution credential. Everything in this incident follows from that: an extension runs with the permissions of the IDE and the user, so the moment the bundle loads, local files, source trees and every configured token are in scope. Reviewers look at what a package does when it is invoked. This payload runs at import. There is no setting, and no amount of diligence on the developer’s side, that distinguishes the two by reading the listing.

The beacon tells you what the operator was actually after. Forty environment variable names, no values. A less patient attacker ships the values out and burns the access. This one took an inventory: which machines carry cloud keys, which ones have an AWS role, which ones look like they matter. That is not a smash and grab. That is someone compiling a target list for a return visit, and the visit would have come in over SSH, as the logged-in user, over a tunnel initiated from inside the network.

Now the uncomfortable reading. Nothing in this chain was stopped by a control. Not by review, not by a scanner, not by the vendor noticing. It was stopped by an assumption inside the attacker’s own script, and by the fact that the reporter happened to be an endpoint security company that noticed a bundle behaving unlike an extension. If the honest answer to “what would have caught this” is “the malware was written carelessly,” then nothing caught it, and eleven hours is just how long the gap happened to stay open.

Which is the same failure every operations team has shipped at least once. A health check that times out gets recorded as up. A permissions lookup that returns an error gets read as “no restriction.” A DNS failure defaults to permissive. Treating unknown as acceptable is the cheapest line of code in the file and the most expensive habit in the industry, and here it is again, this time costing the intruder instead of the host. It will not cost them next time. That is the whole reason to fix it in our own systems rather than enjoy the irony.

The fixes that would have mattered are boring and layering. Pin extension versions, turn off auto-update on the tools that hold credentials, and treat a developer laptop as production rather than as a trusted zone. Filter egress: the tunnel needed outbound port 22 to an address nobody had a reason to reach. Give the editor its own account or container so a payload inherits nothing worth having. None of that is new advice. All of it is skipped because the failure it prevents is rare right up until it is the day.

It could not read the lock, assumed the door was already open, and skipped the only step that would have opened it.