forkguarddocs

Cleaning an infected project

Found something? Do this next. The order matters.

On this page
  1. Stop. Do not run npm install or npm run dev, and do not open the folder in VS Code.
  2. Clean it with `forkguard fix`, or `forkguard pr` to clean GitHub as well.
  3. From another device, change your passwords and keys: GitHub tokens, SSH keys, your npm token, cloud keys, and everything in your .env files. The malware steals these, so assume they are known.
  4. Stop history rewrites. In your GitHub repo go to Settings, then Rules, then Rulesets, and block force pushes on your main branch.
  5. If forkguard says npm itself is infected, reinstall Node.js from nodejs.org before running npm again.
  6. Check everything else: run `forkguard --mine` to check all your repos.
  7. Run a full antivirus scan, and tell anyone else who works on the same repos.

#fix or pr?

The malware is…Use
Only in a copy on your computerforkguard fix
In a repo on GitHub (usually the case)forkguard pr
In a repo you forked from someone elseforkguard pr --upstream
In a repo that is not on GitHubforkguard fix, then commit and push yourself

Remember the malware gets into GitHub, not your laptop. Run git pull before you check your own repos, so the copy you check is the one GitHub has.

#Why you rotate secrets from another device

This malware steals tokens, keys and saved passwords, then uses your GitHub token to rewrite commits in every repo you can push to. If you change credentials on the infected machine, the malware may see the new ones too.

#Why it can come back

Where to next

Edit this page on GitHub View as Markdown

Type to search. Use the arrow keys and Enter.