This is a working implementation of a theoretical MITM attack against git cloning created by Alec Machlis. Currently, it supports MITM against GitHub (and in theory but not tested, GitLab) using the HTTP protocol. It works best on smaller repos - large repositories may take extremely long to process on the server and uses a lot of RAM to cache the objects.
As-is, the MITM attack does 2 things:
- The file
malicious.txt
is added to the root folder of the repository on the HEAD commit of the primary branch with the contentsThis is not a real file in the repo
- If a
package.json
file exists:- The
start
script is injected to also runping 1.1.1.1
at the same time as the originally listed command. - The additional file
ping_server.js
is created to also runping 1.1.1.1
, and is set to themain
property of thepackage.json
- The
- Docker and Docker Compose
- The ability to manage multiple terminals at once
- Run
docker compose up
in one terminal - Open 2 more terminals, one for
eve
and one foralice
- Run
docker compose exec eve /bin/bash
for eve, anddocker compose exec alice /bin/bash
for alice - Run
./start_mitm.sh
in eve's machine - Verify the ARP spoofing attack worked by running
curl http://github.com
and verifying the messageMITM Success!
- Attempt to
git clone http://github.com/WHATEVER
on alice's machine.