28,000 Exposed Git Repositories Are Leaking API Keys, Corporate Secrets, and Sensitive Data Across the Internet

Listen to this Post

Featured ImageIntroduction: A Misconfigured Server Can Become an Open Door

A Git repository is supposed to be a developer’s workspace—a place where source code, configuration files, deployment history, and project documentation can be safely managed. But when the hidden .git directory is accidentally exposed to the internet, that private development history can become a treasure chest for attackers.

A new security investigation has revealed just how serious this problem remains. Researchers scanned millions of internet-facing systems and discovered 28,000 publicly accessible Git repositories containing potentially sensitive information, including cloud credentials, payment-service keys, AI API tokens, GitHub tokens, Telegram credentials, corporate files, and other secrets.

The research is particularly alarming because the exposure does not necessarily require a sophisticated vulnerability. In many cases, the root cause is simply a server configuration mistake: a web server unintentionally makes the .git directory accessible, allowing outsiders to reconstruct a repository and examine its history.

And that history can be far more dangerous than the current version of the code.

The Investigation: Millions of Internet-Facing Hosts Under the Microscope

The findings came from a large-scale scan of approximately 3.5 million internet-facing hosts using gitreaper, an open-source tool developed by Intruder.

Researchers began with around 40 million potentially interesting domains identified through Certificate Transparency logs. Rather than scanning everything indiscriminately, they concentrated on subdomains that frequently belong to applications, development environments, administration panels, and internal tooling.

Names such as app, admin, and dev became particularly interesting because these environments are often connected to software development workflows.

After filtering the initial dataset, the researchers identified 3.5 million hosts running active HTTP services. They then used Nuclei to look for signs of exposed Git repositories.

The result was striking: thousands of systems were effectively publishing their development repositories to anyone capable of discovering them.

Why an Exposed .git Directory Is So Dangerous

The biggest misconception surrounding this type of exposure is that an attacker only sees the current source code.

That is not necessarily true.

Git is designed around version history. A repository can contain years of commits, deleted files, old configuration files, abandoned branches, development experiments, and credentials that developers believed they had removed permanently.

Deleting a password from

If the .git directory remains accessible, an attacker may be able to reconstruct earlier versions of the repository and recover information that disappeared from the latest release long ago.

Git History Can Remember What Developers Forgot

Git stores information as objects identified by SHA-1 hashes. These objects include commits, trees, and blobs.

A commit represents a point in the

This architecture is extremely useful for developers because it allows teams to move backward and forward through project history.

For defenders, however, it creates a serious security challenge.

For attackers, it can become an information archive.

How Gitreaper Finds Hidden Repository History

The research tool begins by searching for common Git resources and paths.

These can include files such as HEAD, packed-refs, common branch names such as main, master, and develop, and repository reflogs.

Reflogs are especially interesting because they may contain references to commits associated with branches or changes that are no longer visible through the normal repository state.

Once gitreaper finds a starting commit, it can walk through the repository’s history, identify parent commits, retrieve associated trees and blobs, and continue exploring the repository.

The process also tracks previously seen object hashes so that identical objects do not have to be downloaded repeatedly.

That makes large-scale discovery significantly more efficient.

The Secret Nobody Realized Was Still There

One of the most important lessons from the investigation is that developers frequently remove credentials from their latest files without actually removing them from the repository’s history.

Imagine a developer accidentally commits an AWS access key.

The mistake is discovered.

The key is removed from the current configuration file.

The developer pushes a new commit.

From a quick inspection of the latest source code, everything appears clean.

But the original commit still exists.

Unless the secret is properly removed from the repository’s history and, critically, the exposed credential is revoked, the secret may remain recoverable.

This is why simply deleting a password from a source file is not a complete remediation strategy.

Thousands of Credentials Were Found

The researchers reported discovering more than 400 AWS access keys, 107 Stripe API keys, 123 OpenAI API keys, 80 Telegram tokens, and 17 GitHub personal access tokens.

The numbers are disturbing not merely because they represent credentials, but because some of those credentials were reportedly still active during testing.

An exposed credential is potentially an access path into another system.

An AWS key could provide access to cloud infrastructure.

A Stripe key could expose payment-related functionality.

An OpenAI API key could be abused to consume resources and generate unexpected costs.

A GitHub token could potentially provide access to repositories or development infrastructure depending on its permissions.

A Telegram bot token could be abused to impersonate or control a bot.

The real danger therefore depends not only on how many credentials are exposed, but on what privileges those credentials provide.

