Malware Hunting with the Sysinternals Tools

Slides:



Advertisements
Similar presentations
2 pt 3 pt 4 pt 5pt 1 pt 2 pt 3 pt 4 pt 5 pt 1 pt 2pt 3 pt 4pt 5 pt 1pt 2pt 3 pt 4 pt 5 pt 1 pt 2 pt 3 pt 4pt 5 pt 1pt Integer Addition Integer Subtraction.
Advertisements

Cloudy Weather: How Secure Is the Cloud? Dan Technology Evangelist Microsoft Corporation.
Tech Ed North America /31/2017 9:47 PM Required Slide
Ben Bernstein, Program Manager, UAG DirectAccess Tom Shinder, Knowledge Engineer, UAG DirectAccess Microsoft Corporation SESSION CODE: SIA310.
Evaluations Submit your evals online.
Reverse Engineering Malware and Mitigation Techniques
The 12 Reasons to Love Microsoft SQL Server 2012 Dandy Weyn Thomas LaRock Sean Boon DBI202_R.
Windows PowerShell Crash Course Don Jones Concentrated Technology Jeffrey Snover Microsoft WSV321.
Manual Testing with Microsoft Test Manager 2010
Making Crazy Money with Games in the Cloud Brian H. Prince Chief Technical Evangelist – Windows Azure Microsoft Corporation AZR206.
Find an app in the Start Screen: just type on the screen.
Automating Server-based Build, QA & Test with Visual Studio 2012 Neno Loje Consultant & MVP for Visual Studio ALM, TFS, and Scrum
A Power Tools Treasury: great tools that many folks haven't yet met (or don't know well enough) Presented by Mark Minasi 1 WSV350.
Turning PowerShell Commands into Reusable CLI and GUI Tools Don Jones Senior Partner and Principal Technologist Concentrated Technology, LLC WCL404.
Let’s Get Visual: The Art of Report Design
4/10/2017 2:53 PM SIM202 We Don't Need No Stinkin' GUI: Command-Line Capture Techniques (Remote Options) Laura Chappell Founder, Wireshark University Founder,
* Office 365 kiosk plans (K), Office 365 midsize business plans, Office 365 small business (P1), Office 365 small business.
Computer CPU BUS Memory VM Back Channel Memory BUS Node 1 Node 2 VM.
Getting the Most Out of the Power of Group Policy Jeremy Moskowitz Chief Propeller-Head GPanswers.com & PolicyPak Software.
Tips and Tricks for Building Rich Reports in SQL Server 2012 Reporting Services Bob Meyers Senior Program Manager Microsoft Corporation DBI307.
Defense Against the Dark Ages: Your Old Web Apps Are Trying to Kill You Aaron Margosis Principal Consultant Microsoft Corporation SIA324.
Windows Azure SQL Reporting Dany Hoter Senior Program Manager Microsoft Corporation Ola Lavi Software Development Engineer Microsoft Corporation.
Sysinternals Primer: Gems Aaron Margosis Principal Consultant Microsoft Corporation SIA311.
Welcome Mark Greatorex Director - Developer & Platform Group Microsoft Ltd.
Exploring SQL Server Data Tier Applications Gert Drapers Principal Group Program Manager Microsoft Corporation Adam Mahood Program Manager.
Building Integrated Microsoft Office 365, SharePoint Online, and Office Solutions Using BCS and LOB Data Donovan Follette Sr. Technical.
Top 10 Production Experiences with Service Manager and Orchestrator Nathan Lasnoski Infrastructure Architect Microsoft MVP Concurrency.
Operating and Optimizing Multi-Tenant SaaS Applications in Windows Azure: An IT Pro Perspective Rainer Stropek CEO, Co-Founder software architects gmbh.
4/19/2017 7:47 PM DBI311 Microsoft SQL Server Data Tools: Database Development from Zero to Sixty Gert Drapers Principal Group Program Manager.
Branding and Customizing My Sites with Microsoft SharePoint Server 2010 John Ross & Randy Drisgill MVPs Rackspace Hosting OSP337.
Configuring Kerberos for Microsoft SharePoint 2010 BI in 7 Steps (SQL Server 2012) Chuck Heinzelman Senior Program Manager – BPD CX Microsoft Corporation.
Building, Running, and Managing Workflows on Windows Azure Jürgen Willis Group Program Manager Microsoft Corporation.
“When combining the results from all four AV engines, less than 40% of the binaries were detected.” Source: CAMP: Content-Agnostic Malware Protection.
Supporting Microsoft Office in an Enterprise Environment Will Brandt Sr Technical Lead Microsoft Corporation OSP303.
“When combining the results from all four AV engines, less than 40% of the binaries were detected.” Source: CAMP: Content-Agnostic Malware Protection.
A long time ago, before I started working in the PC world, I was a government economist. I don't do that any more, but being an economist gives you a framework.
Preparing to Support Enterprise Applications on Windows Azure Eric Mattingly Service Engineer Microsoft Corporation AZR301.
The Dirty Dozen: Windows PowerShell Scripts for the Busy DBA Ike Ellis.
Visual Studio Tips & Tricks Dustin Campbell Microsoft Corporation Scott Cate EventDay.com DEV319.
Advanced Microsoft SharePoint 2010 Upgrade Troubleshooting Todd Klindt SharePoint Nerd Rackspace OSP339.
Building SharePoint Online Applications in a Hybrid World Chris Johnson General Manager Provoke Solutions - Seattle OSP331.
App Controller Richard Rundle Ketan Ghelani Program Managers Microsoft Corporation MGT303.
AZR203. WA Storage Geo-Replication.
Windows Phone: Building Enterprise Apps Rob Tiffany Architect Microsoft Corporation WPH207.
What’s New with IIS 8: Open Web Platform for Cloud Shaun Eagan Senior Program Manager Microsoft Corporation Wade A. Hilmo Principal Development Lead Microsoft.
Demystifying Forefront Edge Security Technologies – TMG and UAG Richard Hicks Director – Sales Engineering Celestix Networks, Inc. SIA208.
FDN03. Source: IDC, Media Tablet Multi-Client Study, February Note: IDC only surveyed iPad owners for this study.
Supporting Microsoft Office in an Enterprise Environment Will Brandt Sr Technical Lead Microsoft Corporation OSP303.
“When combining the results from all four AV engines, less than 40% of the binaries were detected.” Source: CAMP: Content-Agnostic Malware Protection.
Sysinternals Primer: Gems Aaron Margosis Principal Consultant Microsoft Corporation SIA311.
Defense Against the Dark Ages: Your Old Web Apps Are Trying to Kill You Aaron Margosis Principal Consultant Microsoft Corporation SIA324.
OSP201: Creating Self- Service BI Solutions with SharePoint Server 2010 Peter Myers.
Application Lifecycle Management Tools for C++ in Visual Studio 2012 Rong Lu Program Manager Visual C++ Microsoft Corporation DEV316.
Microsoft SQL Server Data Tools: Database Development from Zero to Sixty Gert Drapers Principal Group Program Manager Microsoft Corporation.
AZR319: Monitoring and Managing Your Windows Azure Applications and Services Chandrika Shankarnarayan, Senior Program Manager Lead Vikram Desai, Senior.
What’s New in.NET 4.5 Layla Driscoll Senior Program Manager Microsoft Corporation.
Antimalware Smackdown Name: Frank Simorjay Title: TwC Sr. Product Manager Microsoft Corporation Name: Scott Wu Title: MMPC Technical Program Manager Microsoft.
Making Agile Estimation Work Joel Semeniuk and Stephen Forte Microsoft Corporation AAP309.
Demystifying Forefront Edge Security Technologies – TMG and UAG Richard Hicks Director – Sales Engineering Celestix Networks, Inc. SIA208.
Going Beyond F11: Debug Better and Faster with Visual Studio 2012 Brian A. Randell Senior Consultant MCW Technologies DEV317.
Building Metro style apps with XAML with.NET Tim Heuer Program Manager Microsoft Corporation DEV353.
Malware Incident Response
Sysinternals Tutorials
Building SaaS Solutions on Windows Azure
5/6/2019 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Securing ASP.NET in an Azure Environment
8/4/ :27 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
TechEd /12/ :12 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Using Software Restriction Policies
What’s New in Visual Studio 2012 for Web Developers
Presentation transcript:

