πŸ† CTF & Cyber Competition β€” Methodology & Strategy

Panduan metodologi, time triage, dan strategy untuk menghadapi kompetisi keamanan siber β€” dari jeopardy CTF sampai attack-defense, dari digital forensic sampai incident response. Fokus pada yang universal dan tidak terikat event tertentu. Untuk gambaran besar level kompetisi, lihat hierarchy-ctf-competition-framework. Untuk tools reference, lihat ctf-tool-arsenal-universal.

Prinsip Golden

β€œScore the lowest-hanging fruit first, then work up.” Di kompetisi, poin sama nilainya apakah Anda mendapatkannya dalam 5 menit atau 5 jam. Prioritaskan soal yang cepat diselesaikan, lalu investasikan sisa waktu untuk soal yang kompleks.


Daftar Isi


Fase Pra-Kompetisi β€” Persiapan & Recon

H-7 sampai H-1

PeriodeAktivitasOutput
H-7Baca rulebook, scoring system, format flagPaham: flag format (CTF{…}), tiebreaker (first blood? time?), peraturan anti-cheat
H-3Test koneksi ke platform, VPN/auth setupCache login. Pastikan VM/container bisa diakses
H-1Team sync: siapa handle kategori apa, komunikasi channel manaRACI matrix per kategori + backup person
H-0 (30 menit sebelum)Cek tools terinstall, internet stabil, backup comms (WA vs Discord vs Telegram)Semua siap, no last-minute tool install

Team Role Assignment (sudah harus fix sebelum mulai)

Kompetisi tim (3–5 orang):

RoleHandleKompetensiBackup
Web/PWNExploit & web challengeWeb security, binary exploitation, reverse engineeringCrypto person
Forensic/REFile analysis, memory dump, binary reverseForensik, malware analysis, steganographyAnyone
Crypto/MiscCipher, encoding, logikaCryptography, encoding, logic puzzlesWeb person
Attack (A/D)Exploit service lawanNetwork scanning, exploit dev, service monitoringSemua anggota
Defense (A/D)Patch service sendiriHardening, patch management, checker scriptSemua anggota

Untuk tim 2–3 orang: tiap orang pegang 2 kategori. Prioritas pada strength masing-masing.


Metodologi Jeopardy CTF (L1-L2)

Anatomi Soal CTF

Setiap soal CTF memiliki struktur yang sama:

Soal = Description + Attachment (optional) + Target/Endpoint + Flag

Flow umum menyelesaikan soal:

Read Description β†’ Identifikasi Kategori β†’ Cari Tool Default
β†’ Eksekusi Tool β†’ Analyze Output β†’ Dapat Flag

The 5-Minute Rule

Jika dalam 5 menit pertama Anda belum tau harus mulai dari mana:

  1. Baca description lagi β€” 80% clue ada di description, bukan di attachment
  2. Google judul soal + β€œCTF writeup” β€” mungkin soal lama yang di-recycle
  3. Jalankan CyberChef Magic β€” deteksi encoding/encryption otomatis
  4. strings, binwalk, file, exiftool pada attachment
  5. Skip β€” tandai sebagai β€œbutuh revisit”, kerjakan soal lain dulu

Flowchart Pemecahan Soal Per Kategori

Menerima Soal
    β”‚
    β”œβ”€β”€ Ada attachment?
    β”‚   β”œβ”€β”€ Ya β†’ file, strings, binwalk, exiftool
    β”‚   β”‚   └── Hasil? β†’ Flag langsung? β†’ Submit
    β”‚   β”‚       └── Tidak β†’ Analisis lebih lanjut (RE/decompile/carving)
    β”‚   └── Tidak β†’ Cek koneksi ke endpoint
    β”‚       β”œβ”€β”€ Web β†’ curl/nmap/dirb
    β”‚       β”œβ”€β”€ PWN β†’ nc/netcat, checksec
    β”‚       └── Misc β†’ Ikuti petunjuk
    β”‚
    └── 5 menit? Tidak dapat progress?
        └── Skip. Tandai. Kembali nanti.

Metodologi Attack-Defense CTF (L3)

Fase-Fase Attack-Defense

