Skip to content

Docker Setup

bcoles edited this page Apr 1, 2023 · 2 revisions

Follow the Docker Installation Guide setup instructions to install Docker.

Running BeEF through Docker alleviates any host setup pains, making the installation process as simple as executing a few commands.

Setting Your Credentials

It is essential that you set your credentials before building your Docker image. BeEF by default has it's credentials set to beef:beef, but does not allow authentication with default credentials. Consequently if you build an image without changing the credentials you will not be able to authenticate your container's BeEF instance.

With your preferred text editor open the config.yaml file found in the BeEF root folder:

  ...SNIP...
    credentials:
      user: '<YOUR_USERNAME>'
      passwd: '<YOUR_PASSWORD>'
  ...SNIP...

Building Your Image & Container

To build your image:

  $ docker build -t beef .

To run your container:

  # If you'd prefer the container to run backgrounded/detached just add the -d tag to the command below
  $ docker run -p 3000:3000 -p 6789:6789 -p 61985:61985 -p 61986:61986 --name beef beef

To run your container without executing the normal start-up, and instead spawn a shell on the box:

  $ docker run -p 3000:3000 -p 6789:6789 -p 61985:61985 -p 61986:61986 --name beef --entrypoint=/bin/bash -it beef

To get a shell on the container:

  $ docker exec -it beef /bin/bash # You can replace /bin/bash to run an arbitrary command

To stop your container:

  $ docker stop beef

To start it again after having stopped it:

  $ docker start beef

Troubleshooting

If you run into this error:

  You must use Bundler 2 or greater with this lockfile.
  The command '/bin/sh -c apk add --no-cache git curl libcurl curl-dev ruby-dev libffi-dev make g++ gcc musl-dev zlib-dev sqlite-dev &&   bundle install --system --clean --no-cache \
  --gemfile=/beef/Gemfile $BUNDLER_ARGS &&   rm -rf /usr/local/bundle/cache' returned a non-zero code: 20

Delete the Gemfile.lock from your BeEF directory and try again.

Connecting to BeEF

The IP address the Docker container runs on may vary from machine to machine. The easiest way to check is to run:

  $ docker exec -it beef ifconfig eth0

Here you will need to look for the IP address beside inet. For example, the address I would need to navigate to in the example below is 172.17.0.2:

  eth0    inet addr:172.17.0.2  Bcast:172.17.255.255  Mask:255.255.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4466 (4.3 KiB)  TX bytes:1770 (1.7 KiB)

Once you've identified your containers IP address navigate to http://IP_ADDRESS:3000/ui/authentication

Updating Your Image

Every time you pull down the latest source code (git pull origin master), or update using /beef/update-beef you will need to rebuild your image as described above.

Clone this wiki locally