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.

AI・機械学習

この数値の測り方

計測したスター増加

24時間
0
7日間
履歴を収集中
15日間
履歴を収集中
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

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.

関連プロジェクトを探す

読み込み中…