aatansen

remediating-git-malware

Use when a repository, pull request, or developer machine is suspected of PolinRider, TasksJacker, or supply-chain malware injection, including unexpected .vscode tasks (folderOpen), fake .woff2/.lkf/.fml font payloads, node api.js/init scripts, appended obfuscated config tails, temp_auto_push.bat, malicious npm packages, or suspicious force-pushed commits.

aatansen 1 Actualitzat fa 2 h

Recursos

4
GitHub

Instal·la

npx skillscat add aatansen/remediating-git-malware

Instal·la des del registre de SkillsCat.

SKILL.md

Remediating Git Supply-Chain Malware (PolinRider / TasksJacker)

Overview

Inspect, clean, and verify repositories and PR branches compromised by PolinRider (rmcej%otb%, Cot%3t=shtP, A10-*, global['_H']), TasksJacker, and sibling supply-chain droppers without executing untrusted code. This campaign hides obfuscated JS behind horizontal whitespace in config files or api.js (node api.js && ...), abuses .vscode/tasks.json (folderOpen), disguises Node payloads inside fake .woff2/.lkf/.lfk/.fml/.orc/.llf fonts, plants temp_auto_push.bat to amend commits with -0700/truncated committer metadata, and targets fork PR CI workflows.

NEVER run npm install, npm run, python, node on repo files, or open the folder in trusted VS Code/Cursor before scanning and cleaning.

Remediation Workflow

1. Run Read-Only IOC Scan

Scan the target repo or parent workspace folder (bypasses .gitignore, validates font headers, checks .git/config, hooks, committer anomalies, refs, and compressed .git blobs):

node "<skill-dir>/scripts/scan-iocs.mjs" "<repo-or-workspace>"

Add --check-host if untrusted tasks, builds, or PR branches may have run locally (~/.npm/*$*, tmp7A863DD1.tmp, SvcHostUpdate.py/js, chk.js, b.js, Startup scripts, global npm). Add --json for structured output (line and col mark where off-screen tails start).

2. Audit History, Fork PRs & CI Logs

  1. Inspect commits without running hooks:
    git -C "<repo-root>" -c core.hooksPath=/dev/null log -n 15 --stat
    Look for unsigned commits from contributors who usually sign, committer name/timezone mismatches (-0700 or truncated first name), or fake fonts listed as 1 + instead of Bin.
  2. Check ignored/untracked files (git -C "<repo-root>" -c core.hooksPath=/dev/null status --ignored -s), .npmrc, nested paths (client/, frontend/, apps/*/), and .zip/.tar archives.
  3. For open/recent fork PRs, check PR timelines for silent force-pushes and audit CI logs for unexpected Ethereum RPC calls (1rpc.io, eth.drpc.org, publicnode.com, blastapi.io, blockscout.com) or HTTP port-443 /0x/cls / /0x/ls requests. Delete any CI artifacts published from poisoned runs.

3. Clean Working Tree & Dependencies

Artifact Action
init*, api.js (malicious loader), config.bat, temp_auto_push.bat, temp_interactive_push.bat, branch_structure.json, *#*.zip Delete file (or strip decoy loader)
.vscode/tasks.json (folderOpen), .vscode/settings.json (allowAutomaticTasks, hideOnStartup), decoy launch.json (flo-ct-flo360) Remove malicious task/settings/decoy or delete .vscode/
Fake font files (DISGUISED_FONT_PAYLOAD, INVALID_FONT_HEADER, .lkf/.lfk/.fml/.orc/.llf) & decoy fonts/README.md (BlockchainFont) Delete fake assets and decoys
Malicious npm packages (tailwindcss-style-animate, tailwind-mainanimation, tailwind-autoanimation, etc.) Remove from package.json, lockfiles, and node_modules/
package.json (node api.js && ..., node init && ..., SUSPICIOUS_NPM_HOOK) Strip injected prefix/hook; validate JSON
Config files (postcss/tailwind/eslint/next/vite/webpack/babel/jest.config.*, App.js) Use scanner line:col offset to slice appended global['!']/global['_V']/global.i/global['_H']/whitespace tail, or checkout clean commit
.gitignore / .git/config Remove config.bat/temp_*_push.bat/branch_structure.json from .gitignore; restore .vscode/ ignores if stripped; remove malicious fsmonitor/sshCommand/hooksPath in .git/config
node_modules/, .vite/, .next/ Delete caches if scripts ran; reinstall with npm ci --ignore-scripts

4. Scrub All Git Branches, Reflogs & Objects

Record any infected blob SHA via git rev-list --objects --all first, then rewrite all branches and tags (confirm with the user before rewriting shared history):

git filter-repo --force --path <malicious-path> --invert-paths
rm -rf .git/refs/original .git/ORIG_HEAD .git/FETCH_HEAD
git for-each-ref --format="%(refname)" refs/remotes/origin/ | xargs -r -n1 git update-ref -d
git reflog expire --expire=now --expire-unreachable=now --all
git gc --prune=now --aggressive
git cat-file -e <payload-blob-sha> && echo "STILL PRESENT" || echo "PURGED"

Check other local clones or .bundle files on disk too. Because GitHub does not immediately garbage-collect dangling SHAs (raw.githubusercontent.com/<owner>/<repo>/<old-sha>/... can stay live), delete/recreate disposable repos or request GitHub Support GC after force-pushing.

5. Clean Host, Rotate Secrets & Harden Before Force-Pushing

  1. Re-run node "<skill-dir>/scripts/scan-iocs.mjs" "<repo-root>" (and --check-host if local execution occurred) until CLEAN (0 exit code).
  2. Check for surviving background node -e processes (_t_s, _H2, global['r']=require, global['_V'], global['_H']) and tampered editor app bundles. Audit gh api "repos/<owner>/<repo>/activity" --paginate for force-push actors/SHAs.
  3. Before force-pushing, clean compromised hosts and rotate secrets from a clean device: GitHub PATs, gh CLI/Desktop/VS Code tokens, passphrase-protected SSH keys, OAuth grants, per-repo deploy keys, .env/CI secrets, and browser passwords (2FA does not stop already-valid stolen tokens, which allow immediate re-infection).
  4. Harden:
    • VS Code / Cursor: Tasks: Manage Automatic Tasks → Disallow ("task.allowAutomaticTasks": "off"), keep Restricted Mode / Workspace Trust enabled.
    • npm: set ignore-scripts=true in ~/.npmrc (note: this stops install hooks, not node api.js && inside build/dev scripts).
    • GitHub: require maintainer approval for all external contributors on fork PR workflows, never publish release artifacts from fork PRs, enable "Require approval of the most recent reviewable push", block force-pushes, and require signed commits.

Common Pitfalls

Pitfall Solution
grep -r / git grep reports clean git grep skips .gitignore-hidden files; grep -r misses zlib-compressed .git objects — use scan-iocs.mjs
Assuming ignore-scripts=true stops PolinRider node api.js && in build/dev and folderOpen tasks bypass install-script blocks
Only cleaning main Scrub --all branches/tags and scan all local clones
git gc didn't remove payload Delete refs/original, ORIG_HEAD, FETCH_HEAD, refs/remotes/origin/*, expire reflogs, verify with git cat-file -e
Re-infection right after cleanup Clean host and rotate tokens/deploy keys before pushing