Information disclosure in version control history
In this lab titled “Information Disclosure in Version Control History”, the objective was to identify and exploit sensitive data exposure caused by improper handling of version control artifacts, specifically an exposed .git directory on a web server. The engagement began with a reconnaissance phase, where I performed directory brute-forcing using dirsearch to enumerate hidden paths and commonly exposed files. During this enumeration, I discovered that the target was serving the .git directory over HTTP, which immediately indicated a high-risk misconfiguration. Exposed Git metadata often allows reconstruction of the entire source code repository, including commit history, branches, and previously deleted sensitive information.
Following the discovery, the next phase focused on extracting the repository contents from the exposed .git directory. Instead of manually reconstructing the repository structure, I used an automated Git dumping utility sourced from GitHub designed specifically for recovering exposed repositories. After cloning and setting up the tool locally, I encountered several environment-related issues that required manual remediation. These included repairing the Python virtual environment, resolving missing or incompatible dependencies in requirements.txt, adjusting filesystem permissions to allow execution, and correcting the Python shebang to ensure compatibility with python3. Once these issues were resolved, the tool successfully retrieved the .git directory and reconstructed the repository locally for offline analysis.
After extraction, I attempted to interact with the repository using standard Git tooling. However, Git initially blocked execution due to its built-in safety mechanism for untrusted repositories. This was resolved by explicitly marking the directory as safe using the following configuration:
git config --global --add safe.directory /leakedgit-lab1
Comments