3

Doing some research about packing and such, I went on the possibility to use the old msfencode to generate a packed exe.

However, msfencode is not updated anymore (still found on kali however), and I wish to use the encoders on the x64 architecture.

By the way, I tested to use msfvenom simply to pack my executable, using the 'no payload' option as such : '-p -'. But, it just keeps asking me to supply a payload on stdin.

So, is it possible to just pack a binary using msfvenom?

1
  • 1
    The -p- isn't for empty payload. Rather it is for taking the payload from stdin (standard input). msfvenom or msfencode isn't for packaging, it is for generating and encoding payloads in different formats.
    – void_in
    Apr 20 '17 at 18:50
5

I would advise to use following command:

msfvenom -p generic/custom PAYLOADFILE=[path_to_file] -a [architecture] --platform [platform] -e [encoder]

bear in mind you can list all possible encoders with:

msfvenom --list encoders

this is an example of encoding a shellcode using add/sub encoder, which I tested working:

msfvenom -p generic/custom PAYLOADFILE=./shellcode.bin -a x86 --platform windows -e x86/add_sub -f raw -o shellcode-encoded.bin
1

To use -p -, you need to supply the shellcode on stdin by:

Syntax:

cat <shellcode_file> | msfvenom -b <bad_chars> -e <encoder> -f <format> -a <arch> --platform <platform> -p -

Example:

cat shellcode | msfvenom -b '\x00' -e x86/shikata_ga_nai -f py -a x86 --platform windows -p -

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.