Malware Hunting with the Sysinternals Tools SIA302 Malware Hunting with the Sysinternals Tools Mark Russinovich Technical Fellow Windows Azure

“During 4Q11, 33 percent of Web malware encountered was zero-day malware not detectable by traditional signature-based methodologies at the time of encounter” Cisco 4Q11 Global Threat Report

About this Talk Learn about Sysinternals tools and techniques for analyzing and cleaning malware Professional antimalware analysis requires years of deep training But even for professionals, Sysinternals tools can prove useful Analyzing: Understanding the impact of malware Can be used to understand malware operation Generates road map for cleaning infestations Cleaning: Removing an infestation of a compromised system Attempting a clean can also reveal more information about malware’s operation

Sysinternals Antivirus Don’t use it! I didn’t write it! It’s not very good (actually, it’s malware) They don’t even link to Sysinternals.com 

Malware Cleaning Steps Disconnect from network Identify malicious processes and drivers Terminate identified processes Identify and delete malware autostarts Delete malware files Reboot and repeat

Identifying Malware Processes

What Are You Looking For? Investigate processes that… …have no icon …have no description or company name …unsigned Microsoft images …live in Windows directory or user profile …are packed …include strange URLs in their strings …have open TCP/IP endpoints …host suspicious DLLs or services