Setiap ronde Attack-Defense memiliki siklus yang sama:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Start Ronde                                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 1. SCAN & RECON (2–5 menit)                          β”‚
β”‚    nmap -p- team_lawan β†’ Cari service terbuka        β”‚
β”‚                                                      β”‚
β”‚ 2. PATCH & HARDEN (2–5 menit)                        β”‚
β”‚    Cek service sendiri β†’ Tutup celah β†’ Restart       β”‚
β”‚    Service harus jalan + checker harus lulus         β”‚
β”‚                                                      β”‚
β”‚ 3. ATTACK (sisa waktu)                               β”‚
β”‚    Exploit service lawan β†’ Inject flag β†’ Submit      β”‚
β”‚    Monitor checker: service sendiri masih health?    β”‚
β”‚                                                      β”‚
β”‚ 4. RECOVER (menit terakhir)                          β”‚
β”‚    Jika service down β†’ restart + re-patch            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Golden Rules Attack-Defense

RulePenjelasan
Hardening dulu, attack keduaJika service Anda sendiri tidak jalan, Anda dapat 0 poin defense + lawan dapat attack points. Harden service sendiri dulu baru attack
Checker script > exploitKalau checker script tidak lulus, skor defense Anda hilang. Pastikan checker bisa jalan terus. Monitor checker output adalah prioritas #1
Satu service, satu orangAttack person fokus ke 1 service β€” jangan gonta-ganti. Defense person monitor checker dan log
Restart policywhile true; do ./service; done bukan solusi β€” service harus restart dengan state yang valid. Pastikan flag di-inject ulang setelah restart
Exploit sederhana > exploit kerenBuffer overflow yang reliable > ROP chain yang kadang crash. Yang penting flag masuk, bukan elegance
Backup service binarySebelum patch, backup service binary. Jika crash setelah patch, restore dari backup

Script Starter untuk Attack-Defense

#!/usr/bin/env python3
"""Checker script template untuk Attack-Defense CTF"""
import requests
import sys
import time
 
TEAM_ID = sys.argv[1]
TARGET = f"http://10.0.{TEAM_ID}.3:8080"
 
def check_service():
    """Pastikan service berjalan & return status"""
    try:
        r = requests.get(f"{TARGET}/health", timeout=5)
        return r.status_code == 200
    except:
        return False
 
def submit_flag(flag):
    """Submit flag ke server"""
    r = requests.post("http://scoreboard/submit",
                      json={"flag": flag, "team": TEAM_ID})
    return r.json().get("status") == "ok"
 
# Main loop
while True:
    if not check_service():
        print(f"[!] Service DOWN! Restarting...")
        # Panggil restart script di sini
    else:
        print(f"[+] Service OK")
    time.sleep(30)

Metodologi Digital Forensic & Incident Response

Universal Forensic Triage

Ketika dapat soal forensic / incident response:

1. Cek file type β†’ file command atau header magic bytes
2. Cek strings β†’ strings file | grep -iE "flag|ctf|key|secret|password"
3. Cek metadata β†’ exiftool
4. Cek embedded file β†’ binwalk -Me
5. Cari hidden data β†’ foremost/scalpel/photorec
6. Analisis spesifik β†’ tergantung kategori (lihat kategori forensic di bawah)

Urutan Analisis Berdasarkan File Type

Disk Image (.dd, .e01, .img, .vmdk, .vhd)

file β†’ mmls (partition table) β†’ fls (file listing) β†’ icat (file content)
Timeline: log2timeline/plaso
File carving: foremost, scalpel, photorec
Registry: regripper (Windows)

Memory Dump (.raw, .vmem, .mem, dumpit)

imageinfo (Volatility 3) β†’ psscan β†’ netscan β†’ cmdline/malfind
String ekstraksi: volatility windows.strings
YARA scan: yara dengan malware signature

PCAP (.pcap, .pcapng)

Statistics: capinfos, wireshark statistics
Filter: HTTP objects β†’ File β†’ Export Objects β†’ HTTP
DNS: dns query β€” cari exfiltration
TLS: SSL/TLS handshake β€” cek certificate, cipher, SNI
TCP follow stream β€” cari flag dalam teks

Binary (.exe, .bin, .elf)

strings β†’ file β†’ binwalk β†’ objdump/readelf
Decompile: Ghidra, IDA Free, radare2, cutter
YARA: custom rule
Hash cek: VirusTotal, Hybrid Analysis

Cold-Start Playbook untuk Soal Forensic

Ketika baru buka soal forensic dan belum tahu harus mulai dari mana:

