Exploit the WinRAR - CVE-2023-38831
Last updated
Last updated
Use what I'm about to say in this article only for the right purposes, such as raising security awareness and improving the security posture of your environments. I do not accept any responsibility for other uses.
CVE-2023-38831 is a file extension spoofing vulnerability in RARLabs WinRAR. By exploiting this vulnerability, attackers can create a RAR or ZIP archive containing a harmless file and embed malicious code in a folder with the same name. If the user opens the archive to view the harmless file, the malicious code is executed.
This vulnerability was used to distribute malware in the wild from April to August 2023. The target audience of the attacks were typically individuals with access to information about financial markets. Attackers tricked victims into opening malicious archives by sending them via email or sharing them on websites or social media platforms.
Let's Exploit WinRAR
Requirements
WinRAR version 6.22 or earlier.
Victim Machine
Attacker Machine
Powercat(optionally)
Let's download our exploit tool via Git or the interface.
First, check the WinRAR Version if it is vulnerable version or not.
Let's open the "script.bat" file with a text editor among the files we downloaded.
Then start a NetCat listener in attacker host and run the "cve-2023-38831-exp-gen.py" file in the tool we downloaded with the relevant parameters as follows.
After we run it, we see that a file called poc.rar has been created. This file is a PDF containing our malicious code. Let's run the PDF and see what happens.
When we check our attacker host, we see that we've obtained reverse shell.
How can we defend ourselves against this vulnerability?
Use the latest version of WinRAR. WinRAR has released a security patch that addresses CVE-2023-38831. To install the patch, open WinRAR and select "Updates" from the "File" menu.
Only open files from trusted sources. To reduce your risk of being exposed to an attack that uses CVE-2023-38831, only open files from sources you trust.
Check the contents of files before opening them. To further reduce your risk of being exposed to an attack that uses CVE-2023-38831, check the contents of the file before opening it. This will help you ensure that the file does not contain a virus or malware.
Winrar Exploit Tool()
This bat file is the file containing the malicious code that the vulnerable .rar file will run. Let's put our command for revershell inside.