BFG can be executed from a docker container as well. A
compose.yml
file is present to simplify building and
running it as individual commands.
- Docker
- Docker Compose (Pre-packaged with Docker for Mac/Windows)
- Create a directory to contain the attack's configuration
file and output artifacts, e.g.
mkdir bfg_output
. - Create a YAML configuration file named
brute.yml
in that directory. Below is a working example that you can execute without attacking a target.
database: brute.db
brute-force:
# =====================
# ATTACK CONFIGURATIONS
# =====================
log-file: brute.log
stop-on-valid: false
parallel-guess-count: 4
auth-threshold: 2
log-level: valid-credentials
auth-jitter-min: 1s
auth-jitter-max: 6s
threshold-jitter-min: 3s
threshold-jitter-max: 8s
module:
name: testing.fake
args:
username: [email protected]
password: password2
manage-db:
# =====================
# DATABASE INPUT VALUES
# =====================
import-spray-values:
usernames:
- [email protected]
- [email protected]
- [email protected]
passwords:
- password1
- password2
- password3
- password4
- password5
- Set the environment variable to point to the directory containing the new YAML file.
Warning: Use an absolute path for this variable.
cmd.exe
set OUTPUT_DIRECTORY=bfg_output
PowerShell
$env:OUTPUT_DIRECTORY=bfg_output
Bash
export OUTPUT_DIRECTORY=bfg_output
- Enter the
docker
directory at the root of thebl-bfg
repository and run the following command. Note that output will be written to thebfg_output
directory.
docker-compose run --rm bfg
The entrypoint can be overridden to access the CLI and get help output.
OUTPUT_DIRECTORY=junk docker-compose run --rm --entrypoint bfg bfg --help
Try this command ff an attack module listing is desired:
OUTPUT_DIRECTORY=junk docker-compose run --rm --entrypoint bfg bfg cli brute-force --help
The current default is to execute from a YAML file.
Override the entrypoint if CLI is preferred. This value
should produce the desired behavior: bfg cli
BFG commands are executed in /bfg/
, the container's
WORKDIR
. Configuration values within the YAML file
can be supplied as relative paths. Below would be a
valid configuration for input files.
database: brute.db
brute-force:
log-file: brute.log
The following table outlines environment variables used to configured the container's execution environment.
Variable | Default | Use |
---|---|---|
YAML_FILE |
brute.yml |
Indicates the name of the YAML file used to execute BFG. |
OUTPUT_DIRECTORY |
null |
A value must be supplied to this environment variable. It mounts the target host directory to /bfg/ within the container, allowing for attack artifacts to be persisted to disk. |