Skip to content
المشاريع

حول

Single-file bash toolkit for King of the Hill CTF: instant box recon, one-command lockdown, detached crown loop and anti-backdoor daemon. Zero dependencies, no AI — pure speed.

الذكاء الاصطناعي وتعلّم الآلة

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
جارٍ جمع السجل
خلال 15 يومًا
جارٍ جمع السجل
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

koth — King of the Hill toolkit

A single-file bash toolkit for King of the Hill CTF machines. Zero dependencies, zero config — copy one file onto the box and you control the crown in the first minute.

No AI, no external services, no setup. Pure bash + coreutils, so it works on the most stripped-down targets.

Why

KoTH is a speed game: grab /root/king.txt fast, keep it, and evict every adversary trying to take it back. Doing this by hand wastes the first critical minutes. koth compresses the whole workflow into four commands.

Quick start

# copy the script to the box however you got in
scp koth user@target:/tmp/koth && ssh user@target
chmod +x /tmp/koth

# 1. first 10 seconds: how do I root this box, who is here?
./koth recon

# 2. once root: evict adversaries + close their ways back in
./koth harden yourname

# 3. take the crown, detached (survives logout)
./koth grabd yourname

# 4. anti-backdoor watch, detached — auto-reverts adversary persistence
./koth parryd yourname

Commands

Command What it does
recon 10-second enumeration: uid0 accounts, adversary sessions, listeners, SSH keys present, non-standard SUID binaries (GTFOBins hint), docker.sock, crons, suspicious processes
grab <name> Crown loop in foreground — rewrites king.txt every second
grabd <name> Same but detached (setsid/nohup) — survives logout and shell death
harden <name> Lockdown: archives other users' SSH keys, locks their passwords, strips SUID from GTFOBins-capable binaries (keeps su/sudo working), locks docker.sock to root, kills foreign shells, evicts adversary crontabs, makes king.txt immutable when possible
parry <name> Anti-backdoor daemon: snapshots users/keys/crons/SUID, detects any persistence change, and automatically counter-attacks — locks rogue uid0 accounts, purges reappearing SSH keys, strips new SUID binaries, rewrites the crown
parryd <name> Same, detached with a log file
status Current king, whether your loops are running, who else is on the box
stop Stop crown loop + parry
unim Remove chattr +i from king.txt
install Install to /usr/local/bin/koth

Configuration

Everything is a flag or an env var — nothing is hardcoded:

KOTH_NAME=you        # crown name (or pass it as argument)
KOTH_KING=/root/king.txt   # king file path
KOTH_INTERVAL=1      # seconds between loop iterations

Design notes

  • Overlay-safe writes: the crown loop writes with shell redirection (>), which creates a fresh file on overlay upper layers instead of failing on in-place writes — the classic KoTH king.txt trap.
  • Foreground vs detached: grab/parry run in foreground so you can watch; the d variants survive SSH disconnection, which is what you actually want in a match.
  • Non-destructive evictions: harden archives evicted keys/crons under /tmp/.koth/ instead of deleting them — useful intel on your adversaries.
  • Parry re-baselines after each remediation, so it only alerts on new adversary actions instead of looping on its own fixes.

Ethics

For use in organized KoTH events (TryHackMe King of the Hill, HackTheBox battlegrounds, private CTFs) where attacking the box is the explicit rules of engagement. Never point this at anything you don't own or aren't authorized to test.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…