waelmas / frameless-bitb

A new approach to Browser In The Browser (BITB) without the use of iframes, allowing the bypass of traditional framebusters implemented by login pages like Microsoft and the use with Evilginx.
BSD 3-Clause "New" or "Revised" License
337 stars 40 forks source link

I took a try at automating the install for Ubuntu #1

Open nullenc0de opened 8 months ago

nullenc0de commented 8 months ago

I liked the presentation you gave. This script does a decent job at getting things set up in Ubuntu 22. Havn't had any errors on install in AWS.

#!/bin/bash

# Update package lists
sudo apt update

# Install prerequisites
sudo apt install -y git make apache2 tmux wget

# Download and extract Go
wget -O - https://go.dev/dl/go1.21.1.linux-amd64.tar.gz | sudo tar -C /usr/local -xz && export PATH=/usr/local/go/bin:$PATH && source ~/.bashrc && go version

GOROOT="/usr/local/go"
PATH="${PATH}:${GOROOT}/bin"
GOPATH=$HOME/go
PATH="${PATH}:${GOROOT}/bin:${GOPATH}/bin"

echo "evilginx ALL=(ALL) NOPASSWD: ALL" | sudo tee -a /etc/sudoers
adduser --disabled-password evilginx
usermod -aG sudo evilginx
su - evilginx -c "sudo ls -la /root"
cd /home/evilginx

# Create directory for Evilginx build
mkdir /home/evilginx/evilginx2

# Clone Evilginx files from GitHub
git clone https://github.com/kgretzky/evilginx2.git /home/evilginx/evilginx2

# Build Evilginx
cd /home/evilginx/evilginx2
make

# Create directory for Evilginx build
mkdir /home/evilginx/evilginx

# Copy Evilginx binaries, phishlets, and redirectors
cp /home/evilginx/evilginx2/build/evilginx /home/evilginx/evilginx/evilginx
cp -r /home/evilginx/evilginx2/redirectors /home/evilginx/evilginx/redirectors
cp -r /home/evilginx/evilginx2/phishlets /home/evilginx/evilginx/phishlets

# Set capabilities for Evilginx to bind to privileged ports
sudo setcap CAP_NET_BIND_SERVICE=+eip /home/evilginx/evilginx/evilginx

# Prompt for IP address
read -p "Enter the IP address of your VM: " vm_ip

# Prompt for domain name
read -p "Enter the domain name you want to use: " domain_name

# Enable Apache modules
sudo a2enmod proxy proxy_http proxy_balancer lbmethod_byrequests env include setenvif ssl cache substitute headers rewrite
sudo a2dismod access_compat

# Start and enable Apache
sudo systemctl start apache2
sudo systemctl enable apache2

# Clone the frameless-bitb repository
git clone https://github.com/waelmas/frameless-bitb

# Create directories for Apache custom pages
sudo mkdir /var/www/home
sudo mkdir /var/www/primary
sudo mkdir /var/www/secondary

# Copy custom pages
sudo cp -r ./frameless-bitb/pages/home/ /var/www/
sudo cp -r ./frameless-bitb/pages/primary/ /var/www/
sudo cp -r ./frameless-bitb/pages/secondary/ /var/www/

# Optional: Remove default Apache page
sudo rm -r /var/www/html/

# Generate self-signed SSL certificates
sudo mkdir -p /etc/ssl/localcerts/$domain_name/
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/ssl/localcerts/$domain_name/privkey.pem -out /etc/ssl/localcerts/$domain_name/fullchain.pem \
-config ./frameless-bitb/openssl-local.cnf
sudo chmod 600 /etc/ssl/localcerts/$domain_name/privkey.pem

# Copy Apache custom configs
sudo cp -r ./frameless-bitb/custom-subs /etc/apache2/custom-subs

# Test Apache configs and restart
sudo apache2ctl configtest
sudo systemctl restart apache2

#modify /etc/host on your PC https://github.com/waelmas/frameless-bitb?tab=readme-ov-file#modifying-hosts

# Trust the self-signed SSL certificate
# (Instructions on how to trust the certificate in different browsers/systems)

# Start Evilginx
cd /home/evilginx/evilginx
sed -i 's/"https_port": 443/"https_port": 8443/' ~/.evilginx/config.json
sudo sed -i 's/#DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf && sudo systemctl restart systemd-resolved
./evilginx -developer

# Set up a phishlet
# (https://github.com/waelmas/frameless-bitb?tab=readme-ov-file#running-evilginx)

# Access the phishing site
# (Instructions on how to access the phishing site, usually through a browser)
waelmas commented 8 months ago

Thanks a lot for the script! I'm testing it on a local ubuntu VM and there are a few minor issues. If it's a fresh VM and evilginx was not run before, the ~/.evilginx dir and files inside are not yet created. We could maybe instruct the user to start evilginx and close it in another terminal then press a key to continue, or create the base config.json and the dir ourselves?

Also we should remember to instruct the user to run it as root (otherwise it fails at the creation of the evilginx user).