Uncovering Security Vulnerabilities: A Deep Dive into an Eye-Opening Git Discovery

Introduction

Sanaullah Aman Korai
3 min readOct 9, 2023

In the ever-evolving world of cybersecurity, staying one step ahead of potential threats is crucial. Recently, I stumbled upon a fascinating yet alarming discovery while conducting a routine web security assessment: an exposed .git directory for a hypothetical example.com company. This seemingly innocuous oversight led me down a rabbit hole, ultimately uncovering SQL injection vulnerabilities and hardcoded credentials within their source code. In this article, I will walk you through my journey, sharing valuable insights and lessons learned along the way.

Screenshot 1: The Exposed .git Directory

Uncovering the .git Directory

My journey began when I was scanning example.com’s website for common security issues. To my surprise, I discovered an exposed .git directory, which contained a treasure trove of valuable information. Git is a version control system that tracks changes in source code, and its .git directory typically stores a project’s entire history. When exposed, it can potentially reveal sensitive data, including source code and configuration files.

Screenshot 2: The Contents of the .git Directory

Retrieving the Source Code

To retrieve the source code from the exposed .git directory, I used a tool called “git-dumper.” This tool allows you to clone a Git repository even when the .git directory is publicly accessible. By running git-dumper, I was able to obtain the company’s source code, which is usually kept private and hidden from public view.

Screenshot 3: Using git-dumper to Retrieve Source Code

Analyzing the Source Code

With the source code in hand, I began a thorough analysis. My primary goal was to identify any security vulnerabilities that could pose a risk to the company. One significant finding emerged from this analysis:

1. Hardcoded Database Credentials

To my surprise, I stumbled upon hardcoded database credentials within the source code. Hardcoding sensitive information like database usernames and passwords is a grave security oversight. If an attacker gains access to this information, they could potentially gain full access to the company’s database.

Upon discovering these vulnerabilities, I followed responsible disclosure practices. I promptly notified example.com’s security team about the issues and provided them with detailed information and recommendations for remediation. It’s crucial to act responsibly when uncovering security flaws to ensure they are addressed promptly and responsibly.

Conclusion

My journey from discovering an exposed .git directory to uncovering SQL injection vulnerabilities and hardcoded credentials was both eye-opening and educational. It underscores the importance of robust security practices in web development and the need for regular security audits. As a community, we must remain vigilant in identifying and addressing security vulnerabilities to protect sensitive data and the integrity of our systems.

In closing, always remember the importance of responsible disclosure and ethical hacking when encountering security issues. It’s our collective responsibility to make the internet a safer place for everyone.

Thank you for joining me on this journey of discovery and security awareness. Stay safe, stay secure, and keep exploring the fascinating world of cybersecurity.

--

--