# Metasploit BeEF Bind Payloads

Note: the paths specified below relate to the Metasploit installation directory
on Kali Linux. The paths may differ on your system.

## Install Handler

Installing BeEF Bind payloads requires also installing a custom handler into framework:

```sh
sudo cp beef_bind-handler.rb /usr/share/metasploit-framework/lib/msf/core/handler/beef_bind.rb
```

## Install Payloads

Payloads can be installed into the Metasploit Framework installation directory
(for all users) or user's home directory `~/.msf4/modules/payloads/...`.

```sh
cp beef_bind-stage-windows-x86.rb /usr/share/metasploit-framework/modules/payloads/stages/windows/beef_shell.rb
cp beef_bind-stager-windows-x86.rb /usr/share/metasploit-framework/modules/payloads/stagers/windows/beef_bind.rb

cp beef_bind-stage-linux-x86.rb /usr/share/metasploit-framework/modules/payloads/stages/linux/x86/beef_shell.rb
cp beef_bind-stager-linux-x86.rb /usr/share/metasploit-framework/modules/payloads/stagers/linux/x86/beef_bind.rb

cp beef_bind-stage-linux-x64.rb /usr/share/metasploit-framework/modules/payloads/stages/linux/x64/beef_shell.rb
cp beef_bind-stager-linux-x64.rb /usr/share/metasploit-framework/modules/payloads/stagers/linux/x64/beef_bind.rb
```

## Generating Payloads

Check it works:

```sh
msfvenom -l payloads | grep beef_bind
```

Dump stager and stage in C format:

```sh
msfvenom -p windows/beef_shell/beef_bind --format C
```

Dump stager in raw format:

```sh
msfvenom -p windows/beef_shell/beef_bind R > beef_bind-stager
```

Encode stager to remove nulls:

```sh
msfvenom -p windows/beef_shell/beef_bind R --bad-chars '\x00' > beef_bind-stager-nonull
```