What About Task Manager? Task Manager provides little information about images that are running

Process Explorer Process Explorer is “Super Task Manager” Has lots of general troubleshooting capabilities: DLL versioning problems Handle leaks and locked files Performance troubleshooting Hung processes We’re going to focus on its malware cleaning capabilities

The Process View The process tree shows parent-child relationships Icon, description, and company name are pulled from image version information Most malware doesn’t have version information What about malware pretending to be from Microsoft? We’ll deal with that shortly… Use the Window Finder (in the toolbar) to associate a window with its owning process Use the Search Online menu entry to lookup unknown processes But malware often uses totally random or pseudo-random names

Refresh Highlighting Refresh highlighting highlights changes Red: process exited Green: new process Change duration (default 1 second) in Options Press space bar to pause and F5 to refresh Cause display to scroll to make new processes visible with Show New Processes option We’ll see how to spot short-lived processes later…

Process-type Highlights Blue processes are running in the same security context as Process Explorer Pink processes host Windows services Purple highlighting indicates an image is “packed” Packed can mean compressed or encrypted Malware commonly uses packing (e.g. UPX) to make antivirus signature matching more difficult Packing and encryption also hides strings from view There are a few other colors, but they’re not important for malware hunting

Tooltips Process tooltips show the full path to the process image Malware more often hides behind Svchost, Rundll32 and Dllhost Tooltip for Rundll32 processes shows hosted DLL Dllhost tooltip shows hosted COM server Tooltip for service processes shows hosted services Services covered in detail shortly…

New in v15.2 Autostart locations Process timeline: Reports where image is registered for autostart or loading Not necessarily what caused the process to execute, though Process timeline:

Detailed Process Information Double-click on a process to see detailed information Pages relevant to malware analysis: Image: signing status, start time, version TCP/IP: open endpoints Strings: printable strings in main executable

Image Verification All (well, most) Microsoft code is digitally signed Hash of file is signed with Microsoft’s private key Signature is checked by decrypting signed hash with the public key You can selectively check for signatures with the Verify button on the process image tab Select the Verify Image Signatures option to check all Add the Verified Signer column to see all Note that verification will connect to the Internet to check Certificate Revocation List (CRL) servers

Sigcheck and ListDlls sigcheck -e -u -s c:\ listdlls -u Scan the system for suspicious executable images Look for same characteristics as suspicious processes Be especially wary of items in the \Windows directory and the \Users\<username>\Appdata directories Investigate all unsigned images ListDlls will scan running processes for unsigned DLLs sigcheck -e -u -s c:\ listdlls -u

Strings strings <file> On-disk and in-memory process strings are visible on the Strings tab There’s only a difference if the image is compressed or encrypted Strings can help provide clues about unknown processes Look for URLs, names and debug strings You can also dump strings with the command-line Strings utility from Sysinternals strings <file>

The DLL View Malware can hide as a DLL inside a legitimate process We’ve already seen this with Rundll32 and Svchost Typically loads via an autostart Can load through “dll injection” Packing highlight shows in DLL view as well Open the DLL view by clicking on the DLL icon in the toolbar Shows more than just loaded DLLs Includes .EXE and any “memory mapped files” Can search for a DLL with the Find dialog DLL strings are also viewable on the DLL properties

