Experiencing a Security Breach?

24 Hour Hotline: +1 (866) 659-9097 Option 5

General

+1 (312) 873-7500

Monday - Friday 8:00 AM - 6:00 PM CT (UTC -6)

Sales

Contact a Trustwave solution specialist.

+1 (888) 878-7817

Monday - Friday 8:30 AM - 5:30 PM CT (UTC -6)

Loading...

Blogs & Stories

SpiderLabs Blog

Attracting more than a half-million annual readers, this is the security community's go-to destination for technical breakdowns of the latest threats, critical vulnerability disclosures and cutting-edge research.

Sometimes, The PenTest Gods Shine On You

Settling down for a hacking session usually means lots of hard work and a long grind towards target data. You've got to juggle a large stack of systems and testing constraints, all while learning about the environment from the ground up. You can spend 3 hours trying to land a shell on a box, just to find it gets you nowhere.

However, sometimes a beautiful beam of light shines down from the heavens and opens up a door or two for you (or maybe its just the sun reflecting off of something in my office, either way).While increasingly rare, these open doors can result in some pretty hefty gains. Usually the product of an overworked admin, or a 'test' scenario gone production. Here are some situations I stumbled across in the past few months that came packaged up with a bow:

Just shout your creds to me
When you are on a network full of Windows machines, its typically pretty easy to enumerate their NetBIOS machine name using a wide array of tools. Using things like Nmap, a module out of Metasploit, or even just native smb tools, you can gather a list of machine names very quickly:

In this case, the NetBIOS name is 'BANANA1'. Since its so easy to enumerate this information, it would be bad to use it as a username or password. Sometimes, I find that's the case, and thankfully Medusa has an option just for this:

Excellent, a user compromise using nothing but the NetBIOS name. NetBIOS names should be used as just that, a name. Never use them as credentials.

Bash is all you need
Most of the time, when I compromise a Linux system, I am dropped on the box as a non-root user. There's lots of paths I can take, but usually I run right to 'sudo' if I know the account's password. This one was interesting, as the admin had blacklisted certain sudo commands:

bob@blaster:~$ sudo su[sudo] password for bob:Sorry, user bob is not allowed to execute '/bin/su' as root on blaster.bob@blaster:~$ sudo /bin/bash[sudo] password for bob:Sorry, user bob is not allowed to execute '/bin/bash' as root on blaster.

So the admin had blocked be from running 'bash' or 'su' from sudo, but forgot about the 'csh' shell. Once I was root in csh, it was easy to just hop back to bash (or just continue to use csh). Obviously, the correct way to do this is to whitelist certain sudo commands, or find some other way to limit excess permissions.

Jot that one down for me
One of my top priorities when I first compromise a box is to take a quick peek at what files are lying around. Users like to treat /home and Desktop's as a temporary file dump for all sorts of interesting things. On this system, I found the following file on a user's Desktop named "john's quick decryption test". The same passphrase worked on encrypted production data:

All the advantages of encrypting data are lost of the passphrase is stored somewhere that's easily accessible. Even worse when the passphrase is stored on someone's Desktop, but also decrypts data on non-domain production systems.

In the same genre, I found a libexpect script that a user was using to log in to every router and firewall, hop to enable, and backup the configurations.