
Generates a malicious RAR archive exploiting CVE-2023-38831 to deliver a reverse shell via a crafted PDF, for ethical testing in controlled environments.
In this case, I share the necessary files to exploit this vulnerability in WinRAR, with which we can create a malicious PDF to establish a reverse shell to our attacker machine.
⚠️ NOTE: This content is shared for ethical purposes and is created to practice in controlled environments without harming third parties; at no time is an apology made for the use of these resources for malicious purposes.
First, we will download the content of the repository.
Let's start preparing all the resources so that the exploitation works correctly.
We have these 3 files:
1st STEP: The first thing we have to do is edit the script.bat, in which we will replace the {ip} field with our Attacker IP and the {port} field with our listening port to receive the reverse shell. (I recommend doing this with Visual Studio Code).
2nd STEP: We will run the Python script to generate the malicious WinRAR file. To do this, we need to open a PowerShell window in the same path where we have all the resources and execute the following command:
python cve-2023-38831-exp-gen.py document.pdf script.bat file.rar
With this, we should have generated the file.rar archive, which will contain the malicious .pdf file.
3rd STEP: Once this is done, we simply have to set up a listener on our attacker machine and double-click on the document.pdf located inside the archive, and we should have gained access to the system.