<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>M-unition &#187; forensics</title>
	<atom:link href="http://blog.mandiant.com/archives/tag/forensics/feed" rel="self" type="application/rss+xml" />
	<link>https://blog.mandiant.com</link>
	<description>The Ammunition You Need to Find Evil and Solve Crime</description>
	<lastBuildDate>Thu, 09 Feb 2012 14:18:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Tearing up the Windows Registry with python-registry</title>
		<link>https://blog.mandiant.com/archives/1827?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=parsing-registry-hives-python</link>
		<comments>https://blog.mandiant.com/archives/1827#comments</comments>
		<pubDate>Wed, 20 Jul 2011 23:05:35 +0000</pubDate>
		<dc:creator>William Ballenthin</dc:creator>
				<category><![CDATA[The Lab]]></category>
		<category><![CDATA[forensics]]></category>
		<category><![CDATA[incident response]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[registry]]></category>

		<guid isPermaLink="false">https://blog.mandiant.com/?p=1827</guid>
		<description><![CDATA[<p>Recently, I wanted to dig deep into a forensic artifact resident in the Windows Registry.  To make the task more interesting, I challenged myself to use only tools native to my favorite operating system: Linux.  I was quickly disappointed, however, as there are few open and cross-platform tools for Windows Registry forensics beyond Perl&#8217;s Win32::Registry. <a href="https://blog.mandiant.com/archives/1827" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>Recently, I wanted to dig deep into a forensic artifact resident in the Windows Registry.  To make the task more interesting, I challenged myself to use only tools native to my favorite operating system: Linux.  I was quickly disappointed, however, as there are few open and cross-platform tools for Windows Registry forensics beyond Perl&#8217;s Win32::Registry.  So, I wrote a tool to fill this void using Python – my favorite programming language.  <a href="http://www.williballenthin.com/registry/" target="_blank">Python-registry</a> is the result of this effort, and provides convenient access to Windows Registry files.  Since it is pure Python, it can be used on all major operating systems.</p>
<p><strong>Background</strong></p>
<p>The Windows Registry file format consists of a set of allocation units, known as HBIN blocks.  Each block is subdivided into cells, which form the basic unit of content in the format.  Although cells may contain pure binary data, many cells are used solely for metadata storage.  These include: nk-records (nodes in the tree-like structure of the Windows Registry), lf-records (point to children of a node), and vk-records (describe a single Registry value).  Python-registry exposes a set of classes in the <a href="http://www.williballenthin.com/registry/doc/Registry.RegistryParse.html" target="_blank">RegistryParse module</a> that parse and read these low-level structures.  One RegistryParse class maps to each structure, and each exposes a set of convenient methods for accessing metadata and other referenced structures.</p>
<p>For example, once a Windows Registry file has been loaded by python-registry, you can select an HBIN block, and iterate through each cell.  The following code listing shows how you can identify free cells, which may be extracted so you can search for deleted Registry keys.<br />
<font size="3">
<pre>f = open("NTUSER.DAT")
buf = f.read()
regf = RegistryParse.REGFBlock(buf, 0, false) 

for HBIN in regf.hbins():
    for cell in HBIN.cells():
        if cell.is_free():
            print "Unallocated cell at offset 0x%x" % (cell.offset())</pre>
<p></font><br />
There are few libraries in the wild that parse Windows Registry files and many fewer still that encourage interaction with the underlying structure.  Enterprising forensicators should recognize the opportunity for using python-registry to enable future research in Registry key recovery.</p>
<p>In addition to low-level parsing classes, python-registry provides a high-level interface similar to those exposed by the Microsoft Windows API.  The <a href="http://www.williballenthin.com/registry/doc/Registry.Registry.html" target="_blank">Registry module</a> abstraction layer removes from the user details about allocation units and records and provides familiar sounding RegistryKey and RegistryValue classes.  Once a Windows Registry file has been loaded, instances of the RegistryKey class are organized into a tree structure, and may be associated with a list of RegistryValues.  This tree mirrors the structure you would see if you were to explore the corresponding Windows Registry with RegEdit.</p>
<p><strong>Forensics with python-registry</strong></p>
<p>Similar to Harlan Carvey&#8217;s <a href="http://regripper.wordpress.com/" target="_blank">RegRipper</a>, python-registry is particularly suited for forensic analysis.  Python-registry works directly with Registry hive files &#8212; not the live hives &#8212; so it can easily be used on a forensic workstation after an acquisition.</p>
<p>Recently, I used python-registry to help identify compromised servers during an incident response from Mandiant&#8217;s New York City office.  I suspected a system was infected with malware based on remote login events found on another system and wanted to do a deeper dive.  I used <a href="http://www.mandiant.com/products/core/intelligent_response" target="_blank">Mandiant Intelligent Response</a>® (MIR) to acquire the Registry hive files, including C:\WINDOWS\system32\config\software, from the remote system and downloaded them to my Linux laptop.</p>
<p>Next, I wrote the following ten-line Python script using python-registry to print out each key and its last modified date, while filtering on a suspicious time window.<br />
<font size="3">
<pre>from Registry import Registry

def rec(key):
    if MIN_DATE &lt; key.timestamp() &lt; MAX_DATE:
        print "%s    %s" % (key.timestamp(), key.path())
    for subkey in key.subkeys():
        rec(subkey)

f = open("software", "rb")
r = Registry.Registry(f)
rec(r.root())</pre>
<p></font><br />
Immediately an entry with the path &#8220;$$$PROTO.HIV\Microsoft\Windows\CurrentVersion\Run&#8221; caught my eye.  What was changed during the time window?</p>
<p>The python-registry package contains a set of tools that have been built using python-registry to demonstrate its usage and are contained in the samples directory.  The regview.py GUI tool (similar to RegEdit.exe) can be used to explore the &#8220;Run&#8221; key as seen in the following figure.</p>
<p><a href="https://blog.mandiant.com/wp-content/ammo/RegistryFileViewer.png"><img class="aligncenter size-large wp-image-1826" src="https://blog.mandiant.com/wp-content/ammo/RegistryFileViewer-300x211.png" alt="Registry File Viewer" width="300" height="211" /></a></p>
<p>A malicious entry showed that an attacker had gained persistence by adding his malware to execute on startup.  The system was definitely compromised.  I continued the Registry analysis with a few more experimental scripts I had been developing, including a shellbag parser, and the client was happy.</p>
<p>Python-registry is effective because it is flexible and intuitive.  The package is a library that is easily integrated into both one-off scripts and larger projects.  For example, I&#8217;ve found that using python-registry with an interactive Python console (like IPython) is an effective environment for rapid triage and analysis.  Python-registry converts Registry values into native data types, which makes manipulation of data familiar to a Python programmer.  This means it is easy to pass the output of a python-registry method call to a decoding function developed elsewhere.</p>
<p><strong>Using the library</strong><br />
Let’s explore how you can easily make use of this library.  You can recurse across all RegistryKeys and perform an action as seen in the following code snippet.  This utility encapsulates this logic by applying a function to each RegistryKey.<br />
<font size="3">
<pre>def rec(key, f):
    """
    Recurses across all RegistryKeys and applies the function f.

    key : A Registry.RegistryKey
    f : A function taking one argument, a Registry.RegistryKey
    returns : None
    """
    f(key)
    for subkey in key.subkeys():
        rec(subkey, f)</pre>
<p></font><br />
Metadata about a particular RegistryKey can be accessed through the methods .name(), .path(), and .timestamp().  RegistryKey.subkeys() returns a list of child RegistryKey objects that are lazily parsed.  By lazily parsing the file, python-registry reduces memory consumption and minimizes initial load time. The following code listing shows how to print out all Registry key paths.<br />
<font size="3">
<pre>from Registry import Registry

def print_key(key):
    """
    Print the path of a RegistryKey.

    key : A Registry.RegistryKey
    returns : None
    """
    print key.path()

f = open("NTUSER.DAT", "rb")
reg = Registry.Registry(f)
rec(reg.root(), print_key)</pre>
<p></font><br />
In python-registry, a Registry file is initially loaded by constructing a Registry object.  The .root() method returns the root RegistryKey, and serves as the starting point for most functions.  Alternatively, a script may use the .open() method to attempt to open a RegistryKey by path.</p>
<p>I could have used a modified version of the print_key() function in the earlier example to identify the malicious &#8220;Run&#8221; key; however, a slightly more interesting application might be to print out all Registry values of string type that contain given string.  In the following code listing, we iterate over the RegistryValues associated with each RegistryKey while filtering out non-string values.  We apply the find_microsoft() function to each RegistryKey using our recursive utility rec(), and it prints out the RegistryValue hits.<br />
<font size="3">
<pre>def find_microsoft(key):
    """
    Prints Registry keys whose values contain the string “microsoft”.

    key : A Registry.RegistryKey
    returns : None
    """
    for value in [v.value() for v in key.values()
                                  if v.value_type() == Registry.RegSZ
                                  or v.value_type() == Registry.RegExpandSZ]:
        if "microsoft" in value:
            print key.path()

rec(reg.root(), find_microsoft)</pre>
<p></font><br />
The .values() method of a RegistryKey returns a list of RegistryValues associated with the key.  RegistryValues are a conceptually a tuple of (name, type, data), which map to the methods .name(), .value_type(), and .data().  The type of a RegistryValue is represented by an integer ranging from 0&#215;0 to 0xB and may mean something like &#8220;string&#8221;, &#8220;binary&#8221;, or &#8220;dword&#8221;.  Fortunately, python-registry provides a set of constants, like Registry.RegSZ, Registry.RegBin, and Registry.RegDWord, to improve readability.  When the data is requested from the RegistryValue using the .data() method, it is first converted into the native Python datatype.  For example, strings are converted from ASCII or Unicode into native strings, and numeric types into integers.</p>
<p><strong>Documentation</strong></p>
<p>Live documentation for python-registry can be found <a href="http://www.williballenthin.com/registry/doc/Registry.html" target="_blank">here</a>.  Most classes and methods have been documented; however, for the few that have not, the source code is written to be self-documenting.  Python-registry is released under the Apache 2 license, so all users should feel encouraged to browse basic structure of the source.  I hope that clear and accessible source code that implements the Windows Registry file format can serve to be a central repository for knowledge regarding the format.</p>
<p><strong>Conclusion</strong></p>
<p>Python-registry is a package written for those who enjoy Python and Windows Registry forensics, and potentially platforms other than Microsoft Windows.  It implements each of the lower level structures, yet also presents a high-level interface that encourages both one-off scripts and substantial processing.  Since python-registry is released under the Apache 2 license, all are encouraged to examine and patch the source code.  The homepage for python-registry is found <a href="http://www.williballenthin.com/registry/index.html">here</a>, and the latest source can be downloaded from GitHub <a href="https://github.com/williballenthin/python-registry" target="_blank">here</a>.</p>
<p><strong>Acknowledgements</strong></p>
<ul>
<li>&#8220;WinReg.txt&#8221; by B.D. found at  http://pogostick.net/~pnh/ntpasswd/WinReg.txt</li>
<li>&#8220;The Windows NT Registry File Format&#8221; by Timothy Morgan found at http://www.sentinelchicken.com/research/registry_format</li>
<li>&#8220;The Internal Structure of the Windows Registry&#8221; by Peter Morris found at http://amnesia.gtisc.gatech.edu/~moyix/suzibandit.ltd.uk/MSc/</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>https://blog.mandiant.com/archives/1827/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SANS WhatWorks Summit in Forensics and Incident Response</title>
		<link>https://blog.mandiant.com/archives/390?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sans-whatworks-summit-in-forensics-and-incident-response</link>
		<comments>https://blog.mandiant.com/archives/390#comments</comments>
		<pubDate>Mon, 01 Jun 2009 21:28:42 +0000</pubDate>
		<dc:creator>Jamie Butler</dc:creator>
				<category><![CDATA[The Whiteboard]]></category>
		<category><![CDATA[DailyDave]]></category>
		<category><![CDATA[Find Evil]]></category>
		<category><![CDATA[forensics]]></category>
		<category><![CDATA[incident response]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[SANS]]></category>

		<guid isPermaLink="false">http://blog.mandiant.com/?p=390</guid>
		<description><![CDATA[<p>The <a href="http://www.sans.org/forensics09_summit/?utm_source=web&#38;utm_medium=text-ad&#38;utm_content=FE_Links_Homepage_forensics09_fe_list_hmpge&#38;utm_campaign=SANS_WhatWorks_Summit_in_Forensics_and_Incident_Response&#38;ref=42569">SANS WhatWorks Summit</a> is quickly approaching, and I am excited to attend for the first time this year. Peter Silberman and I will be presenting on memory forensics. There has been some recent public debate about the usefulness of memory forensics. <a href="https://blog.mandiant.com/archives/390" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.sans.org/forensics09_summit/?utm_source=web&amp;utm_medium=text-ad&amp;utm_content=FE_Links_Homepage_forensics09_fe_list_hmpge&amp;utm_campaign=SANS_WhatWorks_Summit_in_Forensics_and_Incident_Response&amp;ref=42569">SANS WhatWorks Summit</a> is quickly approaching, and I am excited to attend for the first time this year. Peter Silberman and I will be presenting on memory forensics. There has been some recent public debate about the usefulness of memory forensics. You can read some of my thoughts on particular issues at <a href="http://lists.immunitysec.com/pipermail/dailydave/2009-May/005745.html">DailyDave</a>. While we will not have time in 40 minutes to dive into the finer points of this argument, I believe we have some pretty compelling use cases. You can be the judge. Of course, if you want to stick around after the talk, Peter and I will be happy to engage in the discourse.</p>
<p> </p>
<p>I look forward to seeing everyone at the conference. Rob Lee has put together what I believe everyone will find is an informative show. Do not forget to catch Kris Harms&#8217; talk and see if you can find evil or not.</p>
<p> </p>
<p><strong>Speakers:</strong> <a href="http://www.sans.org/forensics09_summit/speakers.php#butler">Jamie Butler</a> and <a href="http://www.sans.org/forensics09_summit/speakers.php#silberman">Peter Silberman</a><br />
<strong>Date:</strong> Tuesday, July 7, 3:10pm &#8211; 3:50pm<br />
<strong>Title:</strong> Memory Forensics and Analysis</p>
<p>The memory in today&#8217;s business desktops is now larger than the hard drives that were in systems just a few years ago. Traditionally, forensic analysis has meant taking an image of the hard drive and sifting through files. This is only half of the story and can no longer be considered sufficient. Attackers are writing less to disk and hiding more in the ample memory users now enjoy. Memory analysis &#8211; once a niche function performed by only the most advanced forensic investigators &#8211; is now mainstream and common in professional investigations. Tools have been written to make memory analysis as easy for the investigator if not easier than hard drive analysis and in a fraction of the time. In this talk, we will show you how to quickly identify suspicious things in memory without having to be a reverse engineer. This talk will feature research, use cases, and real world examples.</p>
<p> </p>
<p> </p>
<p><strong>Speaker:</strong> <a href="http://www.sans.org/forensics09_summit/speakers.php#harms">Kris Harms</a><br />
<strong>Date:</strong> Tuesday, July 7, 9:30am &#8211; 10:30am<br />
<strong>Title:</strong> Evil or Not? Rapid Confirmation of Compromised Hosts Via Live Incident Response</p>
<p>During this presentation, attendees will learn practical, tried, and true methods to review live incident response information. You will obtain the skillful eye required to quickly confirm or dispel if a system is compromised. Recent case data from PCI credit card breaches as well as the Advanced Persistent Threat (APT) will be used as samples. Armed with this knowledge, you will excel as an initial responder to any incident.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.mandiant.com/archives/390/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mandiant Highlighter featured on CyberSpeak podcast</title>
		<link>https://blog.mandiant.com/archives/277?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mandiant-highlighter-featured-on-cyberspeak-podcast</link>
		<comments>https://blog.mandiant.com/archives/277#comments</comments>
		<pubDate>Mon, 09 Mar 2009 17:42:59 +0000</pubDate>
		<dc:creator>Jed Mitten</dc:creator>
				<category><![CDATA[The Armory]]></category>
		<category><![CDATA[forensics]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[highlighter]]></category>
		<category><![CDATA[incident response]]></category>
		<category><![CDATA[log analysis]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://blog.mandiant.com/?p=277</guid>
		<description><![CDATA[<p>Jason Luttgens and I were interviewed by Bret Padres and Ovie Carroll over at the <a title="CyberSpeak Podcast" href="http://cyberspeak.libsyn.com/" target="_blank">CyberSpeak podcast</a> regarding our log analysis tool, <a title="Mandiant Highlighter" href="http://www.mandiant.com/software/highlighter.htm" target="_blank">Highlighter</a>. Take some time to <a title="CyberSpeak podcast 1 MAR 2009" href="http://cdn2.libsyn.com/cyberspeak/CyberSpeak_101_Mar_1_2009.mp3" target="_blank">listen</a> — the interview begins at 18m 10s, though I recommend listening to the whole show because those guys are fun and their content relevant. <a href="https://blog.mandiant.com/archives/277" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>Jason Luttgens and I were interviewed by Bret Padres and Ovie Carroll over at the <a title="CyberSpeak Podcast" href="http://cyberspeak.libsyn.com/" target="_blank">CyberSpeak podcast</a> regarding our log analysis tool, <a title="Mandiant Highlighter" href="http://www.mandiant.com/software/highlighter.htm" target="_blank">Highlighter</a>. Take some time to <a title="CyberSpeak podcast 1 MAR 2009" href="http://cdn2.libsyn.com/cyberspeak/CyberSpeak_101_Mar_1_2009.mp3" target="_blank">listen</a> — the interview begins at 18m 10s, though I recommend listening to the whole show because those guys are fun and their content relevant.</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.mandiant.com/archives/277/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>APT Forensics M-unition Pack</title>
		<link>https://blog.mandiant.com/archives/202?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=apt-forensics-m-unition-pack</link>
		<comments>https://blog.mandiant.com/archives/202#comments</comments>
		<pubDate>Fri, 13 Feb 2009 13:25:44 +0000</pubDate>
		<dc:creator>tk_lane</dc:creator>
				<category><![CDATA[The Armory]]></category>
		<category><![CDATA[Advanced Persistent Threat]]></category>
		<category><![CDATA[APT]]></category>
		<category><![CDATA[DoD CyberCrime]]></category>
		<category><![CDATA[Encase]]></category>
		<category><![CDATA[forensics]]></category>

		<guid isPermaLink="false">http://blog.mandiant.com/?p=202</guid>
		<description><![CDATA[<p> </p>
<p>I recently spoke at the DoD cybercrime conference on Advanced Persistent Threat (APT) forensics.  During the presentation I talked about several ways you can use forensics to answer difficult questions that arise once an APT incident is identified.  Some of these questions are:</p>
<ul>
<li>What was the initial vector?</li> <a href="https://blog.mandiant.com/archives/202" class="read_more">Read the rest</a></ul>]]></description>
			<content:encoded><![CDATA[<p> </p>
<p>I recently spoke at the DoD cybercrime conference on Advanced Persistent Threat (APT) forensics.  During the presentation I talked about several ways you can use forensics to answer difficult questions that arise once an APT incident is identified.  Some of these questions are:</p>
<ul>
<li>What was the initial vector?</li>
</ul>
<ul>
<li>What did the attackers do exactly?</li>
</ul>
<ul>
<li>Was any sensitive data exposed for exfiltrated?</li>
</ul>
<ul>
<li>How do we successfully respond to the incident?</li>
</ul>
<p> </p>
<p>These questions can usually be answered easily if the response team has the right tools and methodology.  This is where the APT M-unition pack will help.  In this package are templates for forensic methodology, EnScripts to help with analysis, and the presentation given at DoD cybercrime. The forensic methodology template can be opened with NoteCase. NoteCase is available at the following link:</p>
<p><a title="NoteCase" href="http://notecase.sourceforge.net/" target="_blank">NoteCase</a></p>
<p> </p>
<p>If anyone has questions on the use of the EnScripts or steps in the methodology feel free to contact me by email at kelcey.tietjen@mandiant.com. The APT M-unition pack can be acquired from below:</p>
<p><a href="http://fred.mandiant.com/APTM-unitionPack.zip">APT M-unition Pack</a></p>
<p> </p>
<p>Kelcey</p>
]]></content:encoded>
			<wfw:commentRss>https://blog.mandiant.com/archives/202/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mandiant Highlighter v1.0</title>
		<link>https://blog.mandiant.com/archives/195?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mandiant-highlighter-v10</link>
		<comments>https://blog.mandiant.com/archives/195#comments</comments>
		<pubDate>Thu, 29 Jan 2009 20:22:48 +0000</pubDate>
		<dc:creator>Jason Luttgens</dc:creator>
				<category><![CDATA[The Armory]]></category>
		<category><![CDATA[forensics]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[highlighter]]></category>
		<category><![CDATA[log review]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://blog.mandiant.com/?p=195</guid>
		<description><![CDATA[<p>I was poring over some Windows event logs about a year ago, looking for a security breach. We had good intel that a breach occurred on this system, just not exactly what or when. I was getting ridiculously frustrated by the number of non-relevant entries I had to mentally process and thought &#8220;there has to be a better way!&#8221;</p>
<p>So I searched the Internet and asked colleagues in search of an application that would allow me to quickly remove lines from a text file. <a href="https://blog.mandiant.com/archives/195" class="read_more">Read the rest</a></p>]]></description>
			<content:encoded><![CDATA[<p>I was poring over some Windows event logs about a year ago, looking for a security breach. We had good intel that a breach occurred on this system, just not exactly what or when. I was getting ridiculously frustrated by the number of non-relevant entries I had to mentally process and thought &#8220;there has to be a better way!&#8221;</p>
<p>So I searched the Internet and asked colleagues in search of an application that would allow me to quickly remove lines from a text file. I wanted to be able to scroll through the file, and as I identified text that was irrelevant, remove lines from the display that contained that text. Sounds simple enough, right? But after searching for about a week, it seemed that no one knew of such a tool. Many suggested using a series of &#8220;grep -v&#8221; commands under Linux or with the Win32 Unix tools. Even though I am an avid command line user and a fan of using grep and Linux, that solution was a bit too clunky and not the sort of streamlined workflow I was looking for. A week more frustrated, I couldn&#8217;t find any app like the one I was searching for, so I decided I would have to make it myself.</p>
<p>Over two days I wrote a very basic C# application using Microsoft Visual Studio Express. The application had a single function &#8211; load a text file into a textbox, let me select text, and remove all lines with that text from being displayed. The original file was never modified, but they weren&#8217;t shown to me.</p>
<p>I used my new tool on a selection of the Windows event logs and immediately saw the benefit; with some files, this technique of removing lines quickly eliminated about 80-90% of the events. This let me focus closely on the remaining events, which allowed me to find evil and solve crime faster than ever!</p>
<p>After a little use I realized that thought it would be cool if I not only removed lines, but also found where certain strings occurred throughout a file. I started with the idea of statistical analysis on the file &#8211; generate information about each word that indicated frequency, distribution, etc. The problem with that is that I couldn&#8217;t come up with any good way to represent the results. After explaining the idea to my Mandiant colleague, Lindsey Lack, he simply said &#8220;I&#8217;m a graphical person. Why don&#8217;t you make a visual representation of the file and display information graphically?&#8221;. GENIUS!</p>
<p>Our idea was to depict the file as a graphic on which we could highlight areas on the graphic that corresponded to a key word or phrase. The depiction would immediately give you a sense for frequency and distribution. So with help from one of Mandiant&#8217;s Intelligent Response developers, Matt Frazier, we created a C# control that displays the file as a graphic. The graphic represents a sort of super zoomed-out version of the file. Lines from the original file are displayed as graphics lines (no text) on the screen. The lines displayed are proportional to the line lengths in the file. So you have a graphic on the screen next to the text box that proportionally represents the entire file. So, back to the Windows event logs.</p>
<div id="attachment_193" class="wp-caption alignnone" style="width: 650px"><img class="size-full wp-image-193" src="http://blog.mandiant.com/wp-content/ammo/highlighter_removal.jpg" alt="Highlighter can hide irrelevant lines" width="640" height="485" /><p class="wp-caption-text">See the line numbers jump in the text window.  Hidden lines are indicated in the overview with grey lines.</p></div>
<p>I opened the log and selected a username in question identified through the previous analysis I did. I right-clicked and selected the new function &#8211; &#8220;Highlight&#8221;. The graphic lit up with small red lines (highlights), indicating each exact location that username appeared in the file. I immediately noticed something odd &#8211; the red highlights appeared in a fairly regular pattern, except around a certain spot, where there were a number of red highlights that just appeared out-of-place in comparison to the rest. We made the graphic clickable, so I clicked in that area and the textbox advanced to that portion of the file. The log entries that came up were very late at night &#8211; a time when this user should not have been accessing this system. Further investigation revealed the user&#8217;s account was compromised, malware was installed, and a number of other things happened that day.</p>
<div id="attachment_191" class="wp-caption alignnone" style="width: 650px"><img class="size-full wp-image-191" src="http://blog.mandiant.com/wp-content/ammo/highlighter_sql_injection.jpg" alt="The lines highlighted in the salmon color in the text box correspond with the colored highlights in the overview window" width="640" height="499" /><p class="wp-caption-text">The lines highlighted in the salmon color in the text box correspond with the yellow highlights in the overview window.</p></div>
<p>Evil found. Crimes being solved.</p>
<p><a title="http://www.mandiant.com/software/highlighter.htm" href="http://www.mandiant.com/software/highlighter.htm" target="_blank">http://www.mandiant.com/software/highlighter.htm</a></p>
<p><a title="http://mandiant.invisionzone.com/index.php?showforum=15" href="http://mandiant.invisionzone.com/index.php?showforum=15" target="_blank">http://mandiant.invisionzone.com/index.php?showforum=15</a></p>
]]></content:encoded>
			<wfw:commentRss>https://blog.mandiant.com/archives/195/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