strings file | grep -i "flag\|CTF\|KEY\|secret\|password\|htb"

β†’ Jika hasil positif β†’ Submit flag. Selesai.

exiftool file

β†’ Cek metadata: author, camera, GPS, software, timestamps.

file + binwalk -Me file

β†’ Cek tipe file. Jika archive (zip/tar/gz) β†’ extract.

foremost -T -i file -o output/

β†’ File carving. Cari file tersembunyi.

strings file | grep -E "^[A-Za-z0-9+/]{20,}={0,2}$"

β†’ Cek base64 string dalam file.

hexdump -C file | grep -v "00 00 00" | head -50

β†’ Cek struktur non-null β€” mungkin ada data anomali.


Metodologi Topikal β€” Per Kategori

πŸ”Ή Web Exploitation

StepToolCommand
Reconcurl, wget, nmapcurl -v http://target:port
Directory bustingdirb/gobuster/dirsearchgobuster dir -u http://target -w wordlist.txt
Parameter fuzzingffufffuf -u http://target/FUZZ -w wordlist.txt
SQL Injectionsqlmapsqlmap -u "http://target/?id=1" --batch --dump
Cookie/sessiondev tools / jwt.ioBaca cookie, decode JWT
Source codeview-source:Cek komentar HTML, JS, hidden input
API endpointPostman, Burp SuiteRepeater, Intruder

Checklist Web:

  • robots.txt β€” sering ada endpoint tersembunyi
  • .git/config β€” git exposed (git-dumper)
  • /admin, /api, /swagger, /graphql
  • parameter pollution (WAF bypass)
  • JWT none algorithm attack
  • SSTI (Server-Side Template Injection) β€” {{7*7}}
  • LFI/RFI β€” /../../../../etc/passwd
  • File upload β€” .php, .phtml, .php5, .phar

πŸ”Ή Binary Exploitation (PWN)

StepToolCommand
Cek proteksichecksecchecksec --file=binary
Disassembleobjdump, Ghidra, radare2objdump -d binary
Find gadgetsROPgadgetROPgadget --binary binary
Test overflowPython/pwntoolscyclic(100) β†’ gdb pattern offset
Exploitpwntoolsp = remote('host', port)

Checklist PWN:

  • checksec: NX, PIE, RELRO, Stack Canary, ASLR
  • Cari fungsi yang terlihat vulnerable (gets, strcpy, sprintf, scanf %s)
  • Coba buffer overflow dengan cyclic pattern
  • Hitung offset ke RIP/EIP
  • ROP chain jika NX enabled
  • ret2libc/ret2system jika ada libc leak
  • one-gadget jika RCE tujuan

πŸ”Ή Cryptography

StepToolCommand
Auto-detectCyberChef MagicMagic recipe β†’ detect otomatis
Frequency analysisquipqiup.comSubstitution cipher solver
RSARsaCtfToolpython RsaCtfTool.py -n N -e e --uncipher c
XOR brutexortoolxortool cipher.bin
Hash identifyhash-identifierhashid hash.txt

Checklist Crypto:

  • Cek encoding dulu: base64, base32, base16, hex, ascii85
  • Cek cipher klasik: Caesar, ROT13, Vigenere, Atbash
  • XOR key length β†’ xortool brute
  • RSA: small N (factordb), small e (Coppersmith), common modulus
  • AES/block cipher: ECB mode (copy-paste block), CBC bit flipping
  • Padding oracle attack jika ada endpoint decrypt
  • Hash: rainbow table (crackstation.net), google hash

πŸ”Ή Reverse Engineering

StepToolCommand
Metadatafile, strings, exiftoolstrings binary | grep -i flag
Disassembleobjdump, radare2, Ghidraobjdump -d binary
DecompileGhidra, IDA Free, cutterImport binary β†’ decompile
Debuggergdb, x64dbg (Windows)gdb ./binary
.NET/DLLdnSpy, ILSpyBuka .NET binary langsung

Checklist RE:

  • strings dulu β€” sering flag langsung ada di string table
  • Cek fungsi compare/strcmp/strncmp β€” mungkin flag dibanding langsung
  • Trace input/output: coba input berbeda, lihat behavior
  • Patch conditional jump (JNZ β†’ JZ) untuk bypass check
  • Angry XOR: cari XOR dengan key tertentu, atau auto-XOR brute
  • UPX packed? upx -d

πŸ”Ή Digital Forensic

StepToolCommand
File typefilefile evidence.bin
Stringsstringsstrings evidence | grep -i flag
Disk partisimmls (sleuth kit)mmls disk.dd
File listingflsfls -o OFFSET disk.dd
File contenticaticat -o OFFSET disk.dd INODE
Timelineplaso/log2timelinelog2timeline --storage timeline.plaso disk.dd
Registryregripperrip.pl -r SYSTEM -f system

Checklist Forensic:

  • strings dulu β€” jangan lupa grepping case-insensitive
  • binwalk β€” cek embedded file dalam image
  • foremost β€” file carving mencari file yang dihapus
  • $MFT analysis β€” cari file dihapus, timestamp anomali
  • $Recycle.Bin β€” file apa yang dihapus
  • Prefetch β€” program apa yang pernah dijalankan
  • Event Log β€” login/logoff, service start/stop
  • Browser history β€” apa yang diakses user
  • Volume Shadow Copy β€” file versi sebelumnya (sering luput)

πŸ”Ή Attack Defense β€” Infrastruktur & Hardening

StepToolCommand
Scan service sendirinmapnmap -p- localhost
Cek port listeningnetstat/ssss -tlnp
Cek proses berjalanps, htopps aux | grep service
Patch permissionchmod, chownchmod 755 /opt/service
Firewalliptables/nftablesiptables -A INPUT -p tcp --dport 8080 -j ACCEPT
Monitortail, journalctltail -f /var/log/service.log

Checklist Hardening Cepat (menit-menit pertama):

  • Non-root user untuk service β€” jangan jalan sebagai root
  • Bind ke localhost dulu β€” Listen 127.0.0.1:PORT
  • Firewall β€” hanya port yang dibutuhkan
  • Rate limiting β€” limit_req untuk Nginx
  • Input validation β€” semua input = malicious sampai terbukti aman
  • Hapus debug mode / verbose error
  • Rotate credentials β€” ganti default password
  • Backup binary sebelum patch
  • Test checker script β€” pastikan jalan valid

Time Triage β€” Strategi Menit ke Menit

Jeopardy (24+ jam)

0–30 menit  β†’ Scan semua soal, kategorisasi: easy/hard, cari "first blood"
30–60 menit β†’ Kerjakan semua "easy" soal β€” 1 soal per 10 menit maks
1–4 jam     β†’ Kerjakan soal "medium" β€” kolaborasi 2 orang per soal jika stuck
4–12 jam    β†’ Istirahat 15 menit per 2 jam. Kerjakan "hard"
12–24 jam   β†’ Review soal yang di-skip β€” mungkin ada clue baru dari soal lain
24+ jam     β†’ Final push: cari flag fragment, cari unintended solution

Attack-Defense (6–10 jam)

5 menit pertama:
    - Scan service sendiri β†’ identifikasi service apa yang jalan
    - Patch service sendiri β†’ nonaktifkan debug/endpoint berbahaya
    - Cek checker script β†’ pastikan checker lulus

Setiap ronde (30–60 menit):
    - 5 menit: scan service lawan β†’ port/service baru?
    - 5 menit: cek service sendiri β†’ masih jalan?
    - Sisa waktu: attack

Akhir ronde:
    - 2 menit: restart service jika crash
    - 1 menit: submit flag yang didapat

Incident Response (Live Exercise, 2–5 hari)

Hari 1 β€” Triage & Containment:
    - Identifikasi scope: apa yang terkena, apa yang tidak
    - Isolate: disconnect dari network jika lateral movement terdeteksi
    - Collect volatile evidence: RAM, network, process (L0-L2)

Hari 2 β€” Analysis & Eradication:
    - Analisis malware/malicious artifact
    - Hapus persistence mechanism
    - Patch vulnerability yang dieksploitasi

Hari 3 β€” Recovery & Lessons Learned:
    - Restore service dari backup bersih
    - Monitoring post-recovery β€” apakah attacker kembali?
    - Dokumentasi timeline + TTP untuk laporan

Teamwork & Komunikasi

Communication Protocol (dalam tim)

