Lab Icon

Git Exposed

What secrets lie hidden in the commit history?

Challenge Updated 21 Jun 2026 Solution (Pro)
Git Version Control Source Code Analysis Reconnaissance Web Security

A corporate website looks ordinary, but beneath its surface lurks a developer's mistake that exposes everything. An exposed .git directory sits on the production server, ready to reveal its secrets to anyone who knows where to look. Dive into version control history, reconstruct deleted files, and uncover sensitive information that should never have made it to production. Can you extract the flag from the depths of Git history?

1
Flags
50
XP
53%
Success Rate

Exposed Git repositories represent one of the most critical and frequently discovered vulnerabilities in web application security. When developers accidentally deploy their .git directory to a production web server, they expose the entire version control history of their project - including source code, configuration files, commit messages, and potentially sensitive credentials like API keys and database passwords.

What Is a .git Directory?

Git stores all repository metadata and history in a hidden .git folder at the root of every project. This directory contains the complete object database (all file versions and commits), branch references, configuration settings, and the staging index. When this folder is accessible on a live web server, anyone can reconstruct the full source code and review every change ever made to the project.

How Git Repositories Get Exposed

This vulnerability typically occurs through deployment mistakes. Common causes include copying the entire project directory (including .git) to the web server via FTP or rsync, using git clone directly in the web root, misconfigured CI/CD pipelines that include version control directories in build artifacts, and Docker containers that bundle the .git folder. Many popular web servers like Apache and Nginx do not block access to dotfiles by default, making the exposure immediately exploitable.

Real-World Impact of Exposed Git Repositories

Security researchers and bug bounty hunters routinely discover exposed Git repositories on Fortune 500 websites, government portals, and financial platforms. The consequences are severe: attackers can download the complete codebase, mine commit history for accidentally committed passwords and API tokens, discover internal architecture details, and identify additional vulnerabilities in the source code. Even credentials that were deleted in later commits remain recoverable from Git history.

Detection and Prevention

Organizations can prevent this vulnerability by configuring web servers to deny access to .git directories, using build pipelines that create clean deployment artifacts without version control metadata, and regularly scanning production servers with automated tools. Understanding how exposed Git repositories work and how attackers exploit them is essential knowledge for penetration testers and anyone responsible for securing web infrastructure.

What You Will Learn

  • How .git directories store version control history and metadata
  • Techniques for discovering exposed Git repositories on web servers
  • Reconstructing source code from publicly accessible .git folders
  • Extracting credentials and secrets from Git commit history
  • Preventing Git directory exposure through proper server configuration

Prerequisites

Basic Git version control Command line fundamentals Understanding of web servers

Ready to hack this lab?

Create a free account and start practicing cybersecurity hands-on.

Start Hacking - It's Free
Start Your Challenge
~1-2 min setup
Dedicated server
Private instance
Standard power
New here? Here's what to do
1
Click "Start Lab" above You'll get your own private machine with an IP address
2
Explore the target Open the IP in your browser and look for vulnerabilities
3
Find and submit flags Flags are secret text strings hidden in the system - paste them below to score

Ready to hack this lab?

Create a free account to start your own dedicated server, submit flags, and earn XP on the leaderboard.

Start Hacking Free
13,000+ Hackers 100+ Labs & Courses Free
Start Hacking Free