Bootcamp
Metasploit

Metasploit
Metasploit is an open-source penetration testing framework that helps security professionals find and exploit vulnerabilities in computer systems. It includes a database of known vulnerabilities and tools and scripts for exploiting them.
Metasploit Modules
- Auxiliary : scanners, crawlers and fuzzers, can be found here.
- Encoders: encode the exploit and payload
- Evasion: try to evade antivirus while encoder work
- Exploits: contain exploits for each target system.
- NOPs: often used as a buffer to achieve consistent payload sizes.
- Payloads: codes that will run on the target system.
- Post: on the final stage of listed above, post-exploitation.
Scanning
- Port Scanning: Potential port scanning modules available using
search portscan
- UDP service Identification: The scanner/discovery/udp_sweep module will allow you to quickly identify services running over the UDP
- SMB Scans: Metasploit offers several useful auxiliary modules that allow us to scan specific services. Below is an example for the SMB. Especially useful in a corporate network would be smb_enumshares and smb_version.
## Metasploit Database
Metasploit has a database function to simplify project management and avoid possible confusion when setting up parameter values.
## Meterpreter
Metasploit attack payload that provides an interactive shell from which an attacker can explore the target machine and execute code. It is typically deployed using in-memory DLL injection to reside entirely in memory.
- Meterpreter runs on the target system but is not installed on it.
- Runs in memory and does not write itself to the disk on the target.
- In-Memory Execution: By running entirely in memory, Meterpreter can execute its commands without ever being written to the disk.
## Metasploit Payloads: Inline vs. Staged
- Metasploit, a popular penetration testing framework, offers two primary types of payloads: inline and staged.
- These payloads are essential components in exploiting vulnerabilities and gaining access to target systems.
### Inline Payloads
- Inline payloads are single-stage payloads that are directly embedded within the exploit code.
- This means that the entire payload is transmitted to the target system in a single transmission.
- While inline payloads are generally simpler to use and can be more stealthy, they can be larger in size, which may limit their effectiveness in certain scenarios.
### Staged Payloads
Staged payloads, on the other hand, are divided into two stages.
- The first stage is a small, lightweight payload that is sent to the target system initially. This first stage establishes a communication channel with the attacker's system. Once the channel is established, the attacker can send the second stage payload, which contains the actual malicious code, to the target system.
- This staged (second stage) approach can be advantageous in situations where the initial payload needs to be small to bypass firewalls or intrusion detection systems.
Key Differences:
- Size: Inline payloads are typically larger than staged payloads, as they contain the entire malicious code within a single transmission.
- Stealth: Inline payloads can be more stealthy, as they don't require a second-stage transmission. However, staged payloads can be more effective at bypassing certain security measures.
- Flexibility: Staged payloads offer more flexibility, as the second stage can be customized to suit different target environments.
### Choosing the Right Payload:
#### The choice between inline and staged payloads depends on several factors Including :
- Target system configuration: The target system's network environment and security measures can influence the choice of payload.
- Payload size: If payload size is a concern, staged payloads may be more suitable.
- Stealth: If stealth is a priority, inline payloads may be a better option.
Source file in my repo: Week 2/Metasploit.md