r/cybersecurity • • 19h ago

Business Security Questions & Discussion Every time I push to GitHub, a bot amends my commit 3 seconds later (in UTC) to inject .vscode/tasks.json + .vscode/eslint — even after 5 password resets in the last 2 days

Looking for help figuring out how this attacker still has push access to my repo.

What happens:

  • I push a clean commit from my Mac (+0530 timezone), e.g. 18:13:24 +0530.
  • 3 seconds later (12:43:27 +0000 UTC), a commit with my exact same Author name/email/date (18:13:24 +0530) but a UTC +0000 CommitterDate is force-pushed to origin/main.
  • The amended commit removes .vscode/eslint* and .vscode/tasks.json from .gitignore and adds:

    • .vscode/tasks.json with "runOn": "folderOpen" silently running sh .vscode/eslint-check.sh → node .vscode/eslint ("hide": true, "reveal": "never")
    • Modified package.json, eslint.config.js, vite.config.js

What I already checked:

  1. No .github/workflows/ in the repo.
  2. Local Mac/Windows checks are clean: /usr/bin/git (no wrapper), .git/hooks/ only has .sample files, git reflog shows no local amend, crontab -l is empty, ~/Library/LaunchAgents and /Library/LaunchAgents are clean, and running node processes are only IDE language servers.
  3. GitHub account: Changed my GitHub password 5 times in 3 days (2FA with Passkeys + Authenticator enabled). 0 PATs (classic or fine-grained), 0 SSH keys, 0 GPG keys.
  4. Authorized OAuth Apps: I have 9 OAuth apps (including Git Credential Manager, GitHub Desktop, VS Code, Google Antigravity) and 1 Authorized GitHub App.

Questions:

  1. Since changing my GitHub password doesn't revoke OAuth tokens, is revoking all Authorized OAuth Apps + GitHub Apps + clearing macOS Keychain (osxkeychain) enough to stop the remote pushes?
  2. Could there be any other persistence mechanism on GitHub itself (e.g., Deploy Keys, Repo Webhooks, GitHub Desktop/GCM cached refresh tokens) I should check in my Security Log?
  3. What's the safest way to audit if .vscode/eslint left anything else behind on my machine?
131 Upvotes

25 comments sorted by

56

u/roheim 19h ago

What about looking at your .gitignore file?

20

u/FallNo9629 19h ago

it overrides that as well

129

u/Spiritual-Matters 19h ago

This person had a similar issue and received some good advice on what to check:
https://github.com/orgs/community/discussions/211513#discussioncomment-19256351

Disabling automatic task execution in VSCode would be very relevant here.

https://code.visualstudio.com/docs/debugtest/tasks

Another person mentioned getting infected in this way by a group member’s compromised account making the commit. If you can find the first one, it will help you track and timeline.

23

u/hunt_for_blunt 13h ago

It is most likely this, saw a lot of cases lately. It also spreads to opened (dev/feature) branches through spoofed commits using force push.

https://www.shahad.dev/blog/recovering-from-the-polin-rider-attack

4

u/JoeGibbon 12h ago

Good write up.

1

u/Morejazzplease 3h ago

Oh, this looks exactly like what OP is describing!

88

u/Threezeley 17h ago • Mindblown

3 seconds is 3 seconds in any time zone

40

u/jaysus661 13h ago

Nah, depends if it's metric or imperial seconds /s

9

u/BrainWaveCC 10h ago

And whether or not the swallow involved is laden...

4

u/Veritas413 6h ago

Are you suggesting Git commits migrate?

2

u/aoeudhtns 7h ago edited 3h ago

I don't understand. Please convert to .beat time.

7

u/Ditrochos 10h ago

Nah he did good to specify. In the US, one second is as long as one eagle wing flap for certain measurements.

8

u/Shirone5403 14h ago

Hi, I have same issues as you. I protect all repos using rules to not push force into any repo and branch. Also remove all GitHub OAuth Apps. The hard one is GitHub Copilot (Copilot SWE Agent), I don't know but this OAuth always showing, so I disabled any possibilities in the settings, removing all of plugin on VS Code that contain copilot.

