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.txtis 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.jsonfile exists:- The
startscript is injected to also runping 1.1.1.1at the same time as the originally listed command. - The additional file
ping_server.jsis created to also runping 1.1.1.1, and is set to themainproperty of thepackage.json
- The
- Docker and Docker Compose
- The ability to manage multiple terminals at once
- Run
docker compose upin one terminal - Open 2 more terminals, one for
eveand one foralice - Run
docker compose exec eve /bin/bashfor eve, anddocker compose exec alice /bin/bashfor alice - Run
./start_mitm.shin eve's machine - Verify the ARP spoofing attack worked by running
curl http://github.comand verifying the messageMITM Success! - Attempt to
git clone http://github.com/WHATEVERon alice's machine.