Cloud Credentials Can Turn a Code Leak Into a Corporate Breach

Cloud credentials are particularly dangerous because modern applications often depend on cloud infrastructure for storage, databases, logging, deployment, backups, and internal services.

A single leaked access key may therefore provide a starting point for a much larger attack.

Researchers reported that some exposed AWS credentials provided access to internal storage buckets.

That creates an entirely different category of risk.

The attacker is no longer simply reading source code.

They may be able to access business data stored elsewhere.

Sensitive Employment Records Were Also Exposed

One especially concerning example involved a Python settings file containing credentials connected to employment-related documents.

The researchers said those credentials could provide access to information such as attendance records and disciplinary information.

This illustrates why secret exposure should not be treated purely as a developer-security issue.

A compromised repository can potentially become a gateway into HR systems, financial information, customer databases, internal documents, cloud storage, and other business operations.

The consequences can extend far beyond the original software project.

From Credential Theft to Social Engineering

Sensitive information does not always need to be directly monetized to be valuable.

An attacker who obtains employee records, internal documents, organizational details, or private project information can use those details to construct highly convincing phishing campaigns.

For example, knowing the names of employees, their departments, attendance patterns, internal projects, or managerial relationships can make fraudulent messages appear much more legitimate.

This is where a seemingly technical Git exposure can become a human-targeting security incident.

The repository may be the first step.

The real attack could happen later.

Deep Analysis

Understanding the .git Directory

A Git repository normally contains a hidden directory named .git.

This directory stores critical metadata and repository history.

If a web server exposes it directly, attackers may potentially retrieve information that developers never intended to publish.

A quick defensive check on a website you own can begin with:

curl -I https://example.com/.git/HEAD

A properly configured production server should not normally make repository internals publicly accessible.

You can also test common Git paths:

curl -I https://example.com/.git/config
curl -I https://example.com/.git/packed-refs

These commands should only be used against systems you own or are explicitly authorized to test.

Checking a Local Repository for Sensitive History

Security teams can inspect their own repositories for accidentally committed secrets.

For example:

git log --all --stat

To examine historical changes:

git log --all --full-history

To search tracked content for suspicious patterns:

git grep -n -E 'AKIA[0-9A-Z]{16}|api[_-]?key|secret|password|token'

These checks are not a replacement for dedicated secret-scanning tools, but they can help identify obvious problems.

The Correct Response to a Leaked Credential

If a credential has been exposed, the first priority should be revocation, not merely deletion.

For example, if an AWS key appears in a repository, removing the line from the source code does not invalidate the credential.

The key must be disabled or rotated through the relevant provider.

The same principle applies to API keys, tokens, database passwords, SSH credentials, cloud service accounts, and other authentication material.

Investigating Git History

Security teams can inspect branches and commits with commands such as:

git branch -a
git log --all --oneline --decorate
git reflog --all

For repositories where sensitive material is suspected, defenders should inspect historical commits rather than limiting the investigation to the current branch.

A secret that disappeared from the latest version may still exist several hundred commits earlier.

Removing Secrets From Git History

Removing a secret from history requires specialized history rewriting.

Modern Git environments can use tools such as git filter-repo:

git filter-repo --path path/to/secret-file --invert-paths

However, rewriting history is only part of the solution.

Anyone who previously cloned the repository may still possess the old secret.

Therefore:

Remove the secret.

Rewrite the repository history when appropriate.

Rotate or revoke the credential.

Search other repositories and systems for the same secret.

Review access logs for suspicious activity.

That sequence is far more effective than simply deleting the offending line.

Secret Scanning Should Move Left

Organizations should not wait until production repositories are accidentally exposed.

Secret scanning can be integrated into development workflows, pull requests, CI/CD pipelines, and repository hosting platforms.

A basic pre-commit workflow might include:

git diff --cached

followed by an organization-approved secret scanner.

The goal is simple: stop credentials before they enter repository history.

Production Servers Should Never Serve .git

Web servers should explicitly block access to hidden Git directories.

For Nginx, a defensive configuration can include:

location ~ /.git {

deny all;
return 404;
}

For Apache, administrators can use access controls to prevent requests to hidden Git directories.

The exact configuration should be tested carefully within the organization’s existing web-server architecture.

The strongest approach, however, is not merely blocking requests. Production deployments should ideally contain only the files required to run the application rather than a complete development repository.

Why This Discovery Matters Beyond Git

The Bigger Problem Is Configuration Drift