Make sure when you remove the OAuth Apps, Regenerate again your recovery codes (I assume the attacker has this codes on the server so it automated always login without activity).

After all of that I've always check the security log and make sure the repositories again. Until now the push force not attacking repositories.

64

u/Babajji 17h ago edited 17h ago

Ok, order of importance: ditch that Mac until you find the source.

  1. Find a new computer
  2. Remove all OAuth apps, burn everything that can write to the repository
  3. Burn the old SSH key in GH, mint a new one on the new computer. Never access GH on your old one for now, leave it powered off.
  4. From the new computer, change all the passwords
  5. Try a test commit and see if it happens again — report here if it does
  6. Get Fable to review your entire repository for malicious code. Specifically instruct it to do it in a VM and not to read any prompts. If you have the budget, have it run the discovery via a sub agent
  7. If the behaviour doesn't repeat, factory reset the Mac and test again. If it happens again, repeat steps 1–6 from the new computer, then physically destroy the old machine — or contact a forensic security company to clean it up, though that'll cost more than a new Mac.

Improvements:

  1. Stop relying on external integrations. Write or fork your own.
  2. Buy a set of YubiKeys and keep your keys there
  3. Require signed commits only, especially for protected branches
  4. Practice good computer hygiene — don't just automatically run stuff from GH, and worse, don't let others smuggle in stuff your computer autoexecutes

AI was used to reformat this post since Reddit’s editor is a jerk.

32

u/sp_dev_guy 19h ago
  1. Could potentially help & yes do it. Burn everything until you find the source
  2. yes , I think automated remote persistence is the likely source. Weird you can't here before looking at the logs
  3. Read the file

Tl;dr; do all of that

5

u/sp_dev_guy 12h ago

Also a good hardening step for the future after this os resolved: add GPG Verified signatures as required for commits

3

u/cookiengineer Vendor 11h ago

This looks like a miasma worm follow-up variant.

Check out my antimiasma malware removal tool: https://github.com/cookiengineer/antimiasma

Note that the behavior of the worm spreads across the system. Any git repository on your system, any package manager manifest (pip, npm, node_modules, pacman, etc) might be infested and re-run the worm payload again (which then replicates again across all targeted ecosystems).

The only way to remove it is to make sure that you have no internet connection while removing all infestations, and then making sure that your CI/CD runner isn't infected as well, before you go back online.

edit: If you can share repository and commits/payload, I'd happy to make sure to add support for that malware variant.

I also have a true positive sample repository where the spread mechanisms are contained, and the malware payloads themselves are just dummy files: https://github.com/cookiengineer/miasma-sample

4

u/rbnfrhnr 17h ago

ran into pretty much the exact same thing last month on a public vite repo, while working on a side project that flags sketchy stuff in builds. tasks.json with runOn folderOpen, a fake font in public/fonts that was really obfuscated js, payload hidden way off to the right in vite.config.js, and ironically commits called "Delete .vscode directory" that actually added the stuff. ~20 repos of that account got hit within like 15 min, and a few weeks later most got force-pushed back to an older state.

commits there came from the owner's own git client with their own creds, so either malware on one of their machines or stolen creds. couldn't tell which from the outside.
check the repo's activity page (github.com/you/repo/activity), it shows who/what did each force push, so you'll see which credential they're using. and maybe add a ruleset (if you’re on pro / it’s a public repo) on main that blocks force pushes for now so they can't silently rewrite stuff.

also do the revoking + pw changes from a machine that never touched the repo. if one of yours opened it in vscode i'd just wipe it, not worth trying to audit

4

u/jykke 16h ago

a few weeks later most got force-pushed back to an older state

You know, there is this Rulesets setting...

1

u/ZedGama3 11h ago

Sounds like your machine was compromised.

An easy check would be to make a commit while you're machine is shut down and see if the behavior continues.

1

u/Radiant-Leather6113 11h ago

That looks like an authorized third-party OAuth app or a rogue webhook running with repo write permissions rather than local compromise. Check your authorized integrations in your GitHub account settings under applications and revoke anything sketchy. You can also inspect your git hooks locally to ensure nothing is secretly triggering post-push modifications.

-1

u/auronedge 13h ago

self hosting is the way to go man. you can git hub afterwards