URGENT: Targeted malware in our repositories altering tailwind.config.js and .gitignore via force-push. Has anyone seen this? #197873
Replies: 2 comments
-
|
The fact that the exact same payload reappeared after you force pushed clean files strongly suggests that the repository itself is not the root cause. I would investigate in roughly this order:
Regarding malware identification, the most reliable indicator is not the obfuscated code itself but the account or process creating the commit. If you can identify exactly which credential performed the push, you’ll often find the persistence mechanism much faster than by reverse engineering the payload first. Since .env handling was modified, treating all previously exposed secrets as compromised and rotating them is the correct response. |
Beta Was this translation helpful? Give feedback.
-
|
Great summary from Luke-Corwin. I want to add the most likely root cause and The re-injection is almost certainly an npm postinstall script. The most overlooked vector in attacks like this: a dependency in your Verify this first: Find all postinstall/prepare scripts in your entire dependency treenpm ls --json | grep -E "postinstall|prepare|preinstall" Or more thoroughly:find node_modules -name "package.json" -exec grep -l "postinstall|prepare" {} ; Look specifically for any recently-added or oddly-named packages. The payload Why .gitignore was modified matters — it's not incidental. Removing .env from .gitignore is the real goal. The attacker wants your .env file Specific hunting checklist (in priority order):
Check for packages published or updated in the last 30 days that touch yourconfigs
Go to: Org Settings → Audit Log → filter by git.push around the attack
Go to: Org Settings → GitHub Apps — look for anything with Contents: write
Red flag: any workflow with this + a checkout step + a commit steppermissions: Permanent prevention (beyond what's already been suggested):
TL;DR for the original poster: Your cleanup isn't sticking because the injector |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
🏷️ Discussion Type
Question
💬 Feature/Topic Area
Supply chain security
Discussion Details
Our engineering team is dealing with a highly suspicious supply chain/repository attack across all 3 of our GitHub organizations, and I am trying to figure out how they are maintaining persistence.
What we are seeing:
Several of our repositories suddenly showed as "updated 2 days ago." When we checked the commit history on the default branch, no files appeared to be changed on that date.
However, when we created a PR from the default branch to another branch, the diff revealed that two specific files were modified:
.gitignore: The attacker removed
.envand addedconfig.bat.tailwind.config.js (and in some repos, vite.config.js): The attacker injected a massive block of obfuscated JavaScript at the very end of the file.
The injected code starts like this:
The Problem:
We immediately identified this as malicious, revoked credentials, and force-pushed clean versions of the config files to remove the obfuscated code. However, we have been attacked twice. Even after cleaning the repository, the exact same malicious code was re-injected and pushed again today.
My Questions:
Any guidance on threat hunting this specific payload would be massively appreciated. We are currently treating all local .env secrets as compromised.
Beta Was this translation helpful? Give feedback.
All reactions