Terminating Malicious Processes Don’t kill the processes Malware processes are often restarted by watchdogs Instead, suspend them Note that this might cause a system hang for Svchost processes Record the full path to each malicious EXE and DLL After they are all asleep then kill them Watch for restarts with new names…

Cleaning Autostarts

Investigating Autostarts Windows Msconfig (Start->Run->Msconfig) falls short when it comes to identifying autostarting applications It knows about few locations It provides little information

Autoruns Shows every place in the system that can be configured to run something at boot & logon Standard Run keys and Startup folders Shell, userinit Services and drivers Tasks Winlogon notifications Explorer and IE addins (toolbars, Browser Helper Objects, …) More and ever growing… Each startup category has its own tab and all items display on the Everything tab Startup name, image description, company and path

Identifying Malware Autostarts Zoom-in on add-ons (including malware) by selecting these filter options: Verify Code Signatures Hide Microsoft Entries Select an item to see more in the lower window Online search unknown images Double-click on an item to look at where its configured in the Registry or file system Has other features: Can display other profiles Can also show empty locations (informational only) Includes compare functionality Includes equivalent command-line version, Autorunsc.exe

Deleting Autostarts Delete suspicious autostarts You can disable them if you’re not sure After you’re done do a full refresh If they come back, run Process Monitor to see who’s putting them back You might have misidentified a malware process It might be a hidden, system, or legitimate process

Tracing Malware Activity

Tracing Malware Tracing activity can reveal the system impact of malware Tracing shows initial infection, before cloaking is applied Can reveal the internals of “buddy system” and other infection-protection mechanisms Process Monitor makes tracing easy A simple filter can identify all system modifications Investigating stacks can distinguish legitimate activity from malicious activity

Process Monitor Process Monitor is a real-time file, registry, process and thread monitor It replaces Filemon and Regmon More advanced filtering Operation call stacks Boot-time logging Data mining views Process tree to see short-lived processes When in doubt, run Process Monitor! It will often show you the cause for error messages It many times tells you what is causing sluggish performance

Event Classes File system (Filemon) Registry (Regmon) Process Network Includes I/O command input and output details Registry (Regmon) Includes all data (First 16-bytes part of REG_BINARY and first 2048-bytes for other types) Process Process create and exit Thread create and exit Image loads, including drivers Network ETW network tracing Profiling Toolhelp thread snapshots

Event Properties Event details Process information Duration, process, thread, details, etc. Process information Command line User Session and logon session Image information Start time Thread stack at time of event

Filtering To filter on a value, right-click on the line and select the attribute from the Include, Exclude or Highlight submenus You can select multiple values simultaneously When you set a highlight filter you can move through highlighted event properties

Advanced Filters Multiple-filter behavior: Values from different attributes are AND’d Values for the same attribute are OR’d More complex filtering is available in the Filter dialog Outlook-style rule definition You can save and restore filters Filter for watching malware impact: “Category is Write”

The Process Tree Tools->Process Tree Shows all processes that have been seen in the trace (including parents) Can toggle on and off terminated processes The process tree provides an easy way to see process relationships Short-lived processes Command lines User names

Real World Analysis and Cleaning

The Case of the Sysinternals-Blocking Malware Friend asked user to take a look at system suspected of being infected with malware Boot and logons took a long time Microsoft Security Essentials (MSE) malware scan would never complete Nothing jumped out in Task Manager Tried running Sysinternals tools, but all exited immediately after starting: Autoruns Process Monitor Process Explorer Even Notepad opening a text file named “Process Explorer” would also terminate

The Case of the Sysinternals-Blocking Malware (Cont) Looking through Sysinternals suite, noticed Desktops utility Hoped malware might not be smart enough to monitor additional desktops Sure enough, was able to launch Process Monitor and other tools: Malware probably looks for tools in window titles Window enumeration only returns windows of current desktop

The Case of the Sysinternals-Blocking Malware (Cont) Nothing suspicious in Process Explorer Next, ran Process Monitor Noticed a lot of Winlogon activity, so set a filter to include it Could see a once-per-second check of a strange key: Saw name of random DLL in the key:

The Case of the Sysinternals-Blocking Malware: Solved Tried deleting the key, but after refreshing it was back Went back to MSE and directed it to scan just the random DLL image file on disk: After clean, was able to delete Registry key and system was back to normal: problem solved

