|
| 1 | +The `smb_lookupsid` module bruteforces the SID of the user, to obtain the username or group name. |
| 2 | +This module works against Windows and Samba. |
| 3 | +This module can also be used to lookup the information against a Domain utilizing the `action` option. |
| 4 | +SID 500 is always the default administrator account, while user accounts start in the 1000 range. |
| 5 | + |
| 6 | +## Vulnerable Application |
| 7 | + |
| 8 | +To use `smb_lookupsid`, make sure you are able to connect to a SMB service that supports SMBv1. |
| 9 | + |
| 10 | +## Verification Steps |
| 11 | + |
| 12 | +1. Do: ```use auxiliary/scanner/smb/smb_lookupsid``` |
| 13 | +2. Do: ```set rhosts [IP]``` |
| 14 | +3. Do: ```run``` |
| 15 | + |
| 16 | +## Scenarios |
| 17 | + |
| 18 | +### Windows 2000 SP4 |
| 19 | + |
| 20 | +``` |
| 21 | +msf > use auxiliary/scanner/smb/smb_lookupsid |
| 22 | +msf auxiliary(smb_lookupsid) > set rhosts 10.9.7.127 |
| 23 | +rhosts => 10.9.7.127 |
| 24 | +
|
| 25 | +[*] 10.9.7.127:445 - PIPE(LSARPC) LOCAL(WIN2K - 5-21-484763869-823518204-682003330) DOMAIN(RAGEGROUP - ) |
| 26 | +[*] 10.9.7.127:445 - USER=renamedAdministrator RID=500 |
| 27 | +[*] 10.9.7.127:445 - USER=Guest RID=501 |
| 28 | +[*] 10.9.7.127:445 - GROUP=None RID=513 |
| 29 | +[*] 10.9.7.127:445 - USER=disabled RID=1000 |
| 30 | +[*] 10.9.7.127:445 - USER=test RID=1001 |
| 31 | +[*] 10.9.7.127:445 - WIN2K [renamedAdministrator, Guest, disabled, test ] |
| 32 | +[*] Scanned 1 of 1 hosts (100% complete) |
| 33 | +[*] Auxiliary module execution completed |
| 34 | +``` |
| 35 | + |
| 36 | +### Metasploitable2 (Samba) |
| 37 | + |
| 38 | +``` |
| 39 | +msf auxiliary(smb_lookupsid) > run |
| 40 | +
|
| 41 | +[*] Scanned 26 of 253 hosts (10% complete) |
| 42 | +[*] 10.9.7.35:139 - PIPE(LSARPC) LOCAL(METASPLOITABLE - 5-21-1042354039-2475377354-766472396) DOMAIN(WORKGROUP - ) |
| 43 | +[*] 10.9.7.35:139 - USER=Administrator RID=500 |
| 44 | +[*] 10.9.7.35:139 - USER=nobody RID=501 |
| 45 | +[*] 10.9.7.35:139 - GROUP=Domain Admins RID=512 |
| 46 | +[*] 10.9.7.35:139 - GROUP=Domain Users RID=513 |
| 47 | +[*] 10.9.7.35:139 - GROUP=Domain Guests RID=514 |
| 48 | +[*] 10.9.7.35:139 - USER=root RID=1000 |
| 49 | +[*] 10.9.7.35:139 - GROUP=root RID=1001 |
| 50 | +[*] 10.9.7.35:139 - USER=daemon RID=1002 |
| 51 | +[*] 10.9.7.35:139 - GROUP=daemon RID=1003 |
| 52 | +[*] 10.9.7.35:139 - USER=bin RID=1004 |
| 53 | +[*] 10.9.7.35:139 - GROUP=bin RID=1005 |
| 54 | +[*] 10.9.7.35:139 - USER=sys RID=1006 |
| 55 | +[*] 10.9.7.35:139 - GROUP=sys RID=1007 |
| 56 | +``` |
| 57 | +...snip... |
| 58 | + |
| 59 | +``` |
| 60 | +[*] 10.9.7.35:139 - USER=user RID=3002 |
| 61 | +[*] 10.9.7.35:139 - GROUP=user RID=3003 |
| 62 | +[*] 10.9.7.35:139 - USER=service RID=3004 |
| 63 | +[*] 10.9.7.35:139 - GROUP=service RID=3005 |
| 64 | +[*] 10.9.7.35:139 - METASPLOITABLE [Administrator, nobody, root, daemon, bin, sys, sync, games, man, lp, mail, news, uucp, proxy, www-data, backup, list, irc, gnats, libuuid, dhcp, syslog, klog, sshd, bind, postfix, ftp, postgres, mysql, tomcat55, distccd, telnetd, proftpd, statd, msfadmin, user, service ] |
| 65 | +``` |
| 66 | + |
| 67 | +## Confirmation with nmap |
| 68 | + |
| 69 | +NMAP utilizes [smb-enum-users](https://nmap.org/nsedoc/scripts/smb-enum-users.html) to do SID bruteforcing. |
| 70 | + |
| 71 | +``` |
| 72 | +nmap --script smb-enum-users.nse -p445 10.9.7.127,35 |
| 73 | +
|
| 74 | +Starting Nmap 7.40 ( https://nmap.org ) at 2017-05-19 14:36 EDT |
| 75 | +Nmap scan report for 10.9.7.35 |
| 76 | +Host is up (0.0013s latency). |
| 77 | +PORT STATE SERVICE |
| 78 | +445/tcp open microsoft-ds |
| 79 | +MAC Address: 00:0C:29:59:D4:F7 (VMware) |
| 80 | +
|
| 81 | +Host script results: |
| 82 | +| smb-enum-users: |
| 83 | +| METASPLOITABLE\backup (RID: 1068) |
| 84 | +| Full name: backup |
| 85 | +| Flags: Account disabled, Normal user account |
| 86 | +| METASPLOITABLE\bin (RID: 1004) |
| 87 | +| Full name: bin |
| 88 | +| Flags: Account disabled, Normal user account |
| 89 | +| METASPLOITABLE\bind (RID: 1210) |
| 90 | +| Flags: Account disabled, Normal user account |
| 91 | +| METASPLOITABLE\daemon (RID: 1002) |
| 92 | +| Full name: daemon |
| 93 | +| Flags: Account disabled, Normal user account |
| 94 | +| METASPLOITABLE\dhcp (RID: 1202) |
| 95 | +| Flags: Account disabled, Normal user account |
| 96 | +| METASPLOITABLE\distccd (RID: 1222) |
| 97 | +| Flags: Account disabled, Normal user account |
| 98 | +| METASPLOITABLE\ftp (RID: 1214) |
| 99 | +| Flags: Account disabled, Normal user account |
| 100 | +``` |
| 101 | +...snip... |
| 102 | + |
| 103 | +``` |
| 104 | +| METASPLOITABLE\tomcat55 (RID: 1220) |
| 105 | +| Flags: Account disabled, Normal user account |
| 106 | +| METASPLOITABLE\user (RID: 3002) |
| 107 | +| Full name: just a user,111,, |
| 108 | +| Flags: Normal user account |
| 109 | +| METASPLOITABLE\uucp (RID: 1020) |
| 110 | +| Full name: uucp |
| 111 | +| Flags: Account disabled, Normal user account |
| 112 | +| METASPLOITABLE\www-data (RID: 1066) |
| 113 | +| Full name: www-data |
| 114 | +|_ Flags: Account disabled, Normal user account |
| 115 | +
|
| 116 | +Nmap scan report for win2k (10.9.7.127) |
| 117 | +Host is up (0.0013s latency). |
| 118 | +PORT STATE SERVICE |
| 119 | +445/tcp open microsoft-ds |
| 120 | +MAC Address: 00:0C:29:C8:97:2D (VMware) |
| 121 | +
|
| 122 | +Host script results: |
| 123 | +| smb-enum-users: |
| 124 | +| WIN2K\disabled (RID: 1000) |
| 125 | +| Full name: disabled |
| 126 | +| Description: user account is disabled |
| 127 | +| Flags: Account disabled, Normal user account |
| 128 | +| WIN2K\Guest (RID: 501) |
| 129 | +| Description: Built-in account for guest access to the computer/domain |
| 130 | +| Flags: Password not required, Password does not expire, Account disabled, Normal user account |
| 131 | +| WIN2K\renamedAdministrator (RID: 500) |
| 132 | +| Description: Built-in account for administering the computer/domain |
| 133 | +| Flags: Password does not expire, Normal user account |
| 134 | +| WIN2K\test (RID: 1001) |
| 135 | +| Full name: test |
| 136 | +|_ Flags: Normal user account |
| 137 | +
|
| 138 | +Nmap done: 2 IP addresses (2 hosts up) scanned in 0.62 seconds |
| 139 | +``` |
0 commit comments