Skip to content

Choose a Module Type and Location

First decide the module type and where to put it. The entry method and required options depend on the type you choose.

  1. Will it open a new session (shell / Meterpreter)?
  2. Does it assume a session already exists?
  3. Will it connect remotely or run in an existing session?
Does the task already have a session?
YES → post
(except local privilege escalation that returns another session: exploit/*/local)
NO → Will it execute a payload to open a session?
YES → exploit
NO → auxiliary
ResultMeaningExample location
exploitDeliver a payload and open a session~/.msf4/modules/exploits/<platform>/<proto>/name.rb
auxiliaryEnumeration, login, administration, DoS, etc.; does not open a session~/.msf4/modules/auxiliary/<category>/<proto>/name.rb
postEnumeration, administration, or collection through an existing session~/.msf4/modules/post/<platform>/<category>/name.rb
ScenarioType to chooseReason
Return a Meterpreter session through a web RCEexploitThe goal is a payload session
Log in to a web app and save settings as lootauxiliaryDoes not open a session
Grab banners across a range on 22/tcpauxiliary (scanner)Scans multiple hosts
Run id once over SSH and finishauxiliary is possible; use exploit if you want a persistent shellDepends on whether there is a payload
Read /etc/passwd from a shell you already havepostExisting session
Use local privilege escalation from Meterpreter to get a new root sessionexploit (local)New session = exploit
Upgrade a shell to MeterpreterUse an existing post module or write a post moduleConverts an existing session
Listen with a handlerUse the existing exploit/multi/handlerNo need to write one

Separate by protocol and purpose.

exploits/linux/http/myapp_rce.rb
exploits/windows/smb/my_vuln.rb
exploits/linux/local/my_priv_esc.rb
auxiliary/scanner/http/myapp_version.rb
auxiliary/gather/myapp_config.rb
auxiliary/admin/myapp_add_user.rb
post/linux/gather/myapp_tokens.rb
post/windows/manage/myapp_migrate.rb

File names are usually lowercase with underscores. In msfconsole, the path appears as a command such as use exploit/linux/http/myapp_rce.

  • The module type is chosen.
  • The destination file path is chosen.
  • You can say whether the entry method is exploit, run, or run_host.

Next, Base Class and Mixins helps you choose a class and communication method for that type.