T1213.003

Code Repositories

Sub-technique of T1213 Data from Information Repositories ↗

Pulling code, secrets and credentials from git repositories (exposed on the web or internal, such as Gitea).

How it shows up on Hack The Box

An accessible /.git/ is downloaded with git-dumper. Check every commit, not just the last one: deleted credentials are still in the history.

Techniques in our catalog that match this one (the number is their machines):

Machines to practice it

Sorted from easiest to hardest. The ▶ link takes you to the minute of the IppSec video where it is used.

Guides

Commands

Taken from our cheatsheets and tool pages. Type your details and they are filled into every command.

Your values Saved in this browser and applied to every cheatsheet.

Web enumeration › Common findings

Dump an exposed .git
git-dumper http://box.htb/.git/ repo
Review the history
cd repo && git log --oneline && git show HEAD~1
Search secrets in every commit
git log -p | grep -iE 'pass|secret|token|key'

git-dumper › From .git to the secret

Search secrets across the whole history
git log -p --all | grep -iE 'pass|secret|token|key'
See what changed in the last commit
git show --stat HEAD && git diff HEAD~1

Tools