Skip to content

Commit 5f4ab3d

Browse files
committed
The setres* stubs are not implemented in OSX.
1 parent 0d19b5d commit 5f4ab3d

File tree

1 file changed

+0
-44
lines changed

1 file changed

+0
-44
lines changed

lib/msf/core/payload/osx.rb

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ def initialize(info = {})
1919

2020
register_advanced_options(
2121
[
22-
Msf::OptBool.new('PrependSetresuid',
23-
[
24-
false,
25-
"Prepend a stub that executes the setresuid(0, 0, 0) system call",
26-
false
27-
]
28-
),
2922
Msf::OptBool.new('PrependSetreuid',
3023
[
3124
false,
@@ -40,13 +33,6 @@ def initialize(info = {})
4033
false
4134
]
4235
),
43-
Msf::OptBool.new('PrependSetresgid',
44-
[
45-
false,
46-
"Prepend a stub that executes the setresgid(0, 0, 0) system call",
47-
false
48-
]
49-
),
5036
Msf::OptBool.new('PrependSetregid',
5137
[
5238
false,
@@ -89,16 +75,6 @@ def apply_prepends(buf)
8975
end
9076

9177
def handle_x86_osx_opts(pre, app)
92-
if (datastore['PrependSetresuid'])
93-
# setresuid(0, 0, 0)
94-
pre << "\x31\xc0" +# xorl %eax,%eax #
95-
"\x50" +# pushl %eax #
96-
"\x50" +# pushl %eax #
97-
"\x50" +# pushl %eax #
98-
"\x50" +# pushl %eax #
99-
"\x66\xb8\x37\x01" +# movw $0x0137,%ax #
100-
"\xcd\x80" # int $0x80 #
101-
end
10278

10379
if (datastore['PrependSetreuid'])
10480
# setreuid(0, 0)
@@ -119,17 +95,6 @@ def handle_x86_osx_opts(pre, app)
11995
"\xcd\x80" # int $0x80 #
12096
end
12197

122-
if (datastore['PrependSetresgid'])
123-
# setresgid(0, 0, 0)
124-
pre << "\x31\xc0" +# xorl %eax,%eax #
125-
"\x50" +# pushl %eax #
126-
"\x50" +# pushl %eax #
127-
"\x50" +# pushl %eax #
128-
"\x50" +# pushl %eax #
129-
"\x66\xb8\x38\x01" +# movw $0x0138,%ax #
130-
"\xcd\x80" # int $0x80 #
131-
end
132-
13398
if (datastore['PrependSetregid'])
13499
# setregid(0, 0)
135100
pre << "\x31\xc0" +# xorl %eax,%eax #
@@ -159,10 +124,6 @@ def handle_x86_osx_opts(pre, app)
159124
end
160125

161126
def handle_x64_osx_opts(pre, app)
162-
if (datastore['PrependSetresuid'])
163-
# setresuid(0, 0, 0)
164-
raise RuntimeError, "setresuid syscall is not implemented on x64 OSX systems"
165-
end
166127

167128
if (datastore['PrependSetreuid'])
168129
# setreuid(0, 0)
@@ -185,11 +146,6 @@ def handle_x64_osx_opts(pre, app)
185146
"\x0f\x05" # syscall
186147
end
187148

188-
if (datastore['PrependSetresgid'])
189-
# setresgid(0, 0, 0)
190-
raise RuntimeError, "setresgid syscall is not implemented on x64 OSX systems"
191-
end
192-
193149
if (datastore['PrependSetregid'])
194150
# setregid(0, 0)
195151
pre << "\x41\xb0\x02" +# mov r8b, 0x2 (Set syscall_class to UNIX=2<<24)

0 commit comments

Comments
 (0)