Skip to content

Commit afdaf4f

Browse files
authored
Merge pull request #20514 from dledda-r7/fix/remove-unhook-autoload
Removing unhook extension autoload
2 parents 80c5e41 + 4ede319 commit afdaf4f

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

lib/msf/base/sessions/meterpreter.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ def bootstrap(datastore = {}, handler = nil)
184184

185185
# BEGIN: This should be removed on MSF 7
186186
# Unhook the process prior to loading stdapi to reduce logging/inspection by any AV/PSP (by default unhook is first, see meterpreter_options/windows.rb)
187-
extensions.push('unhook') if datastore['AutoUnhookProcess'] && session.platform == 'windows'
187+
# The unhook extension is broken. reference: https://github.com/rapid7/metasploit-framework/pull/20514
188+
189+
#extensions.push('unhook') if datastore['AutoUnhookProcess'] && session.platform == 'windows'
188190
extensions.push('stdapi') if datastore['AutoLoadStdapi']
189191
extensions.push('priv') if datastore['AutoLoadStdapi'] && session.platform == 'windows'
190192
extensions.push('android') if session.platform == 'android'
@@ -197,7 +199,7 @@ def bootstrap(datastore = {}, handler = nil)
197199
extensions.each do |extension|
198200
begin
199201
console.run_single("load #{extension}")
200-
console.run_single('unhook_pe') if extension == 'unhook'
202+
# console.run_single('unhook_pe') if extension == 'unhook'
201203
session.load_session_info if extension == 'stdapi' && datastore['AutoSystemInfo']
202204
rescue => e
203205
print_warning("Failed loading extension #{extension}")

lib/msf/base/sessions/meterpreter_options/windows.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,8 @@ def initialize(info = {})
1616
[
1717
OptString.new(
1818
'AutoLoadExtensions',
19-
[true, "Automatically load extensions on bootstrap, comma separated.", 'unhook,priv,stdapi']
20-
),
21-
OptBool.new(
22-
'AutoUnhookProcess',
23-
[true, "Automatically load the unhook extension and unhook the process", false]
24-
),
19+
[true, "Automatically load extensions on bootstrap, comma separated.", 'priv,stdapi']
20+
)
2521
],
2622
self.class
2723
)

0 commit comments

Comments
 (0)