<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Luka Sikic on Medium]]></title>
        <description><![CDATA[Stories by Luka Sikic on Medium]]></description>
        <link>https://medium.com/@CroCyber?source=rss-2e28b0be9faf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7-EGfVcHdwIHVLsN.jpg</url>
            <title>Stories by Luka Sikic on Medium</title>
            <link>https://medium.com/@CroCyber?source=rss-2e28b0be9faf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 03:53:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@CroCyber/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[.git — The Hidden Danger]]></title>
            <link>https://medium.com/@CroCyber/git-the-hidden-danger-b946520121d7?source=rss-2e28b0be9faf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b946520121d7</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Luka Sikic]]></dc:creator>
            <pubDate>Mon, 04 Dec 2017 11:44:35 GMT</pubDate>
            <atom:updated>2017-12-12T19:30:44.567Z</atom:updated>
            <content:encoded><![CDATA[<p>Git is great versioning system that I am actively using while doing some development.</p><p>Few days ago, <a href="https://medium.com/u/cdd25d7b5759">Osanda Malith</a> told me that during pen test he found one domain have .git accessible through the web and asked me if we can get location of remote repository and see what we can do with it.</p><p>I was introduced to GIT at my previous job where I worked as Junior Developer which helped me to understand how it works. Shouts out to you guys!</p><p>Since there was only directory listing in .git main folder, but not in sub-directories this gave me hard time figuring out how GIT works under the hood and where is it saving commits, branches, diffs…</p><p>So I initialised local GIT repo to help me understand It’s structure. The starting point was when I found hash of master branch at:</p><pre>.git/refs/heads/master<br>be42b85add97345e653f65e2556abc1b4372480b</pre><p>I knew I have to find this hash file somewhere because I saw these files with hash names before. Doing quick search for the master hash from my local repo. Found nothing, ok. How about searching half of the hash? Bam, it worked. Hash file was found in:</p><pre>.git/objects/be/42b85add97345e653f65e2556abc1b4372480b</pre><p>Notice how first 2 bytes of the hash are being separated and rest of the hash is saved in that directory. That hash file must be saved in the same location at your local repo.</p><p>Great, so I downloaded the commit and now I can read the source or whatever? How about no!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Qqmwjk2mKF91eLYRWASw_w.png" /><figcaption>Doing cat on the hash file returned me this</figcaption></figure><p>Google to the rescue! After few minutes of looking at the results I found interesting one that might work: git-cat-file — Provide content or type and size information for repository objects</p><pre><em>git cat-file</em> (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | &lt;type&gt; | --textconv | --filters ) [--path=&lt;path&gt;] &lt;object&gt;</pre><p>Let’s give it a shot!</p><pre>git cat-file -p be42b85add97345e653f65e2556abc1b4372480b</pre><pre>tree fa4d5d060e1b0a76ee2649a7ceaa46e5a723d588<br>parent cf662496f73a9873a5325a003ef30d9fc8029e89<br>parent 9f8d8d9344e9edcfbfced76a4b736c9370099392<br>author XXX XXXX &lt;XXXX@XXXXXX.XX&gt; 1512147679 +0000<br>committer XXX XXXX &lt;XXXX@XXXXXX.XX&gt; 1512147679 +0000</pre><p>Using the same technique I downloaded and read tree hash. Which returned list of files and directories from that repository.</p><pre>git cat-file -p fa4d5d060e1b0a76ee2649a7ceaa46e5a723d588</pre><pre>100644 blob 91ba58f0299ff69b8fb2d4c0fa77ecdd123f8455    .env<br>100644 blob ca7fe338024f6dad049c2769d9aa44bea5cfb764    .gitignore<br>040000 tree 6a2e95ee1372246c0cd05f5ac6d9e1fdd2f3b909    app<br>100644 blob 5c23e2e24fc5d9e8224d7357dbb583c83884582b    artisan<br>040000 tree f658c50fe4cd32477bd0dc2adbb7560aaeb1477f    bootstrap<br>040000 tree b48aa1eb866f320c6566bf20cf3e62cbd7c67047    config<br>040000 tree 6ac9219ea772c3322e73f2a440e37c8bb322ed0f    database<br>100644 blob 9f5b9fd83339f1bab4c35884ccac05130867fc44    package-lock.json</pre><p>Doing same technique again I downloaded .env hash file from</p><pre>.git/objects/91/ba58f0299ff69b8fb2d4c0fa77ecdd123f8455</pre><p>Into my local repo at same location. Reading from this object returned useful information including DB and SMTP authentication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*YXJRGBQpzR-RuMdQTIlczw.png" /></figure><p>You can read every file from the work tree, you just need hash. All objects are saved in</p><pre>.git/objects/&lt;first_2_bytes&gt;/&lt;the_rest_of_the_hash&gt;</pre><p>Thanks to Osanda Malith for the idea of .git research.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b946520121d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>