repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
git-dumper.mdMarkdown78 lines3.7 KiBrendered raw download
---
title: "git-dumper"
description: "Recover an exposed web Git repository, validate the reconstructed objects, and inspect current files and history for leaked configuration."
category: enumeration
alsoIn: [web, git-workflow]
tags: [enumeration, git, source-disclosure, web, credential-access]
tools: [git-dumper, Git, curl]
difficulty: intermediate
updated: "2026-10-11"
references:
  - name: "git-dumper upstream"
    url: "https://github.com/arthaud/git-dumper"
    relation: link-only
    note: "CLI, reconstruction behaviour and local execution warning."
  - name: "Sushil Poudel's public sample report"
    url: "https://dollarboysushil.com/assets/files/CPTS%20Exam%20sample%20report%20guide%20by%20dollarboysushil.pdf"
    relation: link-only
    note: "Pages 10-12 identify exposed Git and git-dumper; examples here use different lab values."
---

# git-dumper

Use `git-dumper` when a web server exposes repository metadata under `/.git/`. It reconstructs what it can retrieve, making source and history available for inspection. Keep recovered repositories in an isolated review environment: upstream warns that attacker-controlled repository content can lead to execution on the machine performing the download.

## 1. Confirm a real Git response

```bash
curl -i 'http://app.domain.htb/.git/HEAD'
curl -i 'http://app.domain.htb/.git/config'
```

A plausible HEAD contains a branch reference or commit identifier. Compare it with a nonexistent URL: a generic HTML page returning 200 is not evidence that Git metadata is exposed.

## 2. Recover into a new directory

```bash
git-dumper --help
git-dumper -j 2 -t 10 'http://app.domain.htb/.git/' recovered-app
```

The URL is the exposed metadata location; the directory is local output. Start with modest concurrency, capture warnings, and keep the download separate from repositories you already use.

## 3. Verify the reconstruction

```bash
git -C recovered-app rev-parse --is-inside-work-tree
git -C recovered-app --no-pager log --oneline --all -n 20
git -C recovered-app fsck --full
```

Dangling objects are not the same as missing or corrupt objects. An incomplete download can still yield useful files, but state that limitation. Do not run recovered application code, build scripts or dependency installation just to inspect it.

## 4. Inspect source and history

```bash
# Identify files to review without printing secret values immediately
rg -l -i 'password|passwd|api[_-]?key|connectionstring|secret' \
  recovered-app --glob '!.git/**'

# Search commit history for the addition/removal of a relevant field
git -C recovered-app --no-pager log --all -S 'DB_PASSWORD' --oneline
# Inspect a selected historical version; substitute an observed commit/path
git -C recovered-app --no-pager show '<commit>:<config-path>'
```

A deleted secret may remain in a historical object. Record the commit/path and distinguish a candidate credential from one validated on a specific service. Removing it from the latest commit does not revoke it.

## Success and next step

**Success:** genuine metadata is retrievable and meaningful source or history is recovered. A download directory existing does not establish completeness. For evidence, retain the response, relevant file/commit and a redacted impact demonstration.

The corrective action is to stop serving repository metadata and rotate exposed credentials; removing directory listing alone does not block direct object retrieval. See [Git](/sheets/git-workflow/git) for repository inspection and [John extractors](/sheets/password-attacks/john-extractors) if the recovered artifact is encrypted.

## Sources

- [git-dumper](https://github.com/arthaud/git-dumper)
- [Git log documentation](https://git-scm.com/docs/git-log)
- [Git fsck documentation](https://git-scm.com/docs/git-fsck)