8.2.2 Service Enumeration
Service enumeration adalah fase lanjutan setelah port scanning berhasil mengidentifikasi port terbuka. Pada fase ini, tester menentukan secara persis layanan apa yang berjalan di balik setiap port, versi perangkat lunak yang digunakan, sistem operasi host, dan informasi tambahan melalui banner grabbing. Informasi ini menjadi bahan utama untuk menemukan kerentanan yang sesuai di fase vulnerability discovery dan exploitation.
Tujuan Service Enumeration
- Mengidentifikasi nama layanan dan versi aplikasi (Apache 2.4.49, OpenSSH 8.9p1, dll.)
- Menentukan sistem operasi target melalui OS fingerprinting (Linux, Windows, macOS)
- Mengekstrak banner dan metadata dari layanan
- Menemukan konfigurasi default atau informasi sensitif yang bocor
- Memvalidasi hasil port scanning - memastikan port benar-benar aktif dan bukan false positive
Version Detection dengan Nmap -sV
Opsi -sV pada Nmap adalah alat utama untuk service
version detection. Nmap mengirimkan probe khusus ke port terbuka dan
menganalisis respons untuk mencocokkan signature database.
Penggunaan Dasar
# Version detection pada semua port terbuka
nmap -sV target.com
# Dengan intensitas probe lebih tinggi (0-9, default 7)
nmap -sV --version-intensity 9 target.com
# Light scan - hanya probe yang paling umum
nmap -sV --version-light target.com
# Heavy scan - semua probe, paling akurat
nmap -sV --version-all target.com
# Gabung dengan SYN scan
nmap -sS -sV target.com
# Gabung dengan default NSE scripts
nmap -sV -sC target.com
Version Intensity
- 0 - 2: Hanya probe ringan, cepat tapi bisa melewatkan banyak layanan
- 3 - 5: Keseimbangan (default 7 sebenarnya sudah agresif)
- 7 (default): Cukup agresif untuk sebagian besar kebutuhan
- 9: Semua probe termasuk yang jarang, sangat akurat tapi lambat
Semakin tinggi intensitas, semakin banyak probe yang dikirim, dan semakin akurat hasilnya - tetapi waktu scan meningkat secara signifikan.
# Contoh perbandingan
nmap -sV --version-intensity 0 10.0.0.1 # ~10 detik
nmap -sV --version-intensity 9 10.0.0.1 # ~60 detik
OS Fingerprinting dengan Nmap -O
OS fingerprinting menggunakan analisis respons TCP/IP untuk menebak sistem operasi target. Nmap menganalisis karakteristik seperti initial TTL, window size, DF flag, TCP option, dan sequencing.
# OS detection saja
nmap -O target.com
# Gabung dengan version detection
nmap -sV -O target.com
# Gabung dengan port scan
nmap -sS -sV -O target.com
# Aggressive mode - semua fitur sekaligus
nmap -A target.com
Opsi -A (Aggressive) menggabungkan:
- OS detection (-O)
- Version detection (-sV)
- Script scanning (-sC)
- Traceroute (--traceroute)
Limitasi OS Detection
# Tebakan OS dengan akurasi lebih tinggi
nmap -O --osscan-guess target.com
# Maksimal percobaan OS detection
nmap -O --max-os-tries 3 target.com
Catatan: OS fingerprinting tidak selalu akurat. Firewall, load balancer, dan proxy bisa mengaburkan sinyal OS. Hasil persentase kepercayaan (confidence %) harus dipertimbangkan.
Banner Grabbing
Banner grabbing adalah teknik mengambil teks identifikasi yang dikirim oleh layanan jaringan saat koneksi pertama dibuka.
Banner Grabbing Manual (Netcat)
# Koneksi langsung ke port 80 (HTTP)
nc -v target.com 80
HEAD / HTTP/1.0
# Banner FTP
nc -v target.com 21
# Banner SMTP
nc -v target.com 25
# Banner SSH
nc -v target.com 22
Banner Grabbing dengan Telnet
telnet target.com 80
HEAD / HTTP/1.1
Host: target.com
Banner Grabbing dengan Nmap
# Script banner default
nmap --script banner target.com
# Hanya port tertentu
nmap --script banner -p 21,22,25,80,443 target.com
Banner Grabbing dengan Curl (HTTP/HTTPS)
curl -I http://target.com # Headers HTTP
curl -I https://target.com # Headers HTTPS
curl -s http://target.com | head -20 # Body respons awal
Enumerasi Layanan Spesifik
Setiap layanan memiliki teknik enumerasi yang berbeda. Berikut adalah layanan kritis yang paling sering ditargetkan.
1. FTP (Port 21)
FTP adalah salah satu layanan paling rentan - kredensial sering dikirim plaintext, anonymous login masih umum.
# Nmap script untuk FTP
nmap --script ftp-anon target.com # Cek anonymous login
nmap --script ftp-brute target.com # Brute force kredensial
nmap --script ftp-vsftpd-backdoor target.com # Cek backdoor vsftpd 2.3.4
nmap --script ftp-syst target.com # Dapatkan system info via SYST
# Banner langsung
nc -nv target.com 21
# Login anonymous via ftp CLI
ftp target.com
> anonymous
> anonymous
> ls -la
FTP yang terdeteksi sebagai vsftpd 2.3.4 adalah critical finding - versi ini memiliki backdoor yang memberikan root shell langsung.
2. SSH (Port 22)
# Enumerasi versi SSH
nmap --script ssh-hostkey target.com # Dapatkan host key fingerprint
nmap --script ssh-auth-methods target.com # Enumerasi metode autentikasi
nmap --script ssh2-enum-algos target.com # Enumerasi algoritma yang didukung
# Banner
nc -nv target.com 22
# Versi langsung dengan ssh client
Informasi dari SSH enumeration:
- Versi server (OpenSSH_8.9p1 Ubuntu 3)
- Algoritma enkripsi yang didukung (berguna untuk puzzle kriptografi)
- Metode autentikasi (password, publickey, keyboard-interactive)
- Host key fingerprint (untuk tracking)
3. HTTP/HTTPS (Port 80/443/8080)
# Enumerasi HTTP dasar
nmap --script http-headers target.com # Headers HTTP
nmap --script http-title target.com # Judul halaman
nmap --script http-server-header target.com # Server header
nmap --script http-methods target.com # Metode HTTP yang diizinkan
nmap --script http-enum target.com # Enumerasi direktori umum
nmap --script http-robots.txt target.com # Isi robots.txt
nmap --script http-webdav-scan target.com # WebDAV scan
# Dengan curl
curl -s -I http://target.com # Headers
curl -s http://target.com/robots.txt # Robots.txt
curl -s -X OPTIONS http://target.com -i # Metode HTTP yang diizinkan
# Whatweb - fingerprinting teknologi web
whatweb target.com
# Contoh output: Apache/2.4.49, PHP/8.0.25, WordPress/6.2, jQuery 3.6.0
Yang perlu diperhatikan dalam HTTP enumeration:
- Server header: Apache 2.4.49 → rentan terhadap path traversal (CVE-2021-41773)
- X-Powered-By: PHP/8.0.25 → cari CVE PHP
- Metode HTTP: PUT/TRACE/DELETE yang aktif bisa berbahaya
- Direktori sensitif: /admin, /backup, /.git, /wp-admin
4. SMTP (Port 25/465/587)
# Enumerasi SMTP dasar
nmap --script smtp-commands target.com # Perintah SMTP yang didukung
nmap --script smtp-enum-users target.com # Enumerasi user (VRFY, EXPN, RCPT TO)
nmap --script smtp-ntlm-info target.com # Info NTLM Windows
# Manual SMTP enumeration
nc -nv target.com 25
EHLO tester.com
VRFY root
VRFX admin
EXPN postmaster
RCPT TO: [email protected]
SMTP enumeration bisa mengungkap:
- User accounts yang valid (vrfy, expn, rcpt to)
- Versi MTA (Postfix, Exim, Sendmail, Exchange)
- Open relay (siapa pun bisa mengirim email melalui server)
5. SMB/NetBIOS (Port 139/445)
Windows file sharing service - sumber informasi yang sangat kaya.
# Enumerasi SMB
nmap --script smb-os-discovery target.com # Deteksi OS Windows
nmap --script smb-enum-shares target.com # Share folders
nmap --script smb-enum-users target.com # User accounts
nmap --script smb-security-mode target.com # Security policy
nmap --script smb2-capabilities target.com # SMB2 capabilities
nmap --script smb-protocols target.com # Protokol SMB yang didukung
# Dengan smbclient (Linux)
smbclient -L //target.com -N # List shares anonymous
smbclient //target.com/share -N # Connect ke share
# Dengan enum4linux (Linux)
enum4linux -a target.com
Informasi kunci dari SMB enumeration:
- Nama host NetBIOS, domain, OS version
- Share yang bisa diakses (sering ada share dengan akses publik)
- User accounts dan group
- Null session - koneksi tanpa autentikasi yang memberi akses tidak seharusnya
- SMB signing - jika disabled, memungkinkan relay attack (NTLM relay)
6. DNS (Port 53)
# Enumerasi DNS
nmap --script dns-brute target.com # Subdomain brute force
nmap --script dns-zone-transfer target.com # Zone transfer (AXFR)
nmap --script dns-nsid target.com # Name server ID
# Dengan dig
dig axfr @target.com target.com # Zone transfer
dig any @target.com target.com # Semua record
dig @8.8.8.8 target.com MX # MX records via Google DNS
# Dengan dnsrecon
dnsrecon -d target.com -t axfr # Zone transfer
dnsrecon -d target.com -t brt # Brute force subdomain
dnsrecon -d target.com -t std # Standard query
Zone transfer (AXFR) yang berhasil adalah critical finding - attacker mendapatkan seluruh peta DNS domain target.
7. MySQL/MariaDB (Port 3306)
nmap --script mysql-empty-password target.com # Cek password kosong
nmap --script mysql-enum target.com # Enumerasi user database
nmap --script mysql-variables target.com # Konfigurasi MySQL
nmap --script mysql-databases target.com # Database list (butuh kredensial)
nmap --script mysql-audit target.com # Audit keamanan MySQL
8. RDP (Port 3389)
nmap --script rdp-enum-encryption target.com # Enkripsi RDP
nmap --script rdp-vuln-ms12-020 target.com # CVE-2012-0002 (RCE via RDP)
nmap --script rdp-ntlm-info target.com # Info NTLM Windows
Menggabungkan Hasil Service Enumeration
Setelah service enumeration, buatlah tabel ringkasan seperti berikut:
| Port | Layanan | Versi | OS | Catatan |
|---|---|---|---|---|
| 22/tcp | SSH | OpenSSH 7.6p1 Ubuntu | Linux (Ubuntu 18.04) | Auth: password only |
| 80/tcp | HTTP | Apache 2.4.29 | Ubuntu | Server info bocor |
| 3306/tcp | MySQL | 8.0.28 | - | Root without password |
| 445/tcp | SMB | - | Windows Server 2022 | SMB signing disabled |
Tools Alternatif
Amap
# Amap - next-gen service detection
amap -A target.com 80
amap -b target.com 80 # Banner grabbing
Netcat (Pendekatan Manual)
#!/bin/bash
# Script banner grabbing sederhana
for port in 21 22 25 80 110 143 443 993 995; do
timeout 2 bash -c "echo >/dev/tcp/$1/$port" 2>/dev/null && \
echo "[+] Port $port terbuka - \$(timeout 2 bash -c 'exec 3<>/dev/tcp/'$1'/'$port'; read -t 2 <&3; echo "$REPLY"' 2>/dev/null)"
done
RustScan
# RustScan - cepat dengan pipe ke Nmap
rustscan -a target.com -- -sV -O
# RustScan: scanning 65535 ports dalam ~3 detik
# Lalu pipe ke Nmap untuk version+OS detection
Checklist Service Enumeration
- Version detection (-sV) pada semua port terbuka
- OS fingerprinting (-O) untuk identifikasi platform
- Banner grabbing manual (nc/telnet) pada port non-standar
- Enumerasi HTTP (head, metode, direktori, teknologi web)
- Enumerasi FTP (anonymous, versi)
- Enumerasi SMTP (VRFY, EXPN, open relay)
- Enumerasi SMB (shares, users, null session, signing)
- Enumerasi DNS (zone transfer, subdomain)
- Enumerasi database (MySQL, MSSQL, Redis, MongoDB)
- Dokumentasi semua versi layanan dan hasil OS detection
Referensi
- Nmap -sV Documentation: https://nmap.org/book/man-version-detection.html
- Netcat Manual: man nc
- enum4linux: https://github.com/CiscoCXSecurity/enum4linux
- Whatweb: https://github.com/urbanadventurer/WhatWeb
- RustScan: https://github.com/RustScan/RustScan