Metasploit
ABOUT
The Metasploit Project
is a Ruby-based, modular penetration testing platform that enables you to write, test, and execute the exploit code. This exploit code can be custom-made by the user or taken from a database containing the latest already discovered and modularized exploits. The Metasploit Framework
includes a suite of tools that you can use to test security vulnerabilities, enumerate networks, execute attacks, and evade detection. At its core, the Metasploit Project
is a collection of commonly used tools that provide a complete environment for penetration testing and exploit development. Files usually located at /usr/share/metasploit-framework
.
What is MS Module? A module is a piece of software that the Metasploit Framework uses to perform a task, such as exploiting or scanning a target. A module can be an exploit module, auxiliary module, or post-exploitation module.
ARCHITECTURE
Auxiliary - Any supporting module, such as scanners, crawlers and fuzzers.
Encoders - Will allow you to encode the exploit and payload in the hope that a signature-based antivirus solution may miss them.
Evasion - While encoders will encode the payload, they should not be considered a direct attempt to evade antivirus software. On the other hand, “evasion” modules will try that, with more or less success.
Exploits - Exploits, neatly organized by target system.
NOPs -
(No Operation code)
Keep the payload sizes consistent across exploit attempts.Payloads - Payloads are codes that will run on the target system.
Post - Post modules would be useful in post-exploitation.
MSFVENOM
Msfvenom is a tool that is part of the Metasploit framework and it is a command line tool for generating different types of payloads for exploiting. In addition to providing a payload with flexible delivery options, MSFvenom also allows us to encrypt & encode
payloads to bypass common anti-virus detection signatures.
List Payloads
Building a Stageless Payload for Linux
Building a Stageless Payload for Windows
Staged vs Stageless Payloads
Staged
payloads create a way for us to send over more components of our attack. So if more simply, the whole payload has few stages, first to get connection and others to load additional programs
Stageless
payloads do not have a stage. So all payload and programs are loaded at first time.
METERPRETER
The Meterpreter
payload is a specific type of multi-faceted payload that uses DLL injection
to ensure the connection to the victim host is stable, hard to detect by simple checks, and persistent across reboots or system changes. Meterpreter resides completely in the memory of the remote host and leaves no traces on the hard drive, making it very difficult to detect with conventional forensic techniques.
Encoder
Generating Payload - With Encoding
List Encoders
MSF - VirusTotal
Sessions
Listing Active Sessions
Interacting with a Session
Getting shell
Background session
Killing session
Listing Running Jobs
Run an Exploit as a Background Job
MAKING PROXY
PIVOTING
Autoroute
Autoroute is used in penetration testing to enable network pivoting, allowing attackers to route traffic through a compromised host to access internal subnets that are not directly reachable. This facilitates reconnaissance, exploitation, and lateral movement within isolated or segmented networks.
Local Port-Forwarding
Remote Port-Forwarding
USEFUL MSFCONSOLE COMMANDS
Specific Search
Get more info about module
Permanent Target Specification
Show and Set Target for exploit
Searching for Specific Payload
Use Local Exploit Suggester
Ping Sweep
LIFEHACKS
Use wget -o parameter when you want to install revshell file into machine like:
Last updated