2

For a challenge I found that I was able to download files off of /.git/ After using the tools from GitTools I soon realised that my goal was to get to read config.inc.php file. But the problem is, I got index.php extracted but not config.inc.php after extracting using GitTools. Am I missing something? Kindly please guide me in the right direction.

[EDIT: Turns out that I was stupid enough to not notice that config.inc.php was in the .gitignore file. From what I understand, I won't ever get config.inc.php but I am positive that I have some other progress I can work with.]

Code Gatherer
  • 57
  • 1
  • 6
  • It was originally posted at security.stackexchange.com but then got migrated, Just for context. – Code Gatherer Sep 26 '20 at 16:11
  • 2
    I am a little confused, but intrigued. You got access to the .git folder of a project, and only to that. You have an idea of the content you are looking for, you are using [GitTools](https://github.com/internetwache/GitTools). How are you sure that file is there? Can you elaborate more on the "broken" part? – Daemon Painter Sep 26 '20 at 18:11
  • @DaemonPainter sorry for the late reply. I won't be spoiling everything here for those who stumbled across the same challenge, But I was able to extract git files from a website. Kindly see the edit I made in the post. I hope my use of terminology is correct. Else, feel free to correct me. – Code Gatherer Sep 29 '20 at 07:17

1 Answers1

2

Going by the following answer you can find the blob that is linked (through a tree) to a specific filename (config.inc.php): Finding a file by its corresponding blob's hash in a git repository?

I created a repo with a file called config.inc.php (with garbage data) and pretended i only had the .git folder.

$ git rev-list --all | xargs -n1 -iX sh -c "git ls-tree -r X | grep config.inc.php"
100644 blob fa93ddba97a77274627f5a43fc2a9119ac6def66    config.inc.php

And to inspect the contents of that blob:

$ git cat-file -p fa93ddba97a77274627f5a43fc2a9119ac6def66
isidfisdifisdfisidf
zrrbite
  • 1,180
  • 10
  • 22