Files
s41r4j-cve-2025-48384/test_external.sh
T

38 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
# Usage:
# IMAGE=cve-48384-git-2.47.2 REPO_URL=https://github.com/vinieger/CVE-2025-48384 ./test_external.sh
# Vars:
# IMAGE - Docker image with specific Git version (built via Dockerfile.source)
# REPO_URL - Remote PoC repo to clone (default: vinieger/CVE-2025-48384)
IMAGE=${IMAGE:-cve-48384-git-2.47.2}
REPO_URL=${REPO_URL:-https://github.com/vinieger/CVE-2025-48384}
echo "Testing external PoC repo: $REPO_URL with image: $IMAGE"
docker run --rm -t -v "$PWD:/work" -w /work "$IMAGE" bash -lc '
set -euo pipefail
echo "Using Git:" && git --version
rm -rf /tmp/ext
echo "Pre /tmp snapshot:" && ls -la /tmp > /tmp/before.txt && cat /tmp/before.txt
echo "Cloning recursively: $REPO_URL -> /tmp/ext"
git clone --recurse-submodules "$REPO_URL" /tmp/ext
echo "Post clone /tmp snapshot:" && ls -la /tmp > /tmp/after-clone.txt && diff -u /tmp/before.txt /tmp/after-clone.txt || true
echo "Show /tmp/ext/.gitmodules (hex if available):"
if [ -f /tmp/ext/.gitmodules ]; then
if command -v hexdump >/dev/null 2>&1; then hexdump -C /tmp/ext/.gitmodules | sed -n "1,120p"; else od -An -tx1 -v /tmp/ext/.gitmodules | sed -n "1,8p"; fi
else
echo ".gitmodules not present"
fi
echo "List hooks in cloned repo:" && ls -la /tmp/ext/.git/hooks || true
echo "Trigger top-level checkout (to run post-checkout hook if dropped):"
git -C /tmp/ext checkout -f HEAD || true
echo "Final /tmp snapshot:" && ls -la /tmp > /tmp/after-checkout.txt && diff -u /tmp/after-clone.txt /tmp/after-checkout.txt || true
for f in /tmp/flag.txt /tmp/*flag* /tmp/*pwn* /tmp/*owned*; do
[ -f "$f" ] && echo "Found potential flag/artifact: $f" && (sed -n '1,5p' "$f" || true);
done
'