A reader asked whether the rumour about a rm -rf dead man's switch is true.
It is, and it has been independently documented by several research teams. Here
is the precise version, because the details matter when you are deciding how to
respond to an infection.
The Shai-Hulud payload installs a background daemon that polls the GitHub and
npm APIs to check whether its stolen token is still valid. The moment that
token gets revoked and the daemon sees an HTTP 40x response, Snyk found
that it runs rm -rf ~/, wiping the victim's entire home directory. JFrog,
The Hacker News, and GitLab all describe the same revocation-triggered
destructive routine. So the instinct to immediately yank the compromised token
is exactly what arms the trap.
Now the correction. The version circulating online says the worm runs
rm -rf / to wipe the whole machine. The default npm payload targets your home
directory, not root. The full-disk rm -rf / is a separate, geofenced
routine that the Cloud Security Alliance documented
in the PyPI variants: on systems whose locale indicates Israel or Iran, there
is a one-in-six chance the payload runs rm -rf / instead. That is a
deliberate, targeted escalation, not the everyday behaviour.
The practical takeaway for anyone hit: do not revoke the token on the infected box and keep working. Isolate the machine from the network first, then rotate credentials from a clean device, npm tokens first, then GitHub PATs, then cloud keys. The destructive trigger only bites if the daemon is still alive to see the revocation.