Repeated unauthorized force-pushes to org repo after npm malware tokens keep getting compromised (injected code attached) #206925
Replies: 2 comments
|
Here is a comprehensive and effective response you can use to reply to this security discussion. It directly addresses the mystery of the powered-off laptop, explains the technical mechanisms likely at play, and provides actionable remediation steps. Hi there, I completely understand how alarming it is to see unauthorized activity occurring while your machine is powered off, especially after you've already taken such extensive remediation steps. This is a terrifying situation, but you are not crazy—there is a logical explanation for how this is still happening. Based on the timeline and the payload injected into postcss.config.js shown in image_615d44.png, here is a breakdown of what you are likely experiencing and how to stop it. How is the Attacker Still Pushing? Git Author Spoofing & Lateral Compromise: Git does not authenticate the author of a commit, only the pusher. Anyone with write access to the repository can set git config user.email to your email address. Because the malicious code was pushed to the org repo, it is highly probable that another teammate pulled the repo and ran a build. Their tokens were then harvested, and the attacker is now pushing via your teammate's compromised account while spoofing your email to cover their tracks. Malicious Deploy Keys: When attackers compromise an account with admin access to a repository, they often add a hidden Deploy Key with write access in the repository's settings. Deploy keys are tied to the repo, not your user account, meaning your password resets and token revocations did not invalidate it. CI/CD Pipeline Poisoning: The code injected in image_615d44.png is placed in a build configuration file (postcss.config.js). This means the payload will execute automatically whenever the CSS is processed. If your organization uses GitHub Actions or another CI/CD tool to build the project, the runner itself is executing the malware. The attacker may be using the runner's GITHUB_TOKEN or stealing environment variables to force-push code back to the repository. Immediate Action Plan Verify the Commits: Check the unauthorized force-pushes in the GitHub UI. Do they have the green "Verified" badge? If they do not, it is definitive proof that the attacker is spoofing your email using another authentication method. Audit Repo-Level Access: Immediately go to the organization repository settings and audit Deploy Keys, GitHub Apps, and Webhooks. Delete anything you do not explicitly recognize. Trigger an Org-Wide Reset: Treat the entire engineering team as compromised. Every developer who has interacted with that repository since the initial breach must revoke their tokens and audit their local environments. Analyze the Payload: For context on the attacker's motives, the obfuscated script in image_615d44.png explicitly references Ethereum RPC endpoints (e.g., eth.blockscout.com, ethereum-rpc.publicnode.com). This indicates the malware is likely scanning local environments and CI runners for cryptocurrency wallets, private keys, or attempting to drain smart contracts. |
|
This is a solvable puzzle!! The fact that force-pushes resumed after a full token/password/SSH rotation is actually the most important clue — it means the compromise isn't at the "stolen credential" layer anymore, it's at the "something on my machine or in my account settings keeps minting new credentials" layer. Here's a draft answer you can post: The fact that this happened again after a full credential rotation is the key diagnostic signal. It tells you the attacker isn't just replaying an old stolen token — something is actively generating new access. That narrows the search a lot. A few things people often miss in exactly this situation:
A malicious OAuth app with repo scope survives password changes, 2FA enrollment, and PAT revocation entirely — this is a very common way "I did everything and it happened again" plays out.
Also check ~/.gitconfig for injected url.insteadOf rewrites or a hijacked credential.helper pointing at a malicious script.
Scheduled persistence: cron jobs (crontab -l), macOS LaunchAgents (~/Library/LaunchAgents), or Windows Scheduled Tasks / Run keys A signature-based scan finding "no traces" doesn't rule this out — a lot of these loaders drop small, non-signature-matched shell one-liners rather than a detectable binary.
Some info-stealers just dump GITHUB_TOKEN/NPM_TOKEN env vars, which persist across reboots if they're set in a shell profile rather than the session. My honest recommendation: given this has now recurred after a full rotation, I would not trust the machine anymore. Signature-based malware scans are unreliable against custom loaders. At this point: Pull the security log evidence above first (for your CTO/security team — they'll want IOCs and timestamps). The org-level audit log in particular will likely give you the definitive answer faster than anything on your end. |
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Question
💬 Feature/Topic Area
Supply chain security
Discussion Details
I'm dealing with a recurring token compromise and need advice on what I'm missing.
The most alarming part:
This happened while my laptop was completely powered off.
I received a message from my CTO asking why I had closed a PR but I hadn't even turned on my laptop that day. That's when I realized my account was compromised. I immediately revoked all tokens, changed passwords, and signed out all sessions. But a week later, the exact same thing happened again unauthorized actions from my account while I was not actively using it.
Timeline:
Last week: Ran npm install in a cloned repo containing a known malicious package loader

The loader executed and likely harvested stored credentials
Unauthorized force-pushes started appearing in an org repo under my account
I deleted the repo, revoked all PATs/SSH keys/OAuth tokens, changed password, signed out all sessions, and enabled 2FA
This week: It happened AGAIN same scenario, same force-pushes from my account to the same org repo
The malicious code that was injected:
What I've done (twice now):
What's concerning:
After doing all of this last week, the unauthorized pushes resumed
This suggests either:
Any guidance on breaking this cycle would be greatly appreciated. I feel like I'm securing my account but missing something that keeps giving the attacker access. At this point, I'm considering a full OS wipe and starting fresh.

All reactions