The fundamental issue is not Git itself.

Git is doing exactly what it was designed to do.

The problem appears when development artifacts cross into production environments without appropriate controls.

A developer may deploy an application quickly.

A temporary server may become permanent.

A test environment may accidentally become internet-facing.

A deployment script may copy hidden files that were never intended to leave the development machine.

Over time, these small decisions accumulate.

Security failures often emerge from that accumulation.

Developers Are Fighting Against History

Modern software development creates enormous amounts of historical data.

Every commit represents another snapshot.

Every branch creates another path through development.

Every pull request leaves metadata.

Every deployment may introduce configuration files.

Every temporary experiment can remain somewhere in repository history.

That means security teams need to think about data persistence, not merely current-state security.

The question should not be:

Is the secret in the current code?

The better question is:

“Has this secret ever been committed, and can anyone still retrieve it?”

AI Credentials Make the Problem Even More Relevant

The discovery of more than 100 exposed OpenAI API keys is particularly notable as organizations rapidly integrate AI services into applications.

AI API keys can represent direct financial exposure.

An attacker may abuse a stolen key to generate large volumes of requests, consume organizational quotas, create unexpected bills, or potentially interact with connected services depending on the architecture.

As AI becomes embedded deeper into enterprise software, developers are likely to store more AI-related credentials in application configuration.

That makes secret-management practices increasingly important.

Cloud Infrastructure Magnifies Small Mistakes

The traditional image of a leaked password is one compromised account.

Modern cloud environments are different.

A credential may grant access to storage, compute, databases, queues, serverless functions, deployment systems, or other services.

If permissions are excessive, a single leaked key can become the beginning of a larger compromise.

This is why least privilege matters so much.

A credential should have exactly the permissions it needs—and nothing more.

The 28,000 Repositories Are a Warning Signal

The most important number in the research may not be the number of API keys.

It may be the number of exposed repositories.

28,000 repositories suggests that accidental Git exposure remains widespread despite years of security warnings.

The lesson is uncomfortable: security teams cannot assume that obvious mistakes have disappeared simply because the industry has known about them for a long time.

Old vulnerabilities and configuration errors often survive because organizations continuously introduce new infrastructure, developers, frameworks, deployment pipelines, and cloud environments.

Automated Internet Scanning Changes the Threat Model

Attackers do not necessarily need to manually discover these repositories.

Internet-wide scanning can be automated.

A vulnerable host can be identified, classified, and investigated without human intervention.

That means an exposed .git directory may not remain unnoticed for long.

The longer it stays public, the greater the probability that somebody—legitimate researcher or malicious actor—will find it.

The Difference Between Exposure and Exploitation

An important distinction must be made.

Finding an exposed repository does not automatically prove that every credential inside it was abused.

Similarly, finding a credential does not necessarily mean that an attacker successfully accessed the associated system.

But exposure dramatically changes the risk profile.

Once credentials are publicly accessible, defenders have to assume compromise is possible and investigate accordingly.

Organizations Need Better Deployment Hygiene

Production deployments should be deliberately minimal.

There is rarely a legitimate reason for an application server to expose:

.git/

.git/config

.git/HEAD

.git/logs/

.git/objects/

These are development artifacts.

They belong in source-control infrastructure, not in the publicly accessible web root.

Automated deployment systems should therefore exclude hidden repository metadata and unnecessary development files.

Security Teams Should Treat Secrets as Toxic Data

Secrets should be considered sensitive from the moment they are created.

They should be stored in dedicated secret-management systems whenever possible.

They should not be embedded directly into application source code.

They should not be copied into documentation.

They should not be placed in public repositories.

And they should never be considered safe merely because nobody has noticed them yet.

What Undercode Say:

The Most Dangerous Secret May Be the One Everyone Forgot

This investigation is a reminder that cybersecurity failures rarely require cinematic hacking techniques.

Sometimes the attacker only needs a browser, a scanner, and an exposed directory.

Git Is Not the Enemy

Git remains one of the most important tools in modern software development.

The vulnerability comes from exposing its internal data to untrusted users.

Deleting a Secret Is Not the Same as Revoking It

A password removed from the latest commit may still exist in historical commits.

A leaked API key should therefore be revoked or rotated immediately.

Repository History Is Data

Security teams often protect databases while overlooking Git repositories.

But Git history can contain credentials, internal URLs, architecture diagrams, employee information, customer information, and proprietary code.

.git Should Be Treated Like a Sensitive Database

