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
Fix symlink test bug when running python meterpreter on windows #18112
Fix symlink test bug when running python meterpreter on windows #18112
Conversation
8749dfa
to
2a66987
Compare
@@ -292,7 +292,7 @@ def cleanup | |||
|
|||
def make_symlink(target, symlink) | |||
if session.platform == 'windows' | |||
cmd_exec("cmd.exe /c mklink #{directory?(target) ? '/D ' : ''}#{symlink} #{target}") | |||
cmd_exec("cmd.exe", "/c mklink #{directory?(target) ? '/D ' : ''}#{symlink} #{target}") |
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.
Before this change - we can see in procmon that it's attempting to find the file cmd.exe /c mklink ...
etc on the user's filepath
Afterwards it will just attempt to call cmd.exe
Long term - I think we'll either want to holistically fix this edgecase in the python meterpreter / or update modules to send program name and arguments separately / add a rubocop rule to catch this edgecase
Before:
After:
Hey @adfoster-r7, any idea why I'd be seeing the following failure after deploying the changes in this PR??
|
If you don't have write access in the current directory that can happen; I have a separate PR to fix that - #18109 - running the payload from an admin cmd prompt might resolve the issue Python 2 is also broken on windows, it needs python 3 - rapid7/metasploit-payloads#657 Beyond that, I'm not sure else it would be - would have to put in a breakpoint or run with |
Thanks Alan - running from and Admin cmd prompt fixed the issue. I appreciate all the suggestions 🙇
|
Release NotesThis PR fixes a symlink test bug when running python meterpreter on windows |
Fix symlink test bug when running python Meterpreter on windows with the
test/file
module, available after runningloadpath test/modules
Verification
Verify that
test/file
works on a windows python Meterpreter sessionBefore - test failure:
After - all green: