Portcullis Labs - documentation http://labs.portcullis.co.uk Labs Portcullis updates. en Labs portcullis Tue, 22 Feb 2011 11:21:32 GMT http://backend.userland.com/rss 60 Labs Portcullis hhttp://labs.portcullis.co.uk/mg/logo.gif http://labs.portcullis.co.uk Examples | Usage Fri, 28 Mar 2008 14:21:19 GMT http://labs.portcullis.co.uk/content/enum4linux/examples/ <p>Below are examples which demonstrate most of the features of enum4linux. Output has been edited for brevity in most cases.</p> <h2>Verbose Mode</h2> <p>Before we delve into the features of enum4linux, it's worth pointing out that verbose mode shows you the underlying commands being run by enum4linux (rpcclient, smblient, etc.). This is useful if you want to use the underlying commands manually, but can't figure out the syntax to use. Note the lines beginning with [V] in the output below:</p> <p><tt>$ enum4linux.pl -v 192.168.2.55<br /> [V] Dependent program &quot;nmblookup&quot; found in /usr/bin/nmblookup<br /> [V] Dependent program &quot;net&quot; found in /usr/bin/net<br /> [V] Dependent program &quot;rpcclient&quot; found in /usr/bin/rpcclient<br /> [V] Dependent program &quot;smbclient&quot; found in /usr/bin/smbclient<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:18:51 2008<br /> <br /> ----- Enumerating Workgroup/Domain on 192.168.2.55 ------<br /> <b> [V] Attempting to get domain name with command: nmblookup -A '192.168.2.55'</b><br /> [+] Got domain/workgroup name: WORKGROUP<br /> <br /> ----- Getting domain SID for 192.168.2.55 -----<br /> <b> [V] Attempting to get domain SID with command: rpcclient -U''%'' 192.168.2.55 -c 'lsaquery' 2&gt;&amp;1</b><br /> Domain Name: WORKGROUP<br /> Domain Sid: S-0-0<br /> [+] Host is part of a workgroup (not a domain)<br /> <br /> ----- Session Check on 192.168.2.55 -----<br /> <b> [V] Attempting to make null session using command: smbclient //'192.168.2.55'/ipc$ -U''%'' -c 'help' 2&gt;&amp;1</b><br /> [+] Server 192.168.2.55 allows sessions using username '', password ''<br /> </tt></p> <h2>The &quot;Do Everything&quot; Option</h2> <p>As you read through the following section you'll probably think that there are a lot of options you need to remember. If you just want enum4linux to try to enumerate all the information it can from a remote host, just use the -a option:</p> <p><tt>$ enum4linux.pl -a 192.168.2.55</tt></p> <p>NB: This won't do dictionary-based share name guessing, but does pretty much everything else.</p> <h2>Obtain List of Usernames (RestrictAnonymous = 0)</h2> <p>This feature is similar to 'enum.exe -U IP'. It returns a complete list of usernames if the server allows it. On Windows 2000 the RestrictAnonymous registry setting must be set to 0 for this feature to work. The user list is show twice in two different formats because type different underlying commands are used to retrieve the data.</p> <p><tt>$ enum4linux.pl -U 192.168.2.55<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Thu Mar 27 16:02:50 2008<br /> <br /> ----- Users on 192.168.2.55 -----<br /> index: 0x1 RID: 0x1f4 acb: 0x210 Account: Administrator Name: Desc: Built-in account for administering the computer/domain<br /> index: 0x2 RID: 0x3ee acb: 0x10 Account: basic Name: basic Desc:<br /> index: 0x3 RID: 0x3ed acb: 0x10 Account: blah Name: Desc:<br /> index: 0x4 RID: 0x1f5 acb: 0x215 Account: Guest Name: Desc: Built-in account for guest access to the computer/domain<br /> index: 0x5 RID: 0x3e9 acb: 0x214 Account: IUSR_PORTCULLIS Name: Internet Guest Account Desc: Built-in account for anonymous access to Internet Information Services<br /> index: 0x6 RID: 0x3ea acb: 0x214 Account: IWAM_PORTCULLIS Name: Launch IIS Process Account Desc: Built-in account for Internet Information Services to start out of process applications<br /> index: 0x7 RID: 0x3ec acb: 0x10 Account: mark Name: Desc:<br /> index: 0x8 RID: 0x3e8 acb: 0x214 Account: TsInternetUser Name: TsInternetUser Desc: This user account is used by Terminal Services.<br /> <br /> user:[Administrator] rid:[0x1f4]<br /> user:[basic] rid:[0x3ee]<br /> user:[blah] rid:[0x3ed]<br /> user:[Guest] rid:[0x1f5]<br /> user:[IUSR_PORTCULLIS] rid:[0x3e9]<br /> user:[IWAM_PORTCULLIS] rid:[0x3ea]<br /> user:[mark] rid:[0x3ec]<br /> user:[TsInternetUser] rid:[0x3e8]</tt></p> <h2>Obtain a List of Usernames (Using authentication)</h2> <p>If you've managed to obtain a username and password for the host, you can use it to retrieve a complete list of users regardless of RestrictAnonymous settings. In the example below we use the administrator account, but any account will do:</p> <p><tt>$ enum4linux.pl -u administrator -p password -U 192.168.2.55<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 13:19:35 2008<br /> <br /> ----- Users on 192.168.2.55 -----<br /> index: 0x1 RID: 0x1f4 acb: 0x210 Account: Administrator Name: Desc: Built-in account for administering the computer/domain<br /> index: 0x2 RID: 0x3ee acb: 0x10 Account: basic Name: basic Desc:<br /> index: 0x3 RID: 0x3ed acb: 0x10 Account: blah Name: Desc:<br /> index: 0x4 RID: 0x1f5 acb: 0x215 Account: Guest Name: Desc: Built-in account for guest access to the computer/domain<br /> index: 0x5 RID: 0x3e9 acb: 0x214 Account: IUSR_PORTCULLIS Name: Internet Guest Account Desc: Built-in account for anonymous access to Internet Information Services<br /> index: 0x6 RID: 0x3ea acb: 0x214 Account: IWAM_PORTCULLIS Name: Launch IIS Process Account Desc: Built-in account for Internet Information Services to start out of process applications<br /> index: 0x7 RID: 0x3ec acb: 0x10 Account: mark Name: Desc:<br /> index: 0x8 RID: 0x3e8 acb: 0x214 Account: TsInternetUser Name: TsInternetUser Desc: This user account is used by Terminal Services.<br /> <br /> user:[Administrator] rid:[0x1f4]<br /> user:[basic] rid:[0x3ee]<br /> user:[blah] rid:[0x3ed]<br /> user:[Guest] rid:[0x1f5]<br /> user:[IUSR_PORTCULLIS] rid:[0x3e9]<br /> user:[IWAM_PORTCULLIS] rid:[0x3ea]<br /> user:[mark] rid:[0x3ec]<br /> user:[TsInternetUser] rid:[0x3e8]</tt></p> <h2>Obtaining a List of Usernames via RID Cycling (RestrictAnonymous = 1)</h2> <p>To obtain the usernames corresponding to a default range of RIDs (500-550,1000-1050) use the -r option:</p> <p><tt>$ enum4linux.pl -r 192.168.2.55<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:27:21 2008<br /> <br /> ----- Target information -----<br /> Target ........... 192.168.2.55<br /> RID Range ........ 500-550,1000-1050<br /> Known Usernames .. administrator, guest, krbtgt, domain admins, root, bin, none<br /> <br /> ----- Users on 192.168.2.55 via RID cycling (RIDS: 500-550,1000-1050) -----<br /> [I] Assuming that user &quot;administrator&quot; exists<br /> [+] Got SID: S-1-5-21-1801674531-1482476501-725345543 using username '', password ''<br /> S-1-5-21-1801674531-1482476501-725345543-500 W2KSQL\Administrator (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-501 W2KSQL\Guest (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-513 W2KSQL\None (Domain Group)<br /> S-1-5-21-1801674531-1482476501-725345543-1000 W2KSQL\TsInternetUser (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-1001 W2KSQL\IUSR_PORTCULLIS (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-1002 W2KSQL\IWAM_PORTCULLIS (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-1004 W2KSQL\mark (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-1005 W2KSQL\blah (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-1006 W2KSQL\basic (Local User)</tt><br /> <br /> You can specify a custom range of RIDs using the -R option. This implies -r, so your don't have specify the -r option:</p> <p><tt>$ enum4linux.pl -R 500-520 192.168.2.55<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:27:53 2008<br /> <br /> ----- Target information -----<br /> Target ........... 192.168.2.55<br /> RID Range ........ 500-520<br /> Known Usernames .. administrator, guest, krbtgt, domain admins, root, bin, none<br /> <br /> ----- Users on 192.168.2.55 via RID cycling (RIDS: 500-520) -----<br /> [I] Assuming that user &quot;administrator&quot; exists<br /> [+] Got SID: S-1-5-21-1801674531-1482476501-725345543 using username '', password ''<br /> S-1-5-21-1801674531-1482476501-725345543-500 W2KSQL\Administrator (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-501 W2KSQL\Guest (Local User)<br /> S-1-5-21-1801674531-1482476501-725345543-513 W2KSQL\None (Domain Group)<br /> </tt></p> <p>Before RID cycling can start, enum4linux needs to get the SID from the remote host. It does this by requesting the SID of a known username / group (pretty much the same thing every other RID-cycling tool does). You can see in the above output a list of &quot;Known Usernames&quot;. These are tried in turn, until enum4linux finds the SID of the remote host.</p> <p>If you've very unlucky, this list won't be good enough and you won't be able to get the SID. In this case, use the -k option to specify a different &quot;known username&quot;:</p> <p><tt>$ enum4linux.pl -k anotheruser -R 500-520 192.168.2.55</tt></p> <p>You can specify a list using commas:</p> <p><tt>$ enum4linux.pl -k user1,user2,user3 -R 500-520 192.168.2.55</tt></p> <h2>Group Membership</h2> <p>If the remote host allow it, you can get a list of groups and their members using the -G option (like in enum.exe):</p> <p><tt>$ enum4linux.pl -G 192.168.2.55<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 13:54:48 2008<br /> <br /> ----- Groups on 192.168.2.55 -----<br /> [+] Getting builtin groups:<br /> group:[Administrators] rid:[0x220]<br /> group:[Backup Operators] rid:[0x227]<br /> group:[Guests] rid:[0x222]<br /> group:[Power Users] rid:[0x223]<br /> group:[Replicator] rid:[0x228]<br /> group:[Users] rid:[0x221]<br /> <br /> [+] Getting builtin group memberships:<br /> Group 'Guests' (RID: 546) has members:<br /> W2KSQL\Guest<br /> W2KSQL\TsInternetUser<br /> W2KSQL\IUSR_PORTCULLIS<br /> W2KSQL\IWAM_PORTCULLIS<br /> Group 'Users' (RID: 545) has members:<br /> NT AUTHORITY\INTERACTIVE<br /> NT AUTHORITY\Authenticated Users<br /> W2KSQL\mark<br /> W2KSQL\blah<br /> W2KSQL\basic<br /> Group 'Replicator' (RID: 552) has members:<br /> Group 'Power Users' (RID: 547) has members:<br /> Group 'Administrators' (RID: 544) has members:<br /> W2KSQL\Administrator<br /> W2KSQL\mark<br /> W2KSQL\blah<br /> Group 'Backup Operators' (RID: 551) has members:<br /> <br /> [+] Getting local groups:<br /> <br /> [+] Getting local group memberships:<br /> <br /> [+] Getting domain groups:<br /> group:[None] rid:[0x201]<br /> <br /> [+] Getting domain group memberships:<br /> Group 'None' (RID: 513) has members:<br /> W2KSQL\Administrator<br /> W2KSQL\Guest<br /> W2KSQL\TsInternetUser<br /> W2KSQL\IUSR_PORTCULLIS<br /> W2KSQL\IWAM_PORTCULLIS<br /> W2KSQL\mark<br /> W2KSQL\blah<br /> W2KSQL\basic<br /> </tt></p> <p>As with the -U option for user enumeration, you can also specify -u user -p pass to provide login credentials if required. Any user account will do, you don't have to be an admin.</p> <h2>Check if Host Part of a Domain or Workgroup</h2> <p>Enum4linux uses rpcclient's &quot;lsaquery&quot; command to ask for a host's Domain SID. If we get a proper SID we can infer that it is part of a domain. If we get the answer S-0-0 we can infer the host is part of a workgroup. This is done by default, so no command line options are required:</p> <p><tt>$ enum4linux.pl 192.168.2.55<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Thu Mar 27 16:02:50 2008</tt></p> <p><tt>----- Getting domain SID for 192.168.2.55 -----<br /> Domain Name: WORKGROUP<br /> Domain Sid: S-0-0<br /> [+] Host is part of a workgroup (not a domain)</tt></p> <h2>Getting 'nbtstat' Information</h2> <p>The -n option causes enum4linux to run nmblookup and does some extra parsing on it's output to provide human-readable information about the remote host.</p> <p><tt>$ enum4linux.pl -n 192.168.2.55<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:21:13 2008<br /> <br /> ----- Nbtstat Information for 192.168.2.55 -----<br /> Looking up status of 192.168.2.55<br /> W2KSQL &lt;00&gt; - B </tt><active><tt> Workstation Service<br /> W2KSQL &lt;20&gt; - B </tt><active><tt> File Server Service<br /> WORKGROUP &lt;00&gt; - </tt><group><tt> B </tt><active><tt> Domain/Workgroup Name<br /> INet~Services &lt;1c&gt; - </tt><group><tt> B </tt><active><tt> IIS<br /> WORKGROUP &lt;1e&gt; - </tt><group><tt> B </tt><active><tt> Browser Service Elections<br /> W2KSQL &lt;03&gt; - B </tt><active><tt> Messenger Service<br /> IS~W2KSQL &lt;00&gt; - B </tt><active><tt> IIS<br /> ADMINISTRATOR &lt;03&gt; - B </tt><active><tt> Messenger Service<br /> <br /> MAC Address = 00-0C-29-A4-12-6C</tt><br /> </active></active></active></active></group></active></group></active></group></active></active></p> <h2>Listing Windows Shares</h2> <p>If the server allows it, you can obtain a complete list of shares with the -S option. This uses smbclient under the bonnet which also seems to grab the browse list.</p> <p>Enum4linux will also attempt to connect to each share with the supplied credentials (null session usually, but you could use -u user -p pass to use something else). It will report whether it could connect to the share and whether it was possible to get a directory listing.</p> <p><tt>$ enum4linux.pl -S 192.168.2.55<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:28:28 2008<br /> <br /> ----- Enumerating Workgroup/Domain on 192.168.2.55 ------<br /> [+] Got domain/workgroup name: WORKGROUP<br /> <br /> ----- Share Enumeration on 192.168.2.55 -----<br /> Domain=[WORKGROUP] OS=[Windows 5.0] Server=[Windows 2000 LAN Manager]<br /> <br /> Sharename Type Comment<br /> --------- ---- -------<br /> IPC$ IPC Remote IPC<br /> ADMIN$ Disk Remote Admin<br /> C$ Disk Default share<br /> session request to 192.168.2.55 failed (Called name not present)<br /> session request to 192 failed (Called name not present)<br /> <br /> Server Comment<br /> --------- -------<br /> W2KSQL<br /> WEBVULNB<br /> WINORACLE<br /> <br /> Workgroup Master<br /> --------- -------<br /> PTT SBS<br /> WORKGROUP WEBVULNB<br /> <br /> ----- Attempting to map to shares on 192.168.2.55 -----<br /> //192.168.2.55/IPC$ Mapping: OK Listing: DENIED<br /> //192.168.2.55/ADMIN$ Mapping: DENIED, Listing: N/A<br /> //192.168.2.55/C$ Mapping: DENIED, Listing: N/A</tt></p> <p>Some hosts don't let your retrieve a share list. In these situations, it is still possible to perform a dictionary attack to guess share names. First we demonstrate the -S option failing:</p> <p><tt>$ enum4linux.pl -S 192.168.2.76<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:54:02 2008<br /> <br /> ----- Share Enumeration on 192.168.2.76 -----<br /> [E] Can't list shares: NT_STATUS_ACCESS_DENIED<br /> <br /> ----- Attempting to map to shares on 192.168.2.76 -----</tt></p> <p>The output below show the use of the -s option with a dictionary file guess the names of some shares:</p> <p><tt>$ enum4linux.pl -s share-list.txt 192.168.2.76<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:54:20 2008<br /> <br /> ----- Session Check on 192.168.2.76 -----<br /> [+] Server 192.168.2.76 allows sessions using username '', password ''<br /> <br /> ----- Brute Force Share Enumeration on 192.168.2.76 -----<br /> c$ EXISTS<br /> e$ EXISTS<br /> admin$ EXISTS<br /> ipc$ EXISTS, Allows access using username: '', password: ''<br /> </tt></p> <h2>Getting OS Information</h2> <p>The -o option gets OS information using smbclient. Certain versions of Windows (e.g. 2003) even return service pack information.</p> <p><tt>$ enum4linux.pl -o 192.168.2.76<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:55:11 2008<br /> <br /> ----- OS information on 192.168.2.76 -----<br /> [+] Got OS info for 192.168.2.76 from smbclient: Domain=[PTT] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]<br /> [E] Can't get OS info with srvinfo: NT_STATUS_ACCESS_DENIED</tt></p> <h2>Printer Information</h2> <p>You can get some information about printers known to the remote device with the -i option. I don't know why you'd want to do this. I only implemented it because I could. :-)</p> <p><tt>$ enum4linux.pl -i 192.168.2.69<br /> Starting enum4linux v0.8.2 ( http://labs.portcullis.co.uk/application/enum4linux/ ) on Fri Mar 28 11:55:32 2008<br /> <br /> ----- Getting printer info for 192.168.2.69 -----<br /> flags:[0x800000]<br /> name:[\\192.168.2.69\SharedFax]<br /> description:[\\192.168.2.69\SharedFax,Microsoft Shared Fax Driver,]<br /> comment:[]</tt></p>