Mysterious .bat files being force-pushed to all repositories - potential security concern #185880
Replies: 20 comments 31 replies
|
This is a classic signature of a Supply Chain Attack or a Token Leak. The fact that you see .bat files while being on macOS suggests that an automated bot is targeting your CI/CD environment or using a compromised Windows machine to push code. Here is a checklist to help you identify and stop the breach:
Go to your Organization Settings > Compliance > Audit Log. Search for the push events. Check the IP address and the Actor. Look for the auth_method. Was it a Personal Access Token, a GitHub App, or an SSH Key?
Revoke all PATs: If you use Personal Access Tokens, revoke them immediately. Check GitHub Apps: Go to Settings > GitHub Apps and Installed GitHub Apps. Revoke any suspicious third-party integration you don't recognize. Branch Protection: Enable "Lock branch" or "Restrict pushes" on your main branches. Disable "Allow force pushes" in your Branch Protection Rules. This is your best defense against history rewriting.
Inspect the content of a .bat file. Does it contain a PowerShell script, an IP address, or an attempt to download a payload (e.g., curl or certutil)? Often, these scripts are designed to steal environment variables (Secrets) from your CI/CD runners (GitHub Actions).
Since the history was force-pushed, you might need to use git reflog on a clean local machine to recover your previous state and force-push the "clean" version back. Stay safe, and don't hesitate to contact GitHub Support directly if you suspect a platform-level compromise of your account. |
|
This behavior is a major red flag for a Supply Chain Attack. The forced pushes and the appearance of .bat files suggest that an automated bot has likely compromised one of your Personal Access Tokens (PAT) or Static Credentials (like AWS Access Keys) stored in your GitHub Secrets. While rotating keys is the first step, the long-term architectural solution to prevent this is implementing OIDC (OpenID Connect). Why OIDC is the answer to your problem: Short-Lived Tokens: GitHub Actions exchanges a temporary JWT (JSON Web Token) for short-lived cloud credentials that expire automatically. Identity-Based Access: You can configure your Cloud provider (AWS/Azure/GCP) to only trust requests coming from your specific GitHub Organization, Repository, and even a specific Branch. Immediate Action Plan: Enable Branch Protection: Immediately toggle "Block force push" and "Require Pull Request" on your main branches. This would have physically blocked the bot from overwriting your history. Switch to OIDC: Replace your static secrets with a Cloud Identity Provider (IdP) trust relationship. By moving to OIDC, you eliminate the root cause: the existence of permanent, exfiltratable credentials in your environment. Stay safe! |
|
This is a legitimate security concern, and you’re right to treat it seriously — especially because these are force pushes across multiple repos. Here’s how to think about it and what to do immediately. What this almost certainly is (and isn’t)Since:
This is not a local git issue and not accidental user behavior. The most common causes in cases like this are:
Step 1: Identify who made the force pushes (critical)For one affected repo, run: git log --show-signature --oneline --decorateThen check on GitHub:
This will usually tell you immediately whether this was:
Step 2: Audit org-level integrations (very common culprit)In Organization Settings:
Look for:
If you see an app you don’t fully recognize → disable it immediately. Step 3: Rotate credentials NOW (don’t wait)Even if you’re not 100% sure yet, rotate as a precaution:
This is standard incident response, not overreacting. Step 4: Lock this down so it can’t happen againEnable / verify branch protection rules:
This turns a scary incident into a contained one. Step 5: Check GitHub security logsIn Organization → Security → Audit Log, filter by:
This will show exactly what actor performed the pushes and when. Important note about
|
|
We got the same issue. If you have configuration files such as vite.config.js, postcss.config.js, etc., you may also find an additional script that starts with global['!'] =. Isn’t it interesting that all these PATs were leaked at the same time? |
|
@aliziauddin |
|
We are facing same issues here. Even with one of our org member, reset the computer removes all PATs, cleaned everything, yet it keep force pushing! I think GH copilot is doing something weired here! |
|
This is not expected GitHub behavior and does sound like a potential security issue rather than a normal Git operation. Force pushes across multiple repositories, especially with files you didn’t create, usually indicate that something with write access is acting automatically — for example: A compromised Personal Access Token (PAT) A GitHub App or integration with write permissions A GitHub Action workflow making automated commits Less commonly, a compromised local environment A few things I’d recommend checking: Review commit authors (git log) to see what identity is being used Check your organization’s audit logs for force push events Review installed GitHub Apps and remove anything unfamiliar Inspect .github/workflows for any automation that could be committing Verify whether any tokens or credentials may have been exposed Given that force pushes are involved and affecting multiple repos, I’d treat this as a potential credential compromise and rotate tokens/keys as a precaution. If you can share the commit author/email or a sample commit, it would help narrow down the source. |
|
This looks like a compromised token or GitHub App — here's what to do immediately:
Go to your org → Settings → Audit Log
github.com/settings/tokens — revoke anything suspicious
Revoke all personal access tokens and create new ones
Look for any workflow that runs on a schedule and has write access
Block force pushes on all repos: Settings → Branches → Require pull request Most likely cause: A GitHub App or Action with write access is generating .bat files automatically — possibly a dependency tool or CI script misconfiguration. |
|
but how it was executing when your machine was offline
*Muhammad Saad ur rehman*
Senior Software Engineer
+923228540429 | ***@***.***
Linkedin <https://www.linkedin.com/in/muhammad-saad-ur-rehman-736683160/> |
Github <https://github.com/saadurrehman>
…On Thu, 2 Apr 2026 at 11:00 PM, Md Moniruzzaman ***@***.***> wrote:
@saadurrehman <https://github.com/saadurrehman> it was not related to
copilot actually, It spreading when you are building project and the code
executed on your machine it steals all ssh keys PATs
—
Reply to this email directly, view it on GitHub
<#185880?email_source=notifications&email_token=AG2Y7QQAJGOS6PRYSOOITPD4T2TFBA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCNRUGI3DSOJQUZZGKYLTN5XKO3LFNZ2GS33OUVSXMZLOOSWGM33PORSXEX3DNRUWG2Y#discussioncomment-16426990>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AG2Y7QVQ7IBS2LTQUG6QK734T2TFBAVCNFSM6AAAAACTIWEEQSVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTMNBSGY4TSMA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
I have been experienced the same issue with the github repository. I have created one article which explains what worked for us https://www.linkedin.com/pulse/signed-commits-missing-security-layer-github-pipelines-siddhant-kadam-48src/. Please take a look and let me know if anything is unclear. |
|
Heya everyone, I'm sorry to say, if this has happened to you, you have been a victim of North Korean hackers. They compromise your machine through fake interviews, coding challenges, or by having you download other people's GitHub repositories and then open the source code in VSCode. You can read about it here: https://opensourcemalware.com/blog/polinrider-attack |
|
man!! same thing happend to me.. in my office i work with windows and in home i use mac ... first day it was a sales member whos github account used to force push.. We thought maybe he did this, but at the same time without anything just that config.bat file and remove env from .gitignore.. then we found this , https://github.com/OpenSourceMalware/PolinRider two days later i saw my own force push on my private repo (my account)...main branch wasnt secure so force push worked perfectly and my old code gone, i dont even have those code in local machine.. now when i create repo i secure all branches first.... the interesting thing is, it happend when i was offline..same for our sales team member... not my all repo ..so its possible its related to some vulnerable npm packages ... |
|
Same thing happening to me and every second perosn in our organization, though i removed all PAT and the only way to push code from my machine is by ssh password, it is still force pushing by my name |
|
Hi Zeeshan here
What i did was went to developer settings and revoked the apps access including render lovable or other deployment platform and it's been more than 1 month since last force pushes and also add a force push restrictions on repos
On Sat, Aug 29, 2026, 01:38 pm Muhammad Shuaib Khalid ***@***.***> wrote:
Same thing happening to me and every second perosn in our organization, though i removed all PAT and the only way to push code from my machine is by ssh password, it is still force pushing by my name
—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today! You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "#185880?email_source=notifications\u0026email_token=BVL4TELTHV2RWRVHWFIEWJT5MKJBDA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRHE3DQOBVUZZGKYLTN5XKM3LBNZ2WC3FFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ#discussioncomment-18196885",
"url": "#185880?email_source=notifications\u0026email_token=BVL4TELTHV2RWRVHWFIEWJT5MKJBDA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRHE3DQOBVUZZGKYLTN5XKM3LBNZ2WC3FFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ#discussioncomment-18196885",
"name": "View Discussion"
},
"description": "View this Discussion on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
|
Now even if you clear you laptop still the force pushes will be made because its due to third party apps in GitHub which have access to your GitHub
On Sat, Aug 29, 2026, 01:40 pm Muhammad Zeeshan Zia ***@***.***> wrote:
Hi Zeeshan here
What i did was went to developer settings and revoked the apps access including render lovable or other deployment platform and it's been more than 1 month since last force pushes and also add a force push restrictions on repos
On Sat, Aug 29, 2026, 01:38 pm Muhammad Shuaib Khalid ***@***.***> wrote:
Same thing happening to me and every second perosn in our organization, though i removed all PAT and the only way to push code from my machine is by ssh password, it is still force pushing by my name
—Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today! You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "#185880?email_source=notifications\u0026email_token=BVL4TELTHV2RWRVHWFIEWJT5MKJBDA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRHE3DQOBVUZZGKYLTN5XKM3LBNZ2WC3FFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ#discussioncomment-18196885",
"url": "#185880?email_source=notifications\u0026email_token=BVL4TELTHV2RWRVHWFIEWJT5MKJBDA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRHE3DQOBVUZZGKYLTN5XKM3LBNZ2WC3FFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ#discussioncomment-18196885",
"name": "View Discussion"
},
"description": "View this Discussion on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
|
Also make sure to go to settings/integrations/applications and inside that revoke installed GitHub apps , authorised GitHub apps and oAuth apps
+ In your local repos
If you turn on the window defender it will give warning and auto delete sub files , so you if copy the contents of that file in a notepad you will see malicious script
So you need to filter that
On Sat, Aug 29, 2026, 01:47 pm Muhammad Shuaib Khalid ***@***.***> wrote:
Thanks for this helpful insight, then I suspect Codex ChatGPT and Vercel. I've removed both
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "#185880?email_source=notifications\u0026email_token=BVL4TELGLXVTGTPL2VN5AML5MKKDNA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRHE3DSOJSUZZGKYLTN5XKM3LBNZ2WC3FFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ#discussioncomment-18196992",
"url": "#185880?email_source=notifications\u0026email_token=BVL4TELGLXVTGTPL2VN5AML5MKKDNA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRHE3DSOJSUZZGKYLTN5XKM3LBNZ2WC3FFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ#discussioncomment-18196992",
"name": "View Discussion"
},
"description": "View this Discussion on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
|
A good first step would be to check the affected commits and audit logs to identify exactly which account, token, GitHub App, or workflow performed the force push. I’d also check the repository’s Actions/workflow history and organization audit log around the timestamps of the incidents. If the actor is an unexpected user or integration, I’d revoke/rotate the relevant credentials immediately and review repository permissions. Since this is happening across multiple repositories, checking organization-level integrations and GitHub Apps would probably be especially important. |
|
The issue is contagious!
About 1 week before the force pushes were made from my GitHub account, the force pushes were from other developer name so everyone ignored it
So when i got infected then we got to know about what was happening and all code was being replaced eith main branch
Also my 2 accounts are infected ( personal and work account) and all the force pushes are made from both accounts at a same time with a delay of 2 sec for each repo . I removed everything from local machines but still the pushes were made
On Sat, Aug 29, 2026, 02:00 pm Ravi Kumar ***@***.***> wrote:
One additional thing I’d check is whether the force-pushes correlate with a scheduled GitHub Actions workflow. Reviewing the workflow run logs and the actor associated with each run should help narrow down whether this is coming from automation rather than a local Git client.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
[
{
***@***.***": "http://schema.org",
***@***.***": "EmailMessage",
"potentialAction": {
***@***.***": "ViewAction",
"target": "#185880?email_source=notifications\u0026email_token=BVL4TENTL7DKELRCNJEDTD35MKLTJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRHE3TANJUUZZGKYLTN5XKM3LBNZ2WC3FFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ#discussioncomment-18197054",
"url": "#185880?email_source=notifications\u0026email_token=BVL4TENTL7DKELRCNJEDTD35MKLTJA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOBRHE3TANJUUZZGKYLTN5XKM3LBNZ2WC3FFMV3GK3TUVNTW2YLJNRPWG3DJMNVQ#discussioncomment-18197054",
"name": "View Discussion"
},
"description": "View this Discussion on GitHub",
"publisher": {
***@***.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
|
|
A new way that threat actors are staying persistent on local machines is by overwriting your npm CLI file. This is from the OpenSourceMalware PolinRider Incident Response guide: https://opensourcemalware.com/blog/developer-guide-getting-over-polinrider "On several infected machines, npm/lib/cli.js (normally a few hundred bytes and four lines) had been overwritten with a malicious version of the npm CLI that's designed to maintain persistence. The malicious npm CLI is ~1 MB, with the payload appended after a long run of whitespace starting on line 5. This one matters more than a poisoned config file, because it means every npm, npx, or npm exec call re-spawns the malware, and it survives a reboot, since it's living in the tool you use to start anything else, not in a process that dies when the machine restarts. One developer traced their reinfection to an editor or extension silently running npm exec @latest in the background. You'll have to uninstall npm and node, make sure everything is killed, then you can reinstall and confirm the size is correct (compare npm/lib/cli.js against a known-good copy, or check its size and first several lines directly" |
|
We made an open-source tool and extension called Code Guardian (GitHub Source) specifically designed to solve and prevent this exact attack vector. How This Attack Works:
How to Protect Your Local & Team Environment:
|


Uh oh!
There was an error while loading. Please reload this page.
Select Topic Area
Question
Body
Issue Summary
I'm experiencing a concerning issue where
.bat(Windows batch) files are being force-pushed to multiple repositories in our organization. This has happened twice in the last 3 days.Details
.batfilesWhat I've observed
.batfiles appearing across different reposConcerns
Questions
Any guidance would be greatly appreciated. This feels like a potential security issue.
All reactions