-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add OpenSSH password search module for Windows #18597
Add OpenSSH password search module for Windows #18597
Conversation
) | ||
) | ||
register_options([ | ||
OptInt.new('PID', [true, 'Process ID of OpenSSH to search through', nil]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be automatically set?
e5cf39b
to
2b770a7
Compare
2b770a7
to
176e2a2
Compare
This seems to hang indefinitely for me; logs:
Eventually the Meterpreter call gets marked as timed out on msfconsole, but then the process seems to spin endlessly behind the scenes still |
After retesting, it looks like the previous bug is fixed in 2.0.164 now 👍 I ran into another issue were I psexec'd a 32 bit meterpreter, and tried to dump ssh.exe - but I wasn't able to. I think this is might just be normal windows behavior, and we might not be able to tell the user that this has happened - but it'd be good if we could do something better there. We were thinking that this functionality is pretty dope, and isn't limited to just
Maybe to remove the boilerplate: class MemorySearchModule
# or maybe platforms could be passed in instead of the `update_info` pattern :shrug:
def initialize_memory_search_module(info = {}) # /*, platforms: [] */)
# ....
register_options([
])
info
end
end
class MetasploitModule
include MemorySearchModule
def initialize(options)
super(
update_info(
initialize_memory_search_module(options) # /*, platforms: [...] */),
# ...
'Platform' => ['...'],
)
)
end
end |
This PR adds a module that can be used to extract passwords from active OpenSSH connections on Windows where a password has been used. Private keys do not seem to be getting leaked in the same way, if at all. The affected version was
OpenSSH_9.4p1, OpenSSL 3.1.2 1 Aug 2023
, with 9.5 not being affected.This PR depends on changes made here: rapid7/metasploit-payloads#686
Similar to Mettle's memory search implementation, you can modify the needle and PID to search other programs for potentially sensitive information being stored near needles.
Verification
msfconsole
use post/windows/gather/openssh_password_search
set SESSION <Session ID>
set PID <Process ID>
run
Windows 10 - OpenSSH_9.4p1, OpenSSL 3.1.2 1 Aug 2023
In this scenario, the Windows target is connected to a different host using
ssh.exe
using the passwordmyverysecretpassword
.Getting Connection Info
You can also see what the username and potentially the private key used to connect is. In the below examples, I've used a user called
putty-memsearch-test
with a private key present on the target machine's desktop.Connecting with username + password
Connecting with username + private key