SituasiWhat to SayWhat NOT to Say
Stuck di soal >30 menit”Saya stuck di X, butuh bantuan Y""Ini susah banget”
Ada clue baru”Di soal Z ada clue: …”(diam saja)
First blood”Soal X solved, flag di spreadsheet""Gampang kali”
Service down (A/D)β€œService Y down, restarting…""Waduh kacau”
Dapet flag besar”Flag X dapet, submit ya”(langsung submit tanpa info tim)

Shared Resources

Tim harus punya satu spreadsheet bersama (Google Sheets / Notion) dengan:

SoalKategoriPointsStatusAssignedNotes
Forensic 1Forensics100βœ… SolvedAlicestrings β†’ base64 decode
Web 1Web200πŸ”΄ StuckBobSQL injection butuh bypass WAF
Crypto 1Crypto300⏸️ Skippedβ€”RSA, N besar β†’ factordb?

Format flag:

flag{nama_soal_flag}

Tools Prioritization β€” Fallback Chain

Untuk setiap kategori, punya 3 tier tool:

TierArtiContoh
Tier 1Default β€” langsung jalanCyberChef, strings, file, exiftool, nmap
Tier 2Spesifik β€” butuh setup minimalVolatility, Ghidra, foremost, sqlmap
Tier 3Advanced β€” butuh waktu setupPlaso, custom script, IDA Pro

Aturan: Jika Tier 1 gagal, jangan langsung Tier 3 β€” coba Tier 2 dulu untuk 15 menit. Jika masih gagal, baru Tier 3.

Tool Fallback per Kategori

Forensics: exiftool β†’ strings β†’ foremost β†’ binwalk β†’ Volatility 3 β†’ plaso Web: curl β†’ nmap β†’ gobuster β†’ sqlmap β†’ Burp Suite PWN: checksec β†’ objdump β†’ gdb β†’ pwntools β†’ ROPgadget Crypto: CyberChef Magic β†’ hash-identifier β†’ xortool β†’ RsaCtfTool RE: strings β†’ file β†’ objdump β†’ Ghidra β†’ gdb


Post-Mortem & Knowledge Base

Setelah Kompetisi Selesai

Dalam 24 jam setelah kompetisi, lakukan writeup:

  1. Tulis setiap soal yang solved β€” langkah, tool, command, flag
  2. Tulis setiap soal yang NOT solved β€” analisis: kurang tool? waktu? skill?
  3. Simpan attachment soal β€” karena biasanya ditutup setelah event
  4. Catat insight unik β€” mis: β€œdi soal forensic ternyata ada hidden NTFS stream”

Writeup Template

# [Nama Kompetisi] β€” [Soal Nama]
 
**Kategori:** [Forensic / Web / PWN / Crypto / RE / Misc]
**Points:** [100]
**Status:** βœ… Solved | ❌ Not Solved
 
## Deskripsi Soal
 
[Copy paste deskripsi dari soal]
 
## Attachment
 
[Path ke attachment yang disimpan]
 
## Solusi
 
### Langkah 1: ...
 
Command: `...`
Output: `...`
 
### Langkah 2: ...
 
...
 
## Flag

flag{…}


## Key Takeaway
[Apa yang dipelajari dari soal ini]

Knowledge Base dari Writeup

Kumpulkan writeup di folder 03_Resources/[nama-event]/. Link ke ctf-tool-arsenal-universal jika ada tool baru yang dipelajari. Update tool arsenal jika ada tool yang ternyata berguna.

Yang wajib dicatat:

  • Command yang berhasil β€” jangan lupa flag path
  • Tool version β€” tool update bisa ubah behavior
  • One-liner yang berguna β€” untuk reuse di event berikutnya

Quick Reference β€” One-Liners Penting

# Cari flag dalam semua file
grep -r "CTF{" .
 
# Cari string base64: minimal 32 char, alphanumeric
strings file | grep -E "^[A-Za-z0-9+/]{32,}={0,2}$"
 
# Cek magic bytes file
xxd file | head -1
 
# Extract semua string ASCII printable
strings -n 6 file
 
# Carving dengan foremost
foremost -T -i file -o output/
 
# Binwalk extract semua embedded file
binwalk -Me file
 
# Volatility 3: cari process anomali
python3 vol.py -f memory.dump windows.psscan
 
# Ekstrak file dari PCAP HTTP
tshark -r capture.pcap --export-objects http,output/


CTF Methodology & Strategy Β· Universal β€” tidak terikat event Β· Triage > Brute Force Β· Team Communication = Force Multiplier