Security

Stolen GitHub Token Led to Internal System Compromise

OrasecDecember 30, 20253 min read

Written by the OraSec security research team — offensive security engineers and penetration testers.

Stolen GitHub Token Led to Internal System Compromise

Most companies think of GitHub as a development tool.

Attackers think of it as an access gateway.

This case shows how a single leaked GitHub token quietly turned into an internal system compromise without malware, phishing campaigns, or loud alerts.

Just one exposed secret.

Why GitHub Tokens Are So Valuable

GitHub tokens are often more powerful than passwords.

Developers use them to:

  • Access private repositories
  • Pull or push code
  • Trigger CI/CD pipelines
  • Interact with internal tools and cloud services

If a token is leaked, attackers don’t need to guess credentials.
They already have them.

At Orasec, stolen source control tokens are one of the most underestimated risks we encounter during security assessments.

How the Token Was Exposed

In this incident, a developer accidentally committed a GitHub access token to a public repository.

It wasn’t intentional.
It wasn’t malicious.
It was a moment of oversight.

The token appeared in:

  • A configuration file
  • Hardcoded for quick testing
  • Pushed during a late-night commit

Within minutes, it was indexed.

Attackers constantly monitor public repositories for exposed secrets using automated tools.
This token didn’t stay private for long.

What the Attacker Did Next

Once the token was discovered, the attacker tested its permissions.

The token had:

  • Read access to private repositories
  • Access to CI/CD workflows
  • Visibility into internal project structure

That was enough.

By cloning private repositories, the attacker gained:

  • Internal architecture details
  • API endpoints
  • Environment configurations
  • References to internal systems

This information became the blueprint for the next stage.

From Code Access to System Access

Inside the repositories, the attacker found more than just source code.

They found:

  • Hardcoded service credentials
  • Cloud resource identifiers
  • Internal URLs and admin panels
  • Deployment scripts

One CI pipeline had permissions to interact with internal infrastructure.

By abusing the pipeline, the attacker executed jobs that reached systems never intended to be exposed externally.

No firewall was bypassed.
No exploit was used.

The system trusted GitHub, and GitHub trusted the token.

Why No One Noticed

Everything looked legitimate.

The access:

  • Came from GitHub infrastructure
  • Used valid credentials
  • Followed normal workflows

Logs showed “authorized activity.”

There were no failed logins.
No brute-force attempts.
No alarms.

This is why token-based compromises are so dangerous; they blend in.

Impact of the Compromise

The attacker gained limited but real internal access.

While no customer data was directly stolen, the risk was severe.

Potential impact included:

  • Further lateral movement
  • Source code theft
  • Supply chain manipulation
  • Persistence through CI/CD pipelines

If left undetected, this could have escalated into a full infrastructure breach.

How the Issue Was Contained

Once suspicious activity was identified, the response was immediate.

The company:

  • Revoked the exposed GitHub token
  • Rotated all related credentials
  • Audited CI/CD permissions
  • Removed secrets from repositories
  • Implemented secret scanning

Access paths were closed before the attacker could escalate further.

Lessons Learned

This incident reinforced several hard truths.

Tokens Are Credentials

GitHub tokens should be treated like root passwords, not convenience tools.

Public Repos Are Constantly Watched

Attackers don’t search manually. Automation does it for them.

CI/CD Pipelines Are Attack Paths

Anything trusted by your pipeline must be locked down.

Visibility Matters

If you don’t monitor developer tooling, you won’t see these attacks coming.

How to Prevent GitHub Token Compromises

Simple practices make a big difference:

  • Never hardcode secrets in repositories
  • Use environment variables and secret managers
  • Restrict token scopes aggressively
  • Rotate tokens regularly
  • Enable secret scanning
  • Monitor GitHub activity for anomalies

Most importantly:
Assume leaked secrets will be abused.

Final Thoughts

This breach didn’t start with hacking.

It started with trust.

A trusted token.
A trusted platform.
A trusted pipeline.

Attackers didn’t break in; they walked in.

GitHub is not just a code platform anymore.
It’s part of your security perimeter.

If you protect everything except your developer tooling, you’re leaving the door open.

And attackers know exactly where to look.

Explore related services

Need hands-on help? Our security testing services put this research into practice.

Passkey Security: How Attackers Can Bypass Phishing-Resistant MFA

Passkey Security: How Attackers Can Bypass Phishing-Resistant MFA

Passkeys are built to stop phishing and remove reusable passwords. They use public-key cryptography, so attackers cannot simply steal a password and use it again. But passkeys do not protect every part of the login process. If the device, browser, recovery flow, or website checks are weak, attackers may still find another way in. What Is Passkey Security? Passkey security covers more than the passkey itself. It also includes the device, browser, credential manager, recovery flow, and website

·3 min read
Malicious VS Code Extensions: How IDE Supply Chain Attacks Steal Developer Secrets

Malicious VS Code Extensions: How IDE Supply Chain Attacks Steal Developer Secrets

Developers trust VS Code with source code, Git repositories, and private credentials. That trust can become a risk when an extension is malicious. A bad extension may look like a normal coding tool. Once installed, it can read files or contact remote servers. It may also start other programs or search the system for secrets. What Are Malicious VS Code Extensions? Malicious VS Code extensions are add-ons that contain harmful code. Some copy the name or style of real tools. Others offer a usef

·4 min read
AI Agent Security: How Prompt Injection Becomes an Attack Path

AI Agent Security: How Prompt Injection Becomes an Attack Path

AI agents can do more than answer questions. They can read files, call APIs, access repositories, use tools, and trigger workflows. If an attacker influences what an agent reads, the agent may take an unintended action using its own permissions. This is why AI agent security matters. What Is AI Agent Security? AI agent security protects AI systems that can access data, use tools, call APIs, and perform actions. Unlike a chatbot, an AI agent may connect to cloud services, source code, intern

·3 min read