Cleaning FakeSysDef Scareware Give a man a stolen credit card & he'll eat like a king for a day. Teach a man to phish and he'll be set for life. -- Ancient Nigerian proverb Cleaning FakeSysDef Scareware http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?name=Trojan:Win32/FakeSysdef

The Case of the Strange Reboots Laptop would reboot immediately after connecting to wireless networks: Followed by boot to safe mode Then boot back to normal mode Boot to safe mode resulted in automatic logoff Tried to run Microsoft Security Essentials (MSE), but it was damaged

The Case of the Strange Reboots Ran Process Explorer and saw many processes exhibiting malware characteristics:

The Case of the Strange Reboots (Cont) Processes with names mimicking Windows processes were clearly malicious:

The Case of the Strange Reboots (Cont) Autoruns showed system massively infected:

The Case of the Strange Reboots (Cont) Suspended all packed processes

The Case of the Strange Reboots: Solved Connected to network: no restart Downloaded and ran fresh copy of MSE MSE detected several malware variants: After cleaning, no more suspicious processes and system behaved normally: problem solved

Cleaning Cycbot http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?Name=Win32%2fCycbot

Analyzing and Cleaning Stuxnet and Flame http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?Name=WinNT%2fStuxnet http://www.microsoft.com/security/portal/Threat/Encyclopedia/Entry.aspx?Name=Worm:Win32/Flame.gen!B

Stuxnet Discovered June 2010 after it had spread for year Exploited 4 zero day Windows vulnerabilities Print spooler for remote code execution Shell link Explorer code execution from infected key Win2K/Windows XP Win32k.sys privilege elevation Windows 7 Task Scheduler privilege elevation Drivers signed by certificates stolen from RealTek and JMicron Rootkit code for Siemens Step 7 SCADA PLC for centrifuges Suspected to have targeted Iranian centrifuges used for Uranium enrichment at Natanz nuclear facility Iran confirms in September 2010 that thousands were destroyed Suspected to be created by Israel and US

Flame Disovered a few weeks ago Considered by some to be more sophisticated than Stuxnet http://www.reuters.com/article/2012/06/12/us-media-tech-summit-flame-idUSBRE85A0TN20120612

Summary

The Future of Malware Prevent and Detect We’ve seen the trends: Malware that pretends to be from Microsoft or other legitimate companies Malware protected by sophisticated rootkits Malware that has stolen certificates Cleaning is going to get much, much harder Targeted and polymorphic malware won’t get AV/AS signatures Malware can directly manipulate Windows structures to cause misdirection All standard tools will be directly attacked by malware There will be more un-cleanable malware You can’t know you’re infected unless you find a symptom Prevent and Detect

Zero Day – A Novel A cyberthriller true to the science September 1 www.zerodaythebook.com

The Sysinternals Administrator’s Reference The official guide to the Sysinternals tools Covers every tool, every feature, with tips Written by Mark Russinovich and Aaron Margosis Full chapters on the major tools: Process Explorer Process Monitor Autoruns Other chapters by tool group Security, process, AD, desktop, … Book signings with Mark and Aaron Wed. and Thurs., 11:30am TechEd bookstore Mark will also be signing Zero Day and Windows Internals 6th Ed Pt. 1

References Sysinternals Mark’s Sysinternals Blog Mark’s Webcasts Microsoft Security Intelligence Report http://www.microsoft.com/security/sir/default.aspx Symantec Stuxnet Dossier http://www.symantec.com/content/en/us/enterprise/media/security_response/whitepapers/w32_stuxnet_dossier.pdf Arstechnica Stuxnet story http://www.wired.com/threatlevel/2011/07/how-digital-detectives-deciphered-stuxnet/ Windows Internals, by Mark Russinovich and David Solomon with Alex Ionescu, Microsoft Press

Track Resources www.microsoft.com/twc www.microsoft.com/security www.microsoft.com/privacy www.microsoft.com/reliability

Resources Learning TechNet http://europe.msteched.com Connect. Share. Discuss. http://europe.msteched.com Microsoft Certification & Training Resources www.microsoft.com/learning TechNet Resources for IT Professionals http://microsoft.com/technet Resources for Developers http://microsoft.com/msdn

Submit your evals online 3/31/2017 2:33 PM Evaluations Submit your evals online http://europe.msteched.com/sessions © 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

3/31/2017 2:33 PM © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

3/31/2017 2:33 PM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.