If an attacker can retrieve .git, they may be able to reconstruct much more than the website currently displays.

That makes repository exposure a serious security issue.

The Numbers Are Concerning

More than 400 AWS keys, 107 Stripe keys, 123 OpenAI keys, 80 Telegram tokens, and 17 GitHub tokens demonstrate how frequently secrets can end up in repository history.

Even a small percentage of valid credentials can create enormous risk.

Active Credentials Are the Real Emergency

Historical secrets are dangerous.

Active secrets are worse.

Once researchers confirm that credentials still work, the organization should immediately treat them as potentially compromised.

Cloud Credentials Deserve Special Attention

Cloud credentials can provide access to far more than source code.

They can connect attackers to storage, databases, internal applications, backups, and infrastructure.

Least Privilege Can Limit the Damage

Even if a credential leaks, tightly restricted permissions can prevent a minor incident from becoming a catastrophic breach.

Least privilege is therefore both a preventive and containment strategy.

Developers Need Security Guardrails

Security cannot depend entirely on developers remembering every secret-management rule.

Automated scanning and CI/CD controls can catch mistakes before they become permanent.

Production Servers Should Be Minimal

The safest deployment is usually the one containing only what the application actually needs.

Source-control metadata should stay outside the public web directory.

Security Testing Should Include Forgotten Assets

Organizations should periodically scan their own internet-facing infrastructure for accidental Git exposure.

Old development servers can be forgotten for years.

Attackers do not care whether the server is officially “legacy.”

Certificate Transparency Can Reveal More Than Expected

Certificate Transparency logs are useful for defenders, but they also reveal domain and subdomain information that can help map an organization’s internet footprint.

Organizations should know what those public records reveal about their infrastructure.

Development Environments Are High-Value Targets

Development systems often contain source code, credentials, debugging tools, test accounts, and internal documentation.

That combination makes them attractive targets.

Repositories Can Become Attack Infrastructure

Once attackers obtain internal code, they may learn how an organization authenticates, deploys applications, connects to databases, and manages cloud infrastructure.

Source code can therefore provide a roadmap for future attacks.

AI Makes Credential Hygiene More Important

The presence of OpenAI API keys demonstrates that AI credentials have joined the growing collection of secrets developers need to protect.

As AI applications expand, these keys will become increasingly valuable.

Secret Scanning Should Be Continuous

One scan is not enough.

New commits are created every day.

Security controls must operate continuously across development and deployment.

Incident Response Must Look Beyond Git

When a secret is exposed, defenders should search for the same credential across other systems.

They should also examine authentication logs and cloud activity for signs of abuse.

Rotation Beats Hope

If there is uncertainty about whether a credential was accessed, rotating it is generally safer than assuming nobody noticed.

Security decisions should favor reducing exposure.

Repository Cleaning Is Not Enough

History rewriting may remove a secret from a repository, but it does not invalidate copies that already exist elsewhere.

Credential rotation remains essential.

Public Exposure Should Be Assumed Discoverable

Internet-facing systems should be treated as continuously monitored by automated scanners.

Security through obscurity is not a reliable defense.

Misconfiguration Remains a Major Threat

The industry spends enormous resources on sophisticated vulnerabilities.

Yet basic configuration mistakes continue to create serious exposures.

Security Needs to Follow the Software Lifecycle

Security should begin when code is written and continue through testing, deployment, monitoring, and retirement.

A repository is part of that lifecycle.

Temporary Infrastructure Is Often Permanent

Test environments frequently survive longer than intended.

That is why temporary systems need the same security discipline as production.

Human Error Cannot Be Eliminated

Developers will occasionally commit secrets.

The goal should be to build systems that catch those mistakes quickly and automatically.

Automation Is the Answer to Scale

A company with thousands of repositories cannot manually inspect every commit.

Automated secret detection, configuration scanning, and external attack-surface monitoring are essential.

The Attack Surface Keeps Expanding

Cloud platforms, SaaS applications, AI services, APIs, and remote development environments create more places where credentials can accidentally appear.

Security Teams Need Visibility

You cannot secure infrastructure you do not know exists.

Asset discovery should therefore be a continuous security function.

Exposed Git Is Usually Preventable

Unlike sophisticated zero-days, accidental .git exposure can often be prevented through straightforward deployment controls.

That makes these incidents particularly frustrating.

The Cost Can Be Much Larger Than the Initial Mistake

One exposed file may contain a credential.

That credential may unlock another system.

That system may contain sensitive information.

A small configuration mistake can therefore trigger a chain reaction.

Organizations Should Audit Old Repositories

Old projects should not automatically be considered harmless.

Archived repositories may still contain credentials that remain valid elsewhere.

Security Education Still Matters

Developers should understand why committing credentials is dangerous and what to do when a mistake happens.

But education should be backed by automation.

The Best Secret Is One That Never Enters Git

The strongest defense is preventing credentials from becoming part of repository history in the first place.

Detection Must Be Faster Than Exploitation

Organizations should aim to discover accidental exposures internally before external scanners do.

Continuous monitoring can dramatically shorten that window.

28,000 Exposures Should Trigger Action

The discovery is not merely an interesting research statistic.

It should encourage companies to inspect their own public infrastructure immediately.

Git Security Is Corporate Security

Repositories contain business logic, intellectual property, credentials, and operational knowledge.

Protecting Git is therefore part of protecting the company itself.

The Final Lesson

The internet never forgets an exposed secret for you.

If a credential reaches a public repository, assume it can be discovered.

If it can be discovered, assume it can be abused.

And if it can be abused, revoke it before someone else gets the opportunity.

✅ 28,000 Publicly Accessible Git Repositories

The investigation reported approximately 28,000 publicly accessible repositories discovered during large-scale scanning.

The exposure was associated with internet-facing hosts where Git repository data could be retrieved.

✅ More Than 3.5 Million Hosts Were Scanned

The research described a scanning process that narrowed an initial pool of roughly 40 million domains to approximately 3.5 million hosts with active HTTP services.

This demonstrates the scale of the investigation rather than a small targeted assessment.

✅ Hundreds of Cloud and Service Credentials Were Found

The reported findings included more than 400 AWS access keys, 107 Stripe API keys, 123 OpenAI API keys, 80 Telegram tokens, and 17 GitHub personal access tokens.

The presence of these credentials demonstrates the potential impact of exposed Git histories.

✅ Deleted Secrets Can Remain in Git History

Git’s version-control architecture preserves historical objects and commits unless they are deliberately removed.

Therefore, deleting a secret from the latest version does not necessarily remove it from historical repository data.

Prediction

(+1) Secret Scanning Will Become a Standard Development Requirement

As organizations increasingly depend on cloud platforms, AI APIs, payment services, and automated deployment pipelines, repository security will become even more important.

Development platforms will likely continue expanding automated secret detection and policy enforcement, while organizations will increasingly block commits containing credentials before they enter repository history.

(+1) Production Deployment Pipelines Will Become More Restrictive

Automated deployment systems are likely to increasingly prevent .git directories and other development artifacts from reaching public web roots.

Containerized and artifact-based deployments will help organizations ship only the files required to run applications.

(+1) AI Will Improve Repository Security

AI-assisted security tools will increasingly analyze repository history, identify suspicious credentials, understand configuration context, and prioritize exposed secrets according to their potential business impact.

This could make large-scale repository auditing faster and more accurate.

(-1) Exposed Credentials Will Continue Appearing

Despite better tooling, human mistakes and legacy infrastructure will continue creating opportunities for exposure.

As long as organizations maintain large numbers of repositories and internet-facing applications, accidental credential leakage will remain a persistent security problem.

Final Verdict: A Simple Mistake With an Expensive Consequence

The discovery of 28,000 exposed Git repositories should not be dismissed as another routine cybersecurity statistic.

It demonstrates a fundamental reality of modern software development: the codebase is part of the attack surface.

A repository can contain years of history, forgotten credentials, internal documents, infrastructure details, and secrets that developers believed they had deleted.

The most effective defense is straightforward but requires discipline: keep .git away from public web roots, scan repositories continuously, use proper secret-management systems, enforce least privilege, monitor internet-facing assets, and immediately rotate credentials whenever exposure occurs.

Because in cybersecurity, the dangerous question is not whether a secret was accidentally committed.

The dangerous question is whether someone else has already found it.

🕵️‍📝Let’s dive deep and fact‑check.

🎓 Live Courses & Certifications:

Join Undercode Academy for Verified Certifications

🚀 Request a Custom Project:

Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

References:

Reported By: cyberpress.org
Extra Source Hub (Possible Sources for article):
https://www.instagram.com
Wikipedia
OpenAi & Undercode AI

Image Source:

Unsplash
Undercode AI DI v2

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow UndercodeNews & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin | 🦋BlueSky | 🐘Mastodon | 📺Youtube