rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34.15k stars 13.97k forks source link

Several scanner modules do not honor proxy settings #9057

Open hph86 opened 7 years ago

hph86 commented 7 years ago

I have noticed that at least the following login scanner modules do not obey proxy settings:

The following example will cause the connection attempt to originate from the local machine rather from the jumphost machine. In the example below, this results in a connection error:

$ ssh -D 5555 jumphost
[switch window]
$ ./msfconsole
[...]
msf > use auxiliary/scanner/smb/smb_login
msf auxiliary(smb_login) > setg Proxies socks4:127.0.0.1:5555
Proxies => socks4:127.0.0.1:5555
msf auxiliary(smb_login) > set smbpass foobar
smbpass => foobar
msf auxiliary(smb_login) > set smbuser administrator
smbuser => administrator
msf auxiliary(smb_login) > set rhosts 10.0.0.233
rhosts => 10.0.0.233
msf auxiliary(smb_login) > run

[*] 10.0.0.233:445     - 10.0.0.233:445 - Starting SMB login bruteforce
[*] 10.0.0.233:445     - 10.0.0.233:445 - This system does not accept authentication with any credentials, proceeding with brute force
[-] 10.0.0.233:445     - 10.0.0.233:445 - Could not connect
[!] 10.0.0.233:445     - No active DB -- Credential data will not be saved!
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

If the proxy setting was was working as expected, the connection should originate from jumphost and it should be a successful connection (although wrong credentials have been provided in this example):

$ ssh -D 5555 jumphost
[switch window]
$ ./msfconsole
[...]
msf > use auxiliary/scanner/smb/smb_login
msf auxiliary(smb_login) > setg Proxies socks4:127.0.0.1:5555
Proxies => socks4:127.0.0.1:5555
msf auxiliary(smb_login) > set smbpass foobar
smbpass => foobar
msf auxiliary(smb_login) > set smbuser administrator
smbuser => administrator
msf auxiliary(smb_login) > set rhosts 10.0.0.233
rhosts => 10.0.0.233
msf auxiliary(smb_login) > run

[*] 10.0.0.233:445     - 10.0.0.233:445 - Starting SMB login bruteforce
[*] 10.0.0.233:445     - 10.0.0.233:445 - This system does not accept authentication with any credentials, proceeding with brute force
[-] 10.0.0.233:445     - 10.0.0.233:445 - Failed: '.\administrator:foobar',
[!] 10.0.0.233:445     - No active DB -- Credential data will not be saved!
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

The current issue is similar to #4052.

wvu commented 7 years ago

This is deeply unsettling to me. No boilerplate should be required to make proxying work. Only strengthens my conviction that setting up egress filtering before proxying is vital. We may need to reevaluate where we fix this problem. Smh.

bcoles commented 6 years ago

8705 is possibly related