<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Suraj Singh's information Security Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/sooraj-sec/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/feed.xml</link>
    <description>For people who work on information Security.</description>
    <lastBuildDate>Tue, 16 Apr 2019 06:17:32 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>LogParser and Powershell- LOGPOWER</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/logparser-and-powershell-logpower</link>
      <pubDate>Mon, 20 Feb 2017 17:28:55 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/?p=2275</guid>
      <description><![CDATA[I was going through my last post, where I have shared log parser queries to analyze data using log...]]></description>
      <content:encoded><![CDATA[I was going through my last post, where I have shared log parser queries to analyze data using log parser tool. Good news is ,if you are familiar with power shell then life becomes even more exciting and easy ,so all the  queries I have shown there you can use them with power shell as below

<strong>Pre-requisites</strong> following wont make much sense if you haven't gone through my previous post on <a href="https://blogs.technet.microsoft.com/sooraj-sec/2016/08/20/logparser-play-of-a-forensicator/">logparser</a>, so before you proceed any further, I recommend you to read that post first.

You can see I have a function below, where you can pass input file path along with file name, output file  path and file name where you want to store the output or result. You also pass on the event id as parameter here as well as the logon type. Following example is for event id's 4624 and 4625.

You can build your Log_queries as below  and automate this process. Why following example is only for 4624 and 4625, because you will notice the string field values vary for each event id, so the extract token for other event values may give you different values for different positions within the string field of the event. I have even notice variations in 4624 and 4625 positions in the string field.

Again, following is an example to show case that you can change the Log_query variable as per the event id. I have also given function call example below to explain how you can call this function with different values.

<hr />

<span style="color: #00008b;font-family: Lucida Console;font-size: xx-small">function</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small">log_power</span><span style="font-family: Lucida Console;font-size: xx-small">(</span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$inFilePath</span><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">,</span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$outFilePath</span><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">,</span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$eventid</span><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">,</span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$logontype</span><span style="font-family: Lucida Console;font-size: xx-small">)</span>

{

<span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Log_query</span><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">=</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">@"</span>

<span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype,extract_token(strings,18, '|') as source_ip,extract_token(strings, 11, '|') as computer,Timegenerated as Time INTO </span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$outFilePath</span>

<span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">FROM </span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$inFilePath</span><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"> where EventId = </span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$eventid</span><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"> and extract_token(strings, 8, '|')= '</span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$logontype</span><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">'</span>

<span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">"@</span><span style="font-family: Lucida Console;font-size: xx-small"> </span>

<span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">&amp;</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">C:\Logparser\Logparser.exe</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Log_query</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-i:</span><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small">evt</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-o:</span><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small">csv</span><span style="font-family: Lucida Console;font-size: xx-small"> </span>

}

<span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">log_power</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-inFilePath</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">'drive:\pathofLogs\security.evt'</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-outFilePath</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">'drive:\pathofLogs\outputfile.csv'</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-eventid</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #800080;font-family: Lucida Console;font-size: xx-small">4624</span><span style="font-family: Lucida Console;font-size: xx-small"> </span><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-logontype</span><span style="font-family: Lucida Console;font-size: xx-small"> 3</span>

<hr />

so after you make the function call log parser will put the parsed output at the outfile location. If needed I can add Log_query string for other event ids ,if I see that users are not able to use the Log_query variable with strings field effectively.

In my upcoming posts I will also share few Power shell utilities and tools I have created to ease the work a little bit. Meanwhile play with above if you haven't done this before.

Have fun with this new combination.

Reference : I thought of sharing the string positions for 4625 and 4624 below , which will help in building the queries to get the precise information

<strong>String position information for 4625 event</strong>

<hr />

<table width="392">
<tbody>
<tr>
<td width="90"><strong>String Position</strong></td>
<td width="326"><strong>What it gives us</strong></td>
</tr>
<tr>
<td>3</td>
<td>Account SID</td>
</tr>
<tr>
<td>5</td>
<td>Account</td>
</tr>
<tr>
<td>10</td>
<td>Logon type e.g. 3 for network logon</td>
</tr>
<tr>
<td>11</td>
<td>Security support provider/auth provider e.g . NtLmSsp</td>
</tr>
<tr>
<td>12</td>
<td>Auth Method e.g. NTLM</td>
</tr>
<tr>
<td>18</td>
<td>Process name</td>
</tr>
<tr>
<td>19</td>
<td>Source IP</td>
</tr>
</tbody>
</table>

<hr />

&nbsp;

<strong>String position information for 4624 event</strong>

<hr />

<table width="416">
<tbody>
<tr>
<td width="90"><strong>String Position</strong></td>
<td width="326"><strong>What it gives us</strong></td>
</tr>
<tr>
<td>4</td>
<td>Account SID</td>
</tr>
<tr>
<td>5</td>
<td>Account</td>
</tr>
<tr>
<td>6</td>
<td>Domain</td>
</tr>
<tr>
<td>8</td>
<td>Logon type e.g. 3 for network logon</td>
</tr>
<tr>
<td>10</td>
<td>Auth Method</td>
</tr>
<tr>
<td>11</td>
<td>computer name</td>
</tr>
<tr>
<td>17</td>
<td>Process name</td>
</tr>
<tr>
<td>18</td>
<td>Source IP</td>
</tr>
</tbody>
</table>

<hr />

I will also add String positions for other events either here or in new post.

<strong>String Position for event ID 4648</strong> : event that's generated when explicit credentials are used.

<hr />

<table width="416">
<tbody>
<tr>
<td width="90"><strong>String Position</strong></td>
<td width="326"><strong>What it gives us</strong></td>
</tr>
<tr>
<td>2</td>
<td>base account</td>
</tr>
<tr>
<td>3</td>
<td>base domain</td>
</tr>
<tr>
<td>6</td>
<td>explicit account</td>
</tr>
<tr>
<td>7</td>
<td>explicit domain</td>
</tr>
<tr>
<td>9</td>
<td>target server</td>
</tr>
<tr>
<td>11</td>
<td>Process name</td>
</tr>
</tbody>
</table>]]></content:encoded>
    </item>
    <item>
      <title>Logparser play of a forensicator</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/logparser-play-of-a-forensicator</link>
      <pubDate>Sat, 20 Aug 2016 05:36:31 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/?p=2265</guid>
      <description><![CDATA[My guru, I won't name him, but he knows who he is, told me one day what we do is not exactly...]]></description>
      <content:encoded><![CDATA[My guru, I won't name him, but he knows who he is, told me one day what we do is not exactly forensics, its actually Root Cause Analysis to find out how a security incident happened, so once we know that root cause we can do multiple things from ensuring preventions to mitigations and performing recovery.

Few words about Forensics. Forensics in  true sense, is the domain, in which the evidence collected from crime scene needs to be presented to the court of law. The rules of evidence and chain of custody which are very strict, apply in forensics. In case of IT crimes, evidence is fragile and delicate ,which also includes volatile and non-volatile data or evidence, where data collection is done as per order of volatility, most volatile first. So when a security Incident happens, the processes are used by organization, which insure if organization wants to go to court of law to punish the attackers specially if they are internal. Then these processes needs to be followed to protect evidence and maintain chain of custody, preferably performed by certified and experienced forensic expert . A minor modification in the evidence during the investigation or otherwise will make evidence useless in the court of law ,allowing attackers to go free. That's why rules of forensics are really rigid.

Since we don't work with evidence part so we live in the domain of Root Cause Analysis not Exactly forensics so evidence protection(with all the rigid strict rules) is the main difference between RCA and forensics but these days these terms have been used interchangeably but still we should know the difference.

Which later was confirmed, when i was studying for  CISSP.One of the things my guru encouraged me to play with was a tool that he is perfection on. The tool is Logparser.

Being an inspired student, i started playing with that, like any artist who would like to showcase his little piece of art or share his work or his amazement. I am putting my little compilation, that helps me tracking things as per my needs, when i m digging deeper into files, events and logs.

I have organized them in groups , based on focus, so I have sections focused on logon events, service generation and process creation then i have section that is about playing with file system using NTFSinfo and USNinfo. To keep the size of the article smaller, i m not adding the details about NTFS info and USN info, which are top focus along with other things during forensics or RCA investigations. May be in some other post or follow up post i shall add their details. One more point, I have mentioned CSV(comma separated file) and Datagrid or grid as output. CSV file can be opened using excel for analysis and Datagrid  shows output after logparser has finished the query without help of any text analysis tool in a display format like excel columns and rows.

<strong>Event Log Analysis</strong>

You will notice huge usage of <em>extract_token(strings, n, '|') as fieldname </em>in my log parser queries below, this is one of the most beautiful ,effective and powerful techniques to extract items within string field in the event logs here "n" is number usually location from where you want to extract and "|" is like delimiter used in grep utility along with cut in Linux ,so you can change value of n to get the item you want out of string field in the event log, you will get an idea when you will see examples below.

<strong>                                                    To track Logon success and failure attempts</strong>

&nbsp;

<strong>Successful logons :  list all accounts who logged on successfully</strong>

<hr />

<strong>Output in grid</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624" -o:DataGrid

<strong>Output in CSV</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624" -o:csv &gt;C:\data\exampleDIR\accounts_logon_success.csv

<hr />

&nbsp;

<strong>Failed logon attempts</strong>

<hr />

<strong>Output in grid</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4625" -o:DataGrid

<strong>Output in CSV</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4625" -o:csv &gt;C:\data\exampleDIR\accounts_logon_fail.csv

<hr />

&nbsp;

<strong>logon type-3 : Network logon/Network Access</strong>

<hr />

<strong>Output in grid</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='3'" -o:DataGrid

<strong>Output in CSV</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='3'" -o:csv &gt;C:\data\exampleDIR\accounts_logon_logontype3.csv

<hr />

&nbsp;

<strong>logon type 10 :RDP Access</strong>

<hr />

<strong>Output in grid</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='10'" -o:DataGrid

<strong>Output in CSV</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='10'" -o:csv &gt;C:\data\exampleDIR\accounts_logon_logontype10.csv

<hr />

<strong>logon type- 2 :Interactive i.e. login on the console</strong>

<hr />

<strong>Output in grid</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='2'" -o:DataGrid

<strong>Output in CSV</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='2'" -o:csv &gt;C:\data\exampleDIR\accounts_logon_logontype2.csv

<hr />

&nbsp;

<strong>logon type- 5:  service logon</strong>

<hr />

<strong>Output in grid</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='5'" -o:DataGrid

<strong>Output in CSV</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='5'" -o:csv &gt;C:\data\exampleDIR\accounts_logon_logontype5.csv

<hr />

&nbsp;

<strong>logon type- 3 :  Network logon (Output in grid)</strong>

<hr />

<strong>With authentication method used and source computer</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype,extract_token(strings,10, '|') as auth_method,extract_token(strings, 11, '|') as source_computer FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='3'" -o:DataGrid

<strong>With source_ip used and source computer</strong>

logparser -i:evt "SELECT distinct extract_token(strings, 5, '|') AS account,extract_token(strings, 8, '|') AS logontype,extract_token(strings,18, '|') as source_ip,extract_token(strings, 11, '|') as computer FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 and extract_token(strings, 8, '|')='3'" -o:DataGrid

<hr />

&nbsp;

<strong>No of logon attempts per account</strong>

<hr />

LogParser.exe -i:evt -o:datagrid "SELECT distinct extract_token(strings, 5, '|') AS account, COUNT(*) AS hits FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 GROUP BY account ORDER BY hits"

LogParser.exe -i:evt -o:datagrid "SELECT distinct extract_token(strings, 5, '|') AS account, COUNT(*) AS hits FROM 'C:\data\exampleDIR\security.evt' WHERE EventID = 4624 GROUP BY account ORDER BY hits"

<hr />

&nbsp;

<strong>                                                                   Service generated</strong>

<hr />

LogParser.exe -i:evt -o:datagrid "SELECT Timegenerated,extract_token(strings, 0, '|') AS service, extract_token(strings, 1, '|') AS exe FROM 'C:\data\exampleDIR\system.evt' WHERE <strong>eventid=7045</strong>"

<strong>   Between a time range, when you target a time line.</strong>

LogParser.exe -i:evt -o:datagrid "SELECT Timegenerated,extract_token(strings, 0, '|') AS service, extract_token(strings, 1, '|') AS exe FROM 'C:\data\exampleDIR\system.evt' WHERE eventid=7045 and Timegenerated &gt;'2016-06-09 09:30:00' and Timegenerated &lt;'2016-06-09 20:30:00' "

<hr />

&nbsp;

<strong>                                                                    Process Creation</strong>

<hr />

LogParser.exe -i:evt -o:datagrid "SELECT distinct extract_token(strings, 5, '|') AS exe, COUNT(*) AS hits FROM 'C:\data\exampleDIR\security.evt' WHERE <strong>EventID = 4688</strong> GROUP BY exe ORDER BY hits"

<strong>Within Time range</strong>

LogParser.exe -i:evt -o:datagrid "SELECT distinct extract_token(strings, 5, '|') AS exe, COUNT(*) AS hits FROM 'C:\data\exampleDIR\security.evt' WHERE <strong>EventID = 4688 </strong>and Timegenerated &gt;'2016-06-09 09:30:00' and Timegenerated &lt;'2016-06-09 20:30:00' GROUP BY exe ORDER BY hits"

<hr />

&nbsp;

<strong>File Activity analysis</strong>

<hr />

NTFS info and USNinfo are used to dig into file activities e.g. when a file landed on the machine, when changes to a certain files are made, when certain files were deleted , there is a fine document on SANS about file access, creation ,modification, modification of MFT data .MACE or MACB reference  <a href="https://www.sans.org/reading-room/whitepapers/forensics/filesystem-timestamps-tick-36842">https://www.sans.org/reading-room/whitepapers/forensics/filesystem-timestamps-tick-36842</a>

<strong>                                                                      NTFS info</strong>

<hr />

<a href="https://www.sans.org/reading-room/whitepapers/forensics/filesystem-timestamps-tick-36842"> </a>

<strong>Based on filenamecreationDate</strong>

Logparser.exe -i:csv -o:datagrid "SELECT Filename AS Source, ParentName, File, FileNameCreationDate, LastModificationDate FROM 'C:\data\exampleDIR\ntfsinfo*.csv' WHERE (FileNameCreationDate &gt;= TO_TIMESTAMP('2016-04-22 01:00:00', 'yyyy-MM-dd HH:mm:ss') AND FileNameCreationDate &lt; TO_TIMESTAMP('2016-04-22 02:00:00', 'yyyy-MM-dd HH:mm:ss'))

<strong>Based on filenamecreationDate and lastmodificationdate</strong>

Logparser.exe -i:csv -o:datagrid "SELECT Filename AS Source, ParentName, File, FileNameCreationDate, LastModificationDate FROM 'C:\data\exampleDIR\ntfsinfo*.csv' WHERE (FileNameCreationDate &gt;= TO_TIMESTAMP('2016-04-22 01:00:00', 'yyyy-MM-dd HH:mm:ss') AND FileNameCreationDate &lt; TO_TIMESTAMP('2016-04-22 02:00:00', 'yyyy-MM-dd HH:mm:ss')) OR (LastModificationDate &gt;= TO_TIMESTAMP('2016-04-22 01:00:00', 'yyyy-MM-dd HH:mm:ss') AND LastModificationDate &lt; TO_TIMESTAMP('2016-04-22 02:00:00', 'yyyy-MM-dd HH:mm:ss'))"

<strong>File search </strong>

Logparser.exe -i:csv -o:datagrid "SELECT Filename AS Source, ParentName, File, FileNameCreationDate, LastModificationDate FROM 'C:\data\exampleDIR\ntfsinfo*.csv' WHERE (ParentName Like '%malwarefileoranyfile%')"

Or

Logparser.exe -i:csv -o:datagrid "SELECT Filename AS Source, ParentName, File, FileNameCreationDate, LastModificationDate FROM 'C:\data\exampleDIR\ntfsinfo*.csv' WHERE (File Like '%malwarefileoranyfile%')"

Or

<strong>If you want to know if psexec was on that machine </strong>

Logparser.exe -i:csv -o:datagrid "SELECT Filename AS Source, ParentName, File, FileNameCreationDate, LastModificationDate FROM 'C:\data\exampleDIR\ntfsinfo*.csv' WHERE (File Like '%psexec%')"

<hr />

&nbsp;

<strong>                                           USN Info(refer: https://en.wikipedia.org/wiki/USN_Journal)</strong>

<hr />

<strong>To see if certain files were deleted, various things can be tried in the conditions e.g. full path of location where you want to see deleted files</strong>

<strong>Output in grid</strong>

LogParser "SELECT * FROM 'C:\data\exampleDIR\usninfo*.csv' where (Reason LIKE '%create%') and (FullPath LIKE '%malwarefileoranyfile%')" -o:datagrid

<strong>Output in CSV</strong>

LogParser "SELECT * FROM 'C:\data\exampleDIR\USNInfo_C_.csv' where (Reason LIKE '%delete%')" &gt;deleted_files.csv

<hr />

Hope you guys in field of forensics or Security Incident response RCA enjoy it and please add your tricks and suggestions in comments section. this could be an open live document if you like. Thanks for reading ..]]></content:encoded>
    </item>
    <item>
      <title>Event based network trace collection-using powershell</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/event-based-network-trace-collection-using-powershell</link>
      <pubDate>Wed, 08 Jun 2016 16:24:19 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/?p=2255</guid>
      <description><![CDATA[This  post is like new version of my old post 

In this example I m using event id 1502 that gets...]]></description>
      <content:encoded><![CDATA[This  post is like new version of my old <a href="https://blogs.technet.microsoft.com/sooraj-sec/2011/12/23/using-eventmon-and-nmcap-to-take-network-monitor-trace-when-a-particular-event-is-generated/">post </a>

In this example I m using event id 1502 that gets generated when gpupdate completes successfully. This is an event you can generate on a domain joined machine by running gpupdate /force . so to test that's what I do. In sequential order, the powershell script and batch file are copied in my netmon installation folder in program files in my test lab. I first clean any pre-existing 1502 event from my system event log to test my script. Then I run  following power shell command. then I run my batch file, which basically starts network captures , which will stop the moment it sees ping frame of 4.3.2.1. Powershell script is looking for event from today's date onwards for source event type <span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">"Microsoft-Windows-GroupPolicy"</span>  and event 1502. So if that event occurs, it will send ping as in <span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Cmdone</span> <span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">=</span></span></span> <span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">"Test-Connection 4.3.2.1"</span></span></span>

which is a fake IP address and that's what my batch file is waiting for to stop the network traces. end result is that you have network trace just at the moment of event.

Power shell script that will look for event is below

______Copy from below and save it as stopnmcap.ps1 on a particular location on your system_____________________________________________

<span style="color: #006400;font-family: Lucida Console;font-size: xx-small"># Flag to control while loop </span>

<span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Flag</span></span></span> <span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">=</span></span></span> <span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small">1</span></span></span>

# to stop the Netmon

<span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Cmdone</span></span></span> <span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">=</span></span></span> <span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">"Test-Connection 4.3.2.1"</span></span></span>

"Press Ctrl+C anytime to stop this script"

"Started Monitoring the event"

do

{

<span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$checkevent</span></span></span> <span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">=</span></span></span> <span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">Get-EventLog</span></span></span> <span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-LogName</span></span></span> <span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small"><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small"><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small">System</span></span></span> <span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-EntryType</span></span></span> <span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small"><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small"><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small">Information</span></span></span> <span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-After</span></span></span> <span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small"><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small"><span style="color: #8a2be2;font-family: Lucida Console;font-size: xx-small">08/6/2016</span></span></span> <span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-Source</span></span></span> <span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">"Microsoft-Windows-GroupPolicy"</span></span></span> <span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">|</span></span></span> <span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">Where-Object</span></span></span><span style="font-family: Lucida Console;font-size: xx-small"><span style="font-family: Lucida Console;font-size: xx-small"> {</span></span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$_</span></span></span><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">.</span></span></span><span style="font-family: Lucida Console;font-size: xx-small"><span style="font-family: Lucida Console;font-size: xx-small">EventID </span></span><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">-eq</span></span></span> <span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small">1502</span></span></span><span style="font-family: Lucida Console;font-size: xx-small"><span style="font-family: Lucida Console;font-size: xx-small">}</span></span>

<span style="color: #00008b;font-family: Lucida Console;font-size: xx-small"><span style="color: #00008b;font-family: Lucida Console;font-size: xx-small"><span style="color: #00008b;font-family: Lucida Console;font-size: xx-small">if</span></span></span><span style="font-family: Lucida Console;font-size: xx-small"><span style="font-family: Lucida Console;font-size: xx-small">(</span></span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$checkevent</span></span></span><span style="font-family: Lucida Console;font-size: xx-small"><span style="font-family: Lucida Console;font-size: xx-small">)</span></span>

{

<span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">Write-Host</span></span></span> <span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">"got the event, Stopping network trace ...."</span></span></span>

<span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Flag</span> =</span></span></span> <span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small">0</span></span></span>

<span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">Start-Sleep</span></span></span> <span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-s</span></span></span> <span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small">5</span></span></span>

<span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">Invoke-Expression</span></span></span> <span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Cmdone</span></span></span>

}

<span style="color: #00008b;font-family: Lucida Console;font-size: xx-small"><span style="color: #00008b;font-family: Lucida Console;font-size: xx-small"><span style="color: #00008b;font-family: Lucida Console;font-size: xx-small">else</span></span></span>

{

<span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Flag</span> <span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small"><span style="color: #a9a9a9;font-family: Lucida Console;font-size: xx-small">=</span></span></span> <span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small"><span style="color: #800080;font-family: Lucida Console;font-size: xx-small">1</span></span></span>

<span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">Write-Host</span></span></span> <span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small"><span style="color: #8b0000;font-family: Lucida Console;font-size: xx-small">"no events yet but keep looking"</span></span></span>

}

<span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small"><span style="color: #0000ff;font-family: Lucida Console;font-size: xx-small">Start-Sleep</span></span></span> <span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small"><span style="color: #000080;font-family: Lucida Console;font-size: xx-small">-s 10</span></span></span>

<span style="font-family: Lucida Console;font-size: xx-small"><span style="font-family: Lucida Console;font-size: xx-small">}</span></span><span style="color: #00008b;font-family: Lucida Console;font-size: xx-small"><span style="color: #00008b;font-family: Lucida Console;font-size: xx-small"><span style="color: #00008b;font-family: Lucida Console;font-size: xx-small">while</span></span></span><span style="font-family: Lucida Console;font-size: xx-small"><span style="font-family: Lucida Console;font-size: xx-small">(</span></span><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small"><span style="color: #ff4500;font-family: Lucida Console;font-size: xx-small">$Flag</span></span></span></span><span style="font-family: Lucida Console;font-size: xx-small"><span style="font-family: Lucida Console;font-size: xx-small">)</span></span>

"Press any key to stop"

&nbsp;

--------------------------------------------------------------------------------------------------------------------------------------------------------------------

Batch file to start the nmcap to capture the network traces.

****************copy from below and save it as nmtrace.bat**************************************************************************

@echo off

REM Following line is wrapped
start cmd.exe /c nmcap /network * /capture /file %1 /stopwhen /frame "ipv4.DestinationAddress==4.3.2.1" /DisableConversations

***********************************************************************************************************************************]]></content:encoded>
    </item>
    <item>
      <title>When malware spreads on the network, panic ,magic vs  calmness ,sanity</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/when-malware-spreads-on-the-network-panic-magic-vs-calmness-sanity</link>
      <pubDate>Thu, 07 Apr 2016 05:11:00 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/2016/04/07/when-malware-spreads-on-the-network-panic-magic-vs-calmness-sanity/</guid>
      <description><![CDATA[I love to talk about things&nbsp;that amaze me, this one is also one of the interesting ones....]]></description>
      <content:encoded><![CDATA[<p>I love to talk about things&nbsp;that amaze me, this one is also one of the interesting ones. However, I will quickly come to the point.So there was a situation, where a network admin was in a real panic state. He was seeing a very weird behaviour on few machines on the network. He was using SCEP which was detecting the malware as <a href="https://www.microsoft.com/security/portal/threat/encyclopedia/entry.aspx?Name=Trojan:Win32/CoinMiner">coinminer</a> but as soon as it was getting detected,the infected files were coming back on it. So admin&#39;s statement to that was &quot;it appears SCEP is not detecting or not able to clean it&quot; .&nbsp;</p>
<p>After looking at this behaviour,&nbsp;I pulled my favourite tools, one of them does not need any installation &quot;netstat -ano&quot;, that gave me all the incoming SMB(TCP 445) connections to this machine and obviously&nbsp;source machines as well. After&nbsp;I saw that ,&nbsp;I used tool called network monitor( netmon 3.4 ) . I filtered the traffic for SMB traffic and could clearly see the&nbsp;IP address, that&nbsp;I saw in netstat -ano output sending SMB traffic&nbsp;,trying to create infection file in users profile folders.&nbsp;Earlier ,these&nbsp;were same locations admin was showing me, where infection was coming back again after removal.</p>
<p>So&nbsp;I suggested them to take me to the machine ,which was sending this SMB traffic and trying to create these files. When we went there, we found SCEP was disabled. They had a group policy that disabled it, obviously it was not detecting and cleaning since it was not running at all. So I again used network monitor on this machine, to analyse the behaviour of this machine. I ran following filter in netmon where filename.exe is the exe file, this malware was trying to create on the target machine. Here path is usual path this malware was trying to create these files on target machine.</p>
<p>SMB2.CCreate.Name == &quot;ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\filename.exe&quot;</p>
<p>The output of this in network monitor gave me list of other machines, this malware was trying to infect from this machine, it was a huge list of machines. Admin used that list to check the status of SCEP on those machines and if they are detecting and cleaning on those machines. Meanwhile they also got this machine out of those GPOs which disabled SCEP on it.</p>
<p>So if SCEP was running as usual on this HUB of malware :), this issue would not have occurred at all.</p>
<p>Even if we are seeing this behaviour where AV is cleaning the malware and its coming right back. Its not the magical malware or some super malware, which will come right back after it got cleaned. If its coming back like this, obviously source is on the network. We have network protocols , which do certain things for us on the network. There are not too many protocols that do file access or share access on the network. In windows networks, we have SMB protocol for share and file access. Malware writers do not invent any new protocols, they use these existing&nbsp;protocols, to create files over the network on other machines,to spread infections on the network.</p>
<p>In one scenario, admin was looking for containment method, while he gets his infected machines cleaned using AV.&nbsp;In&nbsp;his scenario,I saw same method of file creation. one of the short term containment idea, that&nbsp;I gave them&nbsp;was to stop inbound SMB traffic, on these infected machines using windows firewall,using netsh command</p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">&quot;netsh advfirewall firewall add rule name =&quot;block445in&quot; protocol=TCP dir=in localport=445 action=block&quot;</span></p>
<p></p>
<p>SMB may be required for GPO( to get RSOP reports) ,so you may want to revert this after you get back to normal ,but you can stop the spread using this idea.</p>
<p>I had another admin, who wanted to disable the NIC when their AV detects a malware(sounds paranoid,&nbsp;I know) ,&nbsp;technically you can do that but it has challenges :)</p>
<p>Technique is simple ,&nbsp;I have written a blog post sometime back to do few things based on event id<span style="font-family:Calibri;font-size:medium;"> : </span><a href="https://na01.safelinks.protection.outlook.com/?url=http%3a%2f%2fblogs.technet.com%2fb%2fsooraj-sec%2farchive%2f2013%2f05%2f03%2fgenerating-netstat-output-when-a-specific-event-occurs-in-the-eventlog-using-powershell.aspx&amp;data=01%7c01%7csuras%40064d.mgd.microsoft.com%7c8b0a56418809440acee008d35c77afd5%7c72f988bf86f141af91ab2d7cd011db47%7c1&amp;sdata=gPFx%2bYBe2PzGIiD4OejQtBK7ooCdMrRhSKqJqSXInMg%3d"><span style="color:#0563c1;font-family:Calibri;font-size:medium;">http://blogs.technet.com/b/sooraj-sec/archive/2013/05/03/generating-netstat-output-when-a-specific-event-occurs-in-the-eventlog-using-powershell.aspx</span></a></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">Get the VBS file as below</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p><strong>Step1</strong> :<span style="font-family:&#39;Calibri&#39;,&#39;sans-serif&#39;;font-size:11pt;"><strong>Copy the contents of the script given in above post shown below in a notepad and save it as EvtMon.vbs</strong> and put this in a folder lets call it&nbsp;yourfolder&nbsp;e.g. in c:\<span style="font-family:Calibri;font-size:medium;">yourfolder </span> location</span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin-left:60px;"><span class="rem">&#39;======================================================================</span><br /><span class="rem">&#39; Print out the help when something is not typed in correctly or when </span><br /><span class="rem">&#39; nothing at all is typed in.</span><br /><br /><span class="kwrd">Public</span> <span class="kwrd">Sub</span> PrintHelp<br />&nbsp;&nbsp;&nbsp; Wscript.Echo <span class="str">&quot;Usage:&quot;</span><br />&nbsp;&nbsp;&nbsp; Wscript.Echo <span class="str">&quot;&nbsp; EvtMon EventNumber [LogFileDisplayName]&quot;</span><br />&nbsp;&nbsp;&nbsp; Wscript.Echo <span class="str">&quot;&nbsp;&nbsp;&nbsp; LogFile is optional.&nbsp; If used, the eventlog name&quot;</span><br />&nbsp;&nbsp;&nbsp; Wscript.Echo <span class="str">&quot;&nbsp;&nbsp;&nbsp; file ie, application, system, security, etc...&quot;</span><br /><span class="kwrd">End</span> <span class="kwrd">Sub</span><br /><br /><span class="rem">&#39; Get the arguments.&nbsp; Check for event nubmer and log file as arugments</span><br /><span class="kwrd">Set</span> objArgs = WScript.Arguments<br /><br /><span class="rem">&#39; See how many arguments we have and colect them.</span><br /><span class="kwrd">if</span> objArgs.Count &lt; 1 <span class="kwrd">OR</span> objArgs.Count &gt; 2 <span class="kwrd">Then</span><br />&nbsp;&nbsp;&nbsp; PrintHelp<br /><span class="kwrd">ElseIf</span> objArgs.Count &gt; 1 <span class="kwrd">Then</span><br />&nbsp;&nbsp;&nbsp; EventNumber = objArgs(0)<br />&nbsp;&nbsp;&nbsp; LogFile = objArgs(1)<br /><span class="kwrd">Else</span><br />&nbsp;&nbsp;&nbsp; EventNumber = objArgs(0)<br />&nbsp;&nbsp;&nbsp; LogFile = <span class="str">&quot;&quot;</span><br /><span class="kwrd">End</span> <span class="kwrd">If</span><br /><br /><span class="kwrd">If</span> EventNumber &lt;&gt; <span class="str">&quot;&quot;</span> <span class="kwrd">Then</span><br /><br />&nbsp;&nbsp;&nbsp; strComputer = <span class="str">&quot;.&quot;</span><br /><br />&nbsp;&nbsp;&nbsp; <span class="rem">&#39; Attatch to the WMI Service</span><br />&nbsp;&nbsp;&nbsp; <span class="kwrd">Set</span> objWMIService = GetObject(<span class="str">&quot;winmgmts:{(Security)}\\&quot;</span> &amp; _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strComputer &amp; <span class="str">&quot;\root\cimv2&quot;</span>)<br /><br />&nbsp;&nbsp;&nbsp; <span class="rem">&#39; if the LogFile is populated add this to our query.&nbsp; Create a</span><br />&nbsp;&nbsp;&nbsp; <span class="rem">&#39; Event Log monitoring object and send it a query.</span><br />&nbsp;&nbsp;&nbsp; <span class="kwrd">If</span> LogFile = <span class="str">&quot;&quot;</span> <span class="kwrd">Then</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="kwrd">Set</span> colMonitoredEvents = objWMIService.ExecNotificationQuery _&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (<span class="str">&quot;Select * from __InstanceCreationEvent Where &quot;</span> _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp; <span class="str">&quot;TargetInstance ISA &#39;Win32_NTLogEvent&#39; &quot;</span> _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp; <span class="str">&quot;and TargetInstance.EventCode = &#39;&quot;</span> _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp; EventNumber &amp; <span class="str">&quot;&#39;&quot;</span>)<br />&nbsp;&nbsp;&nbsp; <span class="kwrd">Else</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="kwrd">Set</span> colMonitoredEvents = objWMIService.ExecNotificationQuery _&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (<span class="str">&quot;Select * from __InstanceCreationEvent Where &quot;</span> _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp; <span class="str">&quot;TargetInstance ISA &#39;Win32_NTLogEvent&#39; &quot;</span> _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp; <span class="str">&quot;and TargetInstance.EventCode = &#39;&quot;</span> _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp; EventNumber _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp; <span class="str">&quot;&#39; and TargetInstance.LogFile = &#39;&quot;</span> _<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &amp; LogFile &amp; <span class="str">&quot;&#39;&quot;</span>)<br />&nbsp;&nbsp;&nbsp; <span class="kwrd">End</span> <span class="kwrd">If</span><br /><br />&nbsp;&nbsp;&nbsp; <span class="rem">&#39; Create an object which returns when the next event occurs.</span><br />&nbsp;&nbsp;&nbsp; <span class="kwrd">Set</span> objLatestEvent = colMonitoredEvents.NextEvent<br />&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; <span class="rem">&#39; Print some info based on the event log we encountered.</span><br />&nbsp;&nbsp;&nbsp; Wscript.Echo objLatestEvent.TargetInstance.User<br />&nbsp;&nbsp;&nbsp; Wscript.Echo objLatestEvent.TargetInstance.TimeWritten<br />&nbsp;&nbsp;&nbsp; Wscript.Echo objLatestEvent.TargetInstance.Message<br />&nbsp;&nbsp;&nbsp; WScript.Echo objLatestEvent.TargetInstance.Logfile<br />&nbsp;&nbsp;&nbsp; Wscript.Echo<br /><span class="kwrd">End</span> If</p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p style="margin:0cm 0cm 0pt;"><strong>Step2. Use one of the batch files given below, each has different impact.</strong></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">Following batch&nbsp;file can block in bound and outbound SMB traffic along with above script, you need to give the event id that your AV generates when it detects malware, please see the link I gave above to check the command.</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">======= <span style="font-family:Calibri;font-size:medium;">you can copy it as <span style="font-family:Calibri;">445-instop.bat from below</span></span>=======</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">@echo off</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">cscript //NoLogo EvtMon.vbs %2 %3</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">powershell.exe -command &quot;&amp;&nbsp; netsh advfirewall firewall add rule name =&quot;block445in&quot; protocol=TCP dir=in localport=445 action=block</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">powershell.exe -command &quot;&amp;&nbsp; netsh advfirewall firewall add rule name =&quot;block445out&quot; protocol=TCP dir=out remoteport=445 action=block</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">ping -n 1 4.3.2.1</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">goto :EOF</span></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-family:Calibri;font-size:medium;">=====================================================</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;">&nbsp;</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;">Following batch file along with the vbs script in my blog post can be used to disable NIC for a particular eventid(AV generates for detection).</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;"><span style="font-family:Calibri;">challenge with following is, you need to know the name of the NIC to disable, so its practically its not a feasible&nbsp;option&nbsp;</span></span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:Calibri;font-size:medium;">========<span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;"><span style="font-family:Calibri;">you can copy as </span></span>NIC-disable.bat from below==========</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;">@echo off</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;">cscript //NoLogo EvtMon.vbs %2 %3</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;">powershell.exe -command &quot;&amp;&nbsp; netsh interface set interface &quot;Wi-Fi&quot; admin=disable</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;">ping -n 1 4.3.2.1</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;">goto :EOF</span></p>
<p style="margin:0cm 0cm 12pt;"><span style="font-family:&#39;Times New Roman&#39;,serif;font-size:12pt;">===================================================================================</span></p>
<p></p>
<p>This paranoid approach , to be honest, in my opinion is not very amazing, even with windows firewall and blocking ports, based on event id for malware detection because it will work for malwares, for which your AV has signatures, not for new variants. But if you want it done anyways, you can technically :).</p>
<p>For readers,&nbsp;I would welcome more ways of containment(ISC2&#39;s book on CISSP&nbsp;has given few but if you know things other then that&nbsp;), if you are reading it you can add your methods in the comments.</p>
<p></p>]]></content:encoded>
    </item>
    <item>
      <title>Business need for Security Incident Management</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/business-need-for-security-incident-management</link>
      <pubDate>Sat, 05 Mar 2016 20:03:00 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/2016/03/05/business-need-for-security-incident-management/</guid>
      <description><![CDATA[Its been a while&nbsp;I m here at my blog. Believe me breaks work in amazing ways. This article is...]]></description>
      <content:encoded><![CDATA[<p>Its been a while&nbsp;I m here at my blog. Believe me breaks work in amazing ways. This article is primarily for information security audience. But it wont hurt non-security folks either, as it would make sense to anybody.&nbsp;Many organisation even now don&#39;t have an information security program and obviously do not have security incident program, which usually is a&nbsp;subset of a security program. I wont get into defining , what is a incident and what&#39;s a security incident and what&#39;s the difference between them in order to stay focussed on current topic.</p>
<p><span style="font-size:medium;"><strong>Background</strong></span></p>
<p>As an example, I will discuss a scenario. So one of the organisations had an incident, they thought was a security incident, as suddenly they started seeing pop-ups, authentication prompts on client machines, with different messages. Looking at this weird behaviour, their team that was working on it, thought its a malware attack. That team and their executive management were in extremely panic state.&nbsp;I was engaged on it in later stages of our engagements. After understanding the scenario and problems they were encountering. My first question to them was, what is the Business Impact of this incident? they took some time to answer that question, as probably they did not think it was necessary to think about the business impact of that incident or event. &nbsp;Answer although came little late, was about possibility of unauthorized disclosure.</p>
<p><span style="font-size:medium;"><strong>Investigations</strong></span></p>
<p>Based on that response, I checked &quot;netstat -ano&quot; on one of the problem machines, a client machine. There were not more then few established connections, out of them&nbsp;few were SMB/CIFS connections going to their known file servers, remaining connections were also going to known local machines, which were verified individually. Tcpview tool from sysinternal also provided details of the processes who had initiated those connections , all those processes were also known processes. Previously our engineers had also checked (ASEPs)auto runs, using autorun tool from sysinternal ,nothing suspicious was seen in that. Same was true with process explorer tool when it was run on the same machine earlier, no suspicious processes.&nbsp;Then, I took network captures using netmon 3.4 tool,&nbsp;to check the SMB/CIFS traffic and verify&nbsp;if files are getting created on destination machines or on the local machine, nothing of that sort was seen in traces either.</p>
<p>So&nbsp;from observations so far,&nbsp;there was no evidence of malicious activity on the network from that machine and even&nbsp;locally. They informed us that&nbsp;certain files were getting created after some time, in a particular folder&nbsp; and wanted answer on that occurrence. I suggested them to enable auditing on that folder and we &nbsp;will be able to find out which process&nbsp;of an application is creating those files in that folder. While&nbsp;&nbsp;our AD team&nbsp;helped them in setting up auditing on that problem folder. We ran our famous tool that collects all ,volatile and non-volatile information, along with USN journal info using which we can track activities on files. Data analysis of that, also pointed to one thing, &quot;<strong>No Evidence of Malicious activity</strong>&quot;.</p>
<p>Then answer for creation of files in a particular folder,&nbsp;came from auditing&nbsp;I got implemented by our AD team. It pointed to a misbehaving application creating those files and other weird activities, that were occurring&nbsp;on&nbsp;the machines. It was hard to believe for some ,who thought it was all malicious and it was a security Incident, but in reality it was not. But when&nbsp;we look back from where it started and where it ended. There so many lessons in it to be learned.</p>
<p><span style="font-size:medium;"><strong>Lessons to be learned, point to&nbsp;serious business&nbsp;need of a Security Incident Management Program</strong></span></p>
<p>First impression of this episode, CHAOS and PANIC. This caused guys who were working on it&nbsp;,from that organisation side and their Executive team to go in extreme panic and stressful state whole day. This could have been avoided completely, if they had a Security Incident Management Program in place. You ask me how? There are open standards( ISC2 ), SANS and so many other institutions&nbsp;that talk about&nbsp;security Incident management. At Microsoft, &nbsp;we also have an offering on this ,its called POP SIM(Security Incident Management). I however would talk just about the standard and if our customers get interested in POP SIM, we can have separate discussions with them.</p>
<p>In general, this program allows an organisation to create a framework and policies about how to deal with an&nbsp;security&nbsp;incident&nbsp;. Following diagram explains the usual flow of it, so when incident comes, usually reported by IDS,SEIM,firewall logs, suspicious activity seen by users,admins etc. Its triaged to check, if its truly a security incident, if its false positive then its handled like an usual event(non-security incident).</p>
<p>After initial determination, once its determined that its not a false positive and indeed is a security Incident.&nbsp; It is categorized into predefined incident categories, based on business impact of the incident and as per previously determined security incident management policies. Then as per the policies, its occurrence is communicated to right teams and right people for further handling.</p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/78/28/0118.IR.PNG" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-78-28/0118.IR.PNG"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/78/28/0118.IR.PNG" original-url="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-78-28/0118.IR.PNG" border="0" /></a></p>
<p><em>Note: Diagram, here&nbsp;I have drawn based on inputs from various books on this subject mainly ISC2 and related books and here it is purely for&nbsp;informational and&nbsp;educational&nbsp;purpose.</em></p>
<p>Incident response is mix of steps that happen in series and steps that happen in parallel. At this stage two things happen in parallel, they are :</p>
<p>1. Containment&nbsp;</p>
<p>2. Investigations with initial RCA to reduce the impact.</p>
<p>&nbsp;Objective is(apart from reducing the impact),&nbsp;to stop the spread of incident any further and also to contain the access of attacker, in case its a directed attack without giving hint to them, as this can go horribly wrong ,if not handled delicately and with caution. This is done ,if we want to track the attackers and prosecute them.</p>
<p>Then, in&nbsp;next stage of detailed analysis,&nbsp;more data is collected using various tools and deeper root cause analysis is done to find out who did it, how they did it, how they came in, in case its a directed attack.</p>
<p>But&nbsp;if its just a malware, then how it came, what AV we are using, is it updated to latest, is it able to detect it. If not have we contacted AV vendor for signatures yet?&nbsp;What&#39;s the nature of malware, how it spreads, containment is super important for spread mitigation.</p>
<p>This is a circular process, as based on new evidence, many steps are revisited again.</p>
<p>After RCA and finding root cause of the incident and reducing the impact and containment, Recovery process starts, to bring back affected systems and networks to production.Its also a tricky thing, its a risk based business&nbsp;decision, whether to rebuild a compromised system or just a repair or clean or removal by AV is good enough,decision that&nbsp;an organisation&nbsp;has to take based on their own scenario, how much time ,money effort&nbsp;they are willing to put in this. Recovery it self is a huge topic and would need separate dedicated discussion.</p>
<p>Then incident needs to be closed ,it becomes more important when there are multiple incidents&nbsp;happening, it will be difficult to track progress of them.So based on criteria established in policies&nbsp;,incident shall be closed after it meets that criteria.</p>
<p>Reporting of incident with post-mortem of how,when what,where happened, to engaged and concerned people. From here lessons learnt are used to mend the established security incident policies, to ensure mistakes are not repeated and organisation matures its process further based on this input.</p>
<p><span style="font-size:medium;"><strong>Replaying the Example Incident</strong></span></p>
<p>Lets assume that,&nbsp;there is another organisation, who also have security incident management program in place, when this organisation runs into this same issue, they would perform triaging, with an experienced skilled triaging team, in this step itself they would have filtered this incident as a false positive and would have handled it as a non security incident or event.</p>
<p>In case, if they&nbsp;were paranoid and to be on safer side decided to consider it as a security incident, then in the next stage of categorizing the incident based on the business Impact, they would have effectively categorized it as Severity C. This however requires experienced and skilled team members, this is where, if they don&#39;t have their own they can engage Microsoft or any other trusted third party to help them.</p>
<p>So this organisation following their security incident management program, would have effectively managed the incident without panic ,chaos and resulting extreme stress for people engaged on the incident.</p>
<p><strong>Business and Money</strong></p>
<p>You can clearly imagine, if you don&#39;t have this program, if 10 incidents happen you will&nbsp;manage them with same chaos, panic and extreme stress. End result, you can imagine that too, it costs lot of money to engage resources on each incident. If you spend&nbsp; USD 10,000 on one Incident at minimum (a very low figure in reality), its easy math to know how much you will spend on 10.</p>
<p>But if you do have a Security Incident Management program, Then probably you may spend USD 10,000 on high impact incident and probably USD 500 on an&nbsp;incident that appeared&nbsp; initially as&nbsp;a security incident but after triaging, it&nbsp;was marked as a false positive and sent out to be handled&nbsp;as a non security incident to IT team instead of security team.</p>
<p>It would also save so much of time for people involved which can be utilized in better ways. Obviously, low stress levels and happier lives.</p>]]></content:encoded>
    </item>
    <item>
      <title>Azure forensics-interesting post on MSDN</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/azure-forensics-interesting-post-on-msdn</link>
      <pubDate>Wed, 19 Aug 2015 01:20:39 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/2015/08/19/azure-forensics-interesting-post-on-msdn/</guid>
      <description><![CDATA[sharing an awesome post i read on...]]></description>
      <content:encoded><![CDATA[<p>sharing an awesome post i read on MSDN</p>
<p>http://blogs.msdn.com/b/azuresecurity/archive/2015/08/14/azure-forensics-for-the-security-responder-how-i-learned-to-stop-worrying-and-love-the-cloud.aspx</p>]]></content:encoded>
    </item>
    <item>
      <title>Hack and a thought</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/hack-and-a-thought</link>
      <pubDate>Fri, 14 Aug 2015 12:22:00 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/2015/08/14/hack-and-a-thought/</guid>
      <description><![CDATA[Recently I came across a cute hack to reset windows 7 password, someone shared that to me&nbsp;,...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family:Calibri;">Recently I came across a cute hack to reset windows 7 password, someone shared that to me&nbsp;, saying its cake walk</span></p>
<p><a href="http://www.oxhow.com/reset-windows-7-password-without-password-reset-disk/"><span style="color:#0563c1;font-family:Calibri;">http://www.oxhow.com/reset-windows-7-password-without-password-reset-disk/</span></a></p>
<p><span style="font-family:Calibri;">I looked at it and tested it in lab and was able to change the password as explained in it. Then I also came across the ways to mitigate this for example.</span></p>
<p><span style="font-family:Calibri;">If we execute below command in elevated command prompt(admin command prompt), this will disable launch of repair that is done in the article given</span></p>
<p><span style="font-family:Calibri;">bcdedit /set {default} bootstatuspolicy ignoreallfailures </span></p>
<p><span style="font-family:Calibri;">There are other ways as well. But that&rsquo;s not that important, what&rsquo;s important is(as per me and few others as well) ,that&rsquo;s what I&rsquo;m going to discuss here. </span></p>
<p><span style="font-family:Calibri;">If you already are not aware of &ldquo;Ten immutable laws of security&rdquo; refer <a href="/b/rhalbheer/archive/2011/06/16/ten-immutable-laws-of-security-version-2-0.aspx"><span style="color:#0563c1;">http://blogs.technet.com/b/rhalbheer/archive/2011/06/16/ten-immutable-laws-of-security-version-2-0.aspx</span></a></span></p>
<p><span style="font-family:Calibri;">List is here, so if we look at it, this is hitting law#3</span></p>
<p><span style="font-family:Calibri;">Law #1: If a bad guy can persuade you to run his program on your computer, it&#39;s not solely your computer anymore. <br /> Law #2: If a bad guy can alter the operating system on your computer, it&#39;s not your computer anymore. <br /> <b>Law #3: If a bad guy has unrestricted physical access to your computer, it&#39;s not your computer anymore. </b><br /> Law #4: If you allow a bad guy to run active content in your website, it&#39;s not your website any more. <br /> Law #5: Weak passwords trump strong security. <br /> Law #6: A computer is only as secure as the administrator is trustworthy. <br /> Law #7: Encrypted data is only as secure as its decryption key. <br /> Law #8: An out-of-date antimalware scanner is only marginally better than no scanner at all. <br /> Law #9: Absolute anonymity isn&#39;t practically achievable, online or offline. <br /> Law #10: Technology is not a panacea.</span></p>
<p><span style="font-family:Calibri;">i.e. <b>Law #3: If a bad guy has unrestricted physical access to your computer, it&#39;s not your computer anymore.</b><b> </b>So if you indeed are hitting this law and still think operating system should have a mitigation for it by default, then a rethink on it is required.</span></p>
<p><span style="font-family:Calibri;">I was thinking about a scenario, when this can happen to non-corporate machine e.g. regular user and when can this happen to a corporate user&rsquo;s machines, which are either desktops or laptops.</span></p>
<p><span style="font-family:Calibri;">For non-corporate regular user, this can happen if she loses her laptop. Same is true for a corporate user i.e. if she loses her laptop, so what&rsquo;s the best defense or mitigation regarding this if you are hitting law # 3 .</span></p>
<p><span style="font-family:Calibri;">&nbsp;I would feel safe as both type of user, if my data is not accessible to bad guy. That&rsquo;s only possible with encryption i.e. if user&rsquo;s laptop&rsquo;s drive is encrypted. &nbsp;Microsoft&rsquo;s latest operating systems have a feature called Bitlocker which is a strong, in fact best defense in such scenario. If bad guy does not have the bitlocker key, he can&rsquo;t even get to the starting point that&rsquo;s mention in the blog link of hack. He cannot access data in the drive, its ENCRYPTED </span>J<span style="font-family:Calibri;">. So although user would still lose the data ,if she hits the law #3 and her machine as well but data will not be compromised or disclosed, nobody can see it. </span></p>
<p><span style="font-family:Calibri;">For desktops in enterprise, its little difficult to imagine hitting law # 3 but here again Bitlocker is a super defense, bad guy can&rsquo;t go any farther then the bitlocker key screen </span>J<span style="font-family:Calibri;">.</span></p>
<p><span style="font-family:Calibri;">In information security, confidentiality of data is maintained by ensuring its encrypted at rest and also when it is at move using protocols like SSL , Ipsec. So Encryption is the way forward(its already there, some are using it some are not).</span></p>
<p><span style="font-family:Calibri;">Following are few links about how bitlocker can be enabled, these are few, will add more as and when I ll find more</span></p>
<p><a href="http://windows.microsoft.com/en-in/windows-8/bitlocker-drive-encryption"><span style="color:#0563c1;font-family:Calibri;">http://windows.microsoft.com/en-in/windows-8/bitlocker-drive-encryption</span></a><span style="font-family:Calibri;">, windows 8</span></p>
<p><a href="https://technet.microsoft.com/en-us/library/dd835565(v=ws.10).aspx"><span style="color:#0563c1;font-family:Calibri;">https://technet.microsoft.com/en-us/library/dd835565(v=ws.10).aspx</span></a><span style="font-family:Calibri;"> windows 7</span></p>
<p><a href="https://technet.microsoft.com/en-us/library/dd875547(v=ws.10).aspx"><span style="color:#0563c1;font-family:Calibri;">https://technet.microsoft.com/en-us/library/dd875547(v=ws.10).aspx</span></a></p>
<p><a href="http://windows.microsoft.com/en-IN/windows7/what-group-policy-settings-are-used-with-bitlocker"><span style="color:#0563c1;font-family:Calibri;">http://windows.microsoft.com/en-IN/windows7/what-group-policy-settings-are-used-with-bitlocker</span></a></p>
<p><a href="http://windowsitpro.com/security/deploy-bitlocker-your-organization-right-way"><span style="color:#0563c1;font-family:Calibri;">http://windowsitpro.com/security/deploy-bitlocker-your-organization-right-way</span></a></p>
<p><span style="font-family:Calibri;">&nbsp;</span></p>
<p><span style="font-family:Calibri;">&nbsp;</span></p>
<p></p>]]></content:encoded>
    </item>
    <item>
      <title>Pass the Hash attack -who's problem is it anyway?</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/pass-the-hash-attack-whos-problem-is-it-anyway</link>
      <pubDate>Fri, 15 May 2015 12:18:00 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/2015/05/15/pass-the-hash-attack-whos-problem-is-it-anyway/</guid>
      <description><![CDATA[Introduction
This intro is purely for people who are not from information security and have not...]]></description>
      <content:encoded><![CDATA[<p><strong>Introduction</strong></p>
<p>This intro is purely for people who are not from information security and have not heard of this attack, although that&#39;s&nbsp;rare. So straight from the Microsoft&nbsp; <a href="http://www.microsoft.com/en-in/download/details.aspx?id=36036" target="_blank">pass the hash whitepapers</a>.</p>
<p>&quot;</p>
<p><em>What is the PtH attack? The Pass-the-Hash (PtH) attack and other credential theft and reuse types of attack use an iterative two stage process. First, an attacker must obtains local administrative access on at least one computer.. Second, the attacker attempts to increase access to other computers on the network by: </em></p>
<p><em>1. Stealing one or more authentication credentials (user name and password or password hash belonging to other accounts) from the compromised computer. </em></p>
<p><em>2. Reusing the stolen credentials to access other computer systems and services. This sequence is often repeated multiple times during an actual attack to progressively increase the level of access that an attacker has to an environment.</em></p>
<p><em>&quot;</em></p>
<p><em>Why we are talking about hashes, once again from white paper<br /></em></p>
<p><em>&quot;<br /></em></p>
<p><em>A password hash is a direct one-way mathematical derivation of the password that changes only when the user&rsquo;s password changes. Depending on the authentication mechanism, either a password hash or a plaintext password can be presented as an authenticator to serve as proof of the user&rsquo;s identity to the operating system</em></p>
<p><em>&quot;<br /></em></p>
<p><strong>Some Back Ground Now</strong></p>
<p>While preparing for a security certification some time back, I studied&nbsp;about cryptography.&nbsp;I loved the interesting details of one way hashes, the way they are created&nbsp; and that they are one way and cant be reversed.Although there is something called birthday attack, that&nbsp;can happen to them, which is in fact about a chance that two numbers can have same hash. Initially&nbsp;I thought its something really strong and unbreakable. My friend Junaid who was my team mate, this is when we were not part of the IR(incident Response ) team. Junaid told me he had heard that these hashes can be broken and they get stolen through a attack called pass the hash.&nbsp; I could not believe when he said hashes were breakable and there was something called pass the hash attack. After hearing about it,&nbsp;I really got curious and read about it. Found huge material about it, our internal as well as&nbsp;on the internet explaining it.</p>
<p><strong>Why I am writing about it ? What&#39;s the point ?</strong></p>
<p>Usually, if&nbsp; we are talking about it,&nbsp;in an incident response scenario, this means couple of things, this is a targeted attack. A targeted attack has few stages and this stage&nbsp;is, in which&nbsp; the attacker is already inside the network&nbsp;and trying to get passwords of high privilege or administrator&#39;s passwords,&nbsp;to get control&nbsp;over the most important assets of an organisation they are attacking. This attack has huge history and there is so much written about it, but still not many have heard of it. The <a href="http://www.microsoft.com/en-in/download/details.aspx?id=36036" target="_blank">pass the hash whitepapers</a> from Microsoft is really detailed&nbsp;document.&nbsp;It&nbsp;explains&nbsp;what is this attack. what are the Risk factors and then provides detailed mitigation steps. Irony is that when document is really detailed and structured and little on lengthier side, Some People do not actually read it. But if We&nbsp;are really serious about mitigating it, in our network environment then we should read it thoroughly.</p>
<p><strong>A&nbsp;myth or wrong perception that&nbsp;&quot;This is only related to windows environment, Linux based machines don&#39;t have this problem&quot;</strong></p>
<p>I had a discussion around this myth with someone .I&nbsp; provided detailed answers to them, explaining that its lateral issue of a luxury requirement which has become necessity called &quot;single sign on&quot; and not a Bug, that any OS vendor shall fix it. Its a universal problem and not just windows or Linux problem.This problem is operating system independent i.e. pass the hash attacks happen on all operating systems .Since most organisations are on windows domain, more you hear about it in relation to windows domain. There is another fact, this happens only when best security practices are not followed as given in whitepaper.&nbsp;</p>
<p><strong>So what is single sign on?</strong></p>
<p>&nbsp;I once asked this question to a very senior colleague in our Edge&nbsp;team during our WAP training sessions(a completely different topic).&nbsp;&nbsp;Answer&nbsp;I got was, depends on scenario and then explanation(keeping ADFS in picture) of those scenarios was quite long.</p>
<p>But&nbsp;I will make it easy and according to our context. I will explain it the way&nbsp;I explained to one of network admins, who were discussing this issue&nbsp;with me. Explanation, which is&nbsp;very simple is, if a user logs on to his machine, in the domain network, then&nbsp;tries to access&nbsp; printer on the network or files on fileserver at that moment, if we remove single sign on from the picture, every time this user tries to access these and other such network resources, she will get authentication prompt, to enter her credentials to access that resource. These days most of such resources are on the network and not local to machine. So it will make a user&#39;s life really difficult, if she has to&nbsp;enter the credentials every time she accesses a resource on the network.</p>
<p><strong>Process or Service that helps in single sign on</strong></p>
<p>In windows operating&nbsp;system, there is a service or process called LSASS, which stores the logged on user&#39;s password hash in its memory, it&nbsp;uses it when logged on user tries to access an resource on the network , user is asked for credentials. LSASS provides this password hash behind the scenes and user is not even aware of this. So this single sign on happens without the users knowledge.He keeps accessing network resources without getting prompted for authentication. Sweet!!</p>
<p>That&#39;s what attackers&nbsp;know as well.They use various techniques discussed in the pass the hash attack whitepaper, to get a&nbsp;regular(non power/non admin) user&#39;s credentials.One of the technique is called phishing, which is used &nbsp;for credential theft&nbsp;. So&nbsp; by using&nbsp;such a technique attacker gets the credentials of a user and then elevate his privilege. Then they&nbsp;install tools like mimikatz or WCE&nbsp;, then get hold of logged on users password hashes as well as Kerberos tickets . Then make lateral network movement with high privileged account credentials, to get control over the more important assets of the organisation. Then they kind of own the precious resources on the network.</p>
<p><strong>A question, Can we do something with LSASS to not remember or cleanup&nbsp;the logged on users credentials after log off?</strong></p>
<p><b>Answer to that is, yes we can,&nbsp;Following article</b></p>
<p>http://blogs.technet.com/b/srd/archive/2014/06/05/an-overview-of-kb2871997.aspx</p>
<p>in following section explains it</p>
<p></p>
<p style="margin-left:30px;"><b><span style="font-size:medium;">LSA Credential Cleanup &amp; Other Changes</span></b></p>
<p style="margin-left:30px;"><b><span style="font-size:medium;">a. Removal of credentials after logoff</span></b></p>
<p style="margin-left:30px;"><span style="font-size:medium;">As outlined in Microsoft&rsquo;s </span><a title="Pass-the-hash whitepaper" href="http://download.microsoft.com/download/7/7/A/77ABC5BD-8320-41AF-863C-6ECFB10CB4B9/Mitigating%20Pass-the-Hash%20(PtH)%20Attacks%20and%20Other%20Credential%20Theft%20Techniques_English.pdf"><span style="color:#0563c1;font-size:medium;">Pass-the-hash whitepaper</span></a><span style="font-size:medium;">,&nbsp;Windows caches the credentials of a user in the LSASS process whenever the user logs in. This includes the user&rsquo;s clear-text password, the users NT/LM password hash, and the users Kerberos TGT/Session key. When the user logs off, the credentials should be cleared out of memory. Prior to this update, this was not always the case. This issue preventing credentials from being cleared is now fixed, credentials will always be cleared from memory after a user logs off.</span></p>
<p>&nbsp;</p>
<p>As we know its like a&nbsp;Cat and mouse game between attackers and security professionals defending against them, Microsoft has added another feature called LSASS protection explained in&nbsp;following article&nbsp;&nbsp;</p>
<p><a href="https://technet.microsoft.com/en-in/library/dn408187.aspx"><span style="color:#0563c1;">https://technet.microsoft.com/en-in/library/dn408187.aspx</span></a></p>
<p>&nbsp;Relevant excerpts from the article are below</p>
<p></p>
<p><strong>What is LSASS protection?</strong></p>
<p>&nbsp;</p>
<p><span style="font-family:Times New Roman;font-size:medium;">This topic for the IT professional explains how to configure additional protection for the Local Security Authority (LSA) process to prevent code injection that could compromise credentials.</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;">The LSA, which includes the Local Security Authority Server Service (LSASS) process, validates users for local and remote sign-ins and enforces local security policies. The Windows 8.1 operating system provides additional protection for the LSA to prevent reading memory and code injection by non-protected processes. This provides added security for the credentials that the LSA stores and manages. The protected process setting for LSA can be configured in Windows 8.1, but it cannot be configured in Windows RT 8.1. When this setting is used in conjunction with Secure Boot, additional protection is achieved because disabling the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa registry key has no effect.</span></p>
<p></p>
<p><strong>How you can enable it ?</strong></p>
<p>&nbsp;</p>
<p style="margin-left:30px;"><b><span style="text-decoration:underline;"><span style="font-family:Times New Roman;font-size:medium;">To enable LSA protection on a single computer</span></span></b></p>
<p style="margin-left:30px;">1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Open the Registry Editor (RegEdit.exe), and navigate to the registry key that is located at: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa.</p>
<p style="margin-left:30px;">2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set the value of the registry key to: &quot;RunAsPPL&quot;=dword:00000001.</p>
<p style="margin-left:30px;">3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Restart the computer.</p>
<p>&nbsp;</p>
<p><b><span style="font-size:medium;">To enable LSA protection using Group Policy</span></b></p>
<p><b><span style="font-size:medium;">&nbsp;</span></b>&nbsp;</p>
<ul>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;Open the Group Policy Management Console (GPMC).</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create a new GPO that is linked at the domain level or that is linked to the organizational unit that contains your computer accounts. Or you can select a GPO that is already deployed.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Right-click the GPO, and then click Edit to open the Group Policy Management Editor.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Expand Computer Configuration, expand Preferences, and then expand Windows Settings.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Right-click Registry, point to New, and then click Registry Item. The New Registry Properties dialog box appears.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In the Hive list, click HKEY_LOCAL_MACHINE.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In the Key Path list, browse to SYSTEM\CurrentControlSet\Control\Lsa.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In the Value name box, type RunAsPPL.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In the Value type box, click the REG_DWORD.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In the Value data box, type 00000001.</li>
<li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Click OK.</li>
</ul>
<p></p>
<p>As i said earlier, white paper is still the key. Why ? lets assume&nbsp;even after following above steps&nbsp;, if an attacker using phishing attack is able to get a user&rsquo;s credentials. Then attacker is able to get to a user&rsquo;s machine on the domain&nbsp;,then elevates his privileges, if organisation is not&nbsp;following security best practices explained in pass the hash white paper. Attacker then can install tools like mimikatz or WCE(windows credentials editor), then using them monitor and possibly get and save hashes of logged on user.</p>
<p>So it becomes really important to follow&nbsp;the mitigations mentioned in pass the hash whitepaper to be secure.</p>
<p><span style="font-size:large;"><strong>Disclaimer</strong></span> : These are purely My thoughts and this document is still work in progress, as&nbsp;I would keep adding either parts to series or adding to this document. There are important discussions about Local admin account and common password usage for it and making life easy for an attacker, to make lateral movement and Irony of admins who need such a thing to manage their things easily&nbsp;. That there is&nbsp;an awesome solution to that problem called SLAM solution, I will write about it later.</p>
<p></p>]]></content:encoded>
    </item>
    <item>
      <title>Few words about DDOS(Distributed Denial of service) attack</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/few-words-about-ddosdistributed-denial-of-service-attack</link>
      <pubDate>Sun, 22 Mar 2015 00:24:00 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/2015/03/22/few-words-about-ddosdistributed-denial-of-service-attack/</guid>
      <description><![CDATA[Most of my friends from IT must be aware of what is a DOS(Denial of Service) attack and about...]]></description>
      <content:encoded><![CDATA[<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">Most of my friends from IT must be aware of what is a DOS(Denial of Service) attack and about DDOS(Distributed Denial of Service). For those friends who are not <a href="http://en.wikipedia.org/wiki/Denial-of-service_attack">this</a> article explains about DOS attacks and <a href="http://en.wikipedia.org/wiki/Distributed_denial_of_service_attacks_on_root_nameserversthis">this</a> one is about DDOS. Recently&nbsp;I worked on these scenarios and thought&nbsp; of sharing the experiences and some suggestions.</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">So scenario was that&nbsp;the&nbsp; web servers&nbsp; in a network were under DDOS&nbsp;attack,Admin&#39;s of the&nbsp;network and web servers&nbsp;found about the attack from their monitoring system(IPS- Intrusion&nbsp; prevention system) events that detected the attack but could not prevent it.</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">I had a detailed discussion with&nbsp;&nbsp;admin about the location of the web servers, most of them were in <a href="http://en.wikipedia.org/wiki/DMZ_(computing)">DMZ</a>(De militarized Zone) behind a firewall. Most of the Web servers were behind the<a href="http://en.wikipedia.org/wiki/Intrusion_prevention_system"> IPS</a> device as well. Still they were under attack.&nbsp; Difference between the IPS(Intrusion Prevention Device) and IDS(Intrusion Detection device) is that IPS can take measures to prevent the attack , where as IDS will detect and inform the admins about it, as monitoring mechanism. I thought&nbsp;it was&nbsp;interesting to know that Web servers were behind IPS and were still&nbsp;experiencing DDOS attack.</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;"> But&nbsp;explanation is&nbsp;pretty straight forward . IPS devices mostly are either signature based or anomaly(statistical) based or both depending on the manufacturer providing these features.&nbsp; So if IPS devices is signature based, it wont be effective in DDOS attack scenario. On the other hand ,IPS devices that have anomaly based protection, can defend against DDOS attacks.<br /></span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">So&nbsp;the Admin in this case&nbsp;was not sure about the&nbsp; type of IPS they had in place, so they wanted help regarding this on the web servers. Web servers were running on windows server 2008 and above.&nbsp;Guided them&nbsp; that Windows vista/7/2008 and above have built-in protection mechanism for such attacks as explained in this <a href="http://technet.microsoft.com/en-us/library/dd349797(WS.10).aspx">article</a>. There is another nice <a href="/b/nettracer/archive/2010/06/01/syn-attack-protection-on-windows-vista-windows-2008-windows-7-and-windows-2008-r2.aspx">article</a>&nbsp;that explains a way to find out that attack protection triggers when such a attack is detected ,there is netsh trace command given in the article that will allow you to see that.</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">For a quick check on their web server&nbsp;I took a netstat -ano output and found as below and compared the total number of TCP connections and the number of syn_received and found the count of these <span style="color:#44546a;font-family:Calibri;">syn_received</span> to be less then hundred and we know that maximum ports available on the server are 65535, so although they were seeing this attack in action but it has not done what it was supposed to do, i.e. denial of service, i.e. making the web server not able to serve on this port yet<br /></span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;font-family:&#39;Calibri&#39;,sans-serif;font-size:13.5pt;">---------------------------------------------------------------------------------------------</span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP:port&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP: port&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP: port &nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP:port&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp; &nbsp;&nbsp;mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP:port&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP2: port&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP2: port&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP3: port&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP 3port&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP4: port&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp;&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP4: port&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span><span><span><span style="font-family:Times New Roman;font-size:medium;">.&nbsp; TCP&nbsp;&nbsp;&nbsp; mydummyIP:80&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attackerdummyIP5: port&nbsp;&nbsp;&nbsp;&nbsp; SYN_RECEIVED&nbsp;&nbsp;&nbsp; PID</span></span></span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;"><span style="font-family:Times New Roman;font-size:medium;"> </span><span style="color:#44546a;font-family:&#39;Calibri&#39;,sans-serif;font-size:13.5pt;">---------------------------------------------------------------------------------------------</span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">Using the netsh command &quot; <span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">netsh trace start capture=yes provider=Microsoft-Windows-TCPIP level=0x05 tracefile=TCPIP.etl</span></span>&quot; I took tracing and then looked through the trace and&nbsp;I could see the attack protection by the OS&nbsp;in place, we could see that web server after receiving such syn packets after some time starts dropping them. But you will also see that for some new request it does respond, which is obvious as it has to judge if its a good user or malicious. Apart from that we ran our internal tools to ensure there were no malware and malicious activity other then the DDOS traffic coming from external sources, which are usually botnets.<br /></span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;"><span style="font-size:x-large;"><strong>Suggestions</strong></span><br /></span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">Running antimalware(with current and&nbsp;updated signatures) on servers to make sure there is no malware on it.&nbsp;Usually its better and efficient to handle such attacks at the network&nbsp;,using statistical Anomaly based IPS/IDS devices and&nbsp;firewalls&nbsp;&nbsp;rather then on the servers. In addition to that at network level the scaling up of the network bandwidth would be required to deal with such a situation. </span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">There is another alternative of transferring the Risk of such threats to service providers like Azure and let them deploy these services for you, who have much bigger network bandwidth/pipe and security mechanism in place to deal with such scenarios. This <a href="http://azure.microsoft.com/blog/2014/01/07/new-windows-azure-network-security-whitepaper/">Windows azure network security whitepaper </a>explains it. <a href="http://azure.microsoft.com/en-in/services/cdn/">Azure CDN</a> is another option as well.</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;"><span style="font-size:x-large;">Some third party interesting reads</span><br /></span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;"><a href="http://www.lifehacker.com.au/2013/04/top-ten-lesser-known-facts-about-windows-azure-security/">http://www.lifehacker.com.au/2013/04/top-ten-lesser-known-facts-about-windows-azure-security/</a></span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">http://www.gregthatcher.com/Azure/Ch10_StopDenialOfServiceOnAzure.aspx</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#44546a;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#333300;font-size:large;"><strong>Following is Quote from the Top&nbsp;IR(Incident Response) Expert on this topic,the&nbsp;one and only&nbsp;Neil Carpenter</strong></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#008080;font-size:medium;"><strong><span class="UFICommentBody"><em>It&#39;s been my opinion that moving to Azure/AWS/Rackspace/etc is the _best_ possible solution. It doesn&#39;t matter how much traffic you drop -- a sufficiently motivated attacker can saturate bandwidth on your Internet connection. When they do this, it&#39;s not only going to degrade the performance of your website...it&#39;s going to degrade the performance of everything that shares that pipe.</em><br /><br /><em>You&#39;re much better off moving all of the risk and the traffic out to a provider who has the resources to ride out an attack.</em><br /><br /><em>If you have a lot of static content, you may also want to consider a CDN like Akamai.</em> </span></strong></span></p>
<p style="margin:0cm 0cm 0pt;"><span style="color:#008080;font-size:large;"><span class="UFICommentBody"><span>&nbsp;</span></span></span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"><span style="font-size:large;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p style="margin:0cm 0cm 0pt;"></p>
<p></p>]]></content:encoded>
    </item>
    <item>
      <title>Crypto locker on your Machine</title>
      <link>https://docs.microsoft.com/archive/blogs/sooraj-sec/crypto-locker-on-your-machine</link>
      <pubDate>Thu, 15 Jan 2015 06:29:16 GMT</pubDate>
      <dc:creator><![CDATA[Suraj Singh MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/sooraj-sec/2015/01/15/crypto-locker-on-your-machine/</guid>
      <description><![CDATA[Probably one of the smartest malware, in my opinion, yes I&rsquo;m starting with praise for this...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family:Calibri;">Probably one of the smartest malware, in my opinion, yes I&rsquo;m starting with praise for this malware. Very smart modus operandi. If you are struck with it, you have only two options either you pay or forget about your files. </span></p>
<p><span style="font-family:Calibri;">If you are smart then you will keep your machines protected by super patching, leaving no vulnerable software and operating system .Apart from that, have Backups for all your important stuff.</span></p>
<p><span style="font-family:Calibri;">MMPC(Microsoft Malware Protection Center) has recently published a post on its blog , you can read that </span><a href="/b/mmpc/archive/2014/10/28/the-dangers-of-opening-suspicious-emails-crowti-ransomware.aspx"><span style="color:#0563c1;font-family:Calibri;">here</span></a><span style="font-family:Calibri;">. The most important points discussed, in this is how ransom ware (</span><a href="http://www.microsoft.com/security/portal/threat/encyclopedia/Entry.aspx?Name=Win32/Crowti"><span style="color:#0563c1;font-family:Calibri;">Win32/Crowti</span></a><span style="font-family:Calibri;"> and its family) spreads, which is majorly via spam emails containing attachments, luring users to open them. The other way is through exploit kits, which provide exploits, to exploit the java or flash vulnerabilities on a user&rsquo;s system i.e. if these software are unpatched and are hence vulnerable. </span></p>
<p><span style="font-family:Calibri;">&nbsp;This post, is an example, where an exploit kit manages to exploit a vulnerability on the system. In this scenario, it was a client machine i.e. machine with a client operating system, on a network that got infected. We were trying to find the way infection happened, so we collected data from the infected machines and started looking at it.</span></p>
<p><b><span style="font-family:Calibri;">Observations from data</span></b></p>
<p><span style="font-family:Calibri;">I&rsquo;m putting down sequential activity below, sequenced in terms of time.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/78/28/8688.s1.PNG" original-url="http://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-00-78-28/8688.s1.PNG"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/78/28/8688.s1.PNG" original-url="http://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-00-78-28/8688.s1.PNG" border="0" /></a></span><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Calibri;">Vulnerable software list as pulled down by data collection tool, partially shown below, on the infected machines did not have Java updated and hence left machines vulnerable. By comparing the installed versions and latest versions of java software, on these infected machines, we could understand clearly the big hole in them, as installed versions were way behind the latest versions. That&rsquo;s what exploits from the exploit kits keep looking and if found, its bull&rsquo;s eye for them and they nail it. </span></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="210" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><b><span style="font-family:Calibri;font-size:medium;">Software&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></b></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
<td width="127" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><b><span style="font-family:Calibri;font-size:medium;">Installed Version&nbsp;</span></b></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
<td width="113" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><b><span style="font-family:Calibri;font-size:medium;">Latest Version&nbsp;&nbsp;</span></b></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
</tr>
<tr>
<td width="210" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><b><span style="font-family:Calibri;font-size:medium;">Java(TM) x Update x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></b></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
<td width="127" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><span style="font-family:Calibri;font-size:medium;">X</span></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
<td width="113" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><span style="font-family:Calibri;font-size:medium;">x</span></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
</tr>
<tr>
<td width="210" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><b><span style="font-family:Calibri;font-size:medium;">JavaFX x.x.x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></b></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
<td width="127" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><span style="font-family:Calibri;font-size:medium;">X</span></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
<td width="113" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><span style="font-family:Calibri;font-size:medium;">x</span></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
</tr>
<tr>
<td width="210" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><b><span style="font-family:Calibri;"><span style="font-size:medium;">Java Auto Updater&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></b></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
<td width="127" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><span style="font-family:Calibri;font-size:medium;">X</span></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
<td width="113" valign="top"><span style="font-family:Times New Roman;font-size:medium;"> </span>
<p><span style="font-family:Calibri;font-size:medium;">x</span></p>
<span style="font-family:Times New Roman;font-size:medium;"> </span></td>
</tr>
</tbody>
</table>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Calibri;">Let&rsquo;s now connect the dots together in this scenario. So we could see that suspect plugin was getting launched (as we can see from pre-fetch files in above table of activity), about prefetch folder and files please refer </span><a href="http://windows.microsoft.com/en-in/windows-vista/what-is-the-prefetch-folder"><span style="color:#0563c1;font-family:Calibri;">http://windows.microsoft.com/en-in/windows-vista/what-is-the-prefetch-folder</span></a><span style="font-family:Calibri;">.</span></p>
<p><span style="font-family:Calibri;">Every time, it was getting launched, it was crashing IE for some reason. Then it was trying to launch Volume shadow copy, to find backups and also encrypt them. Then it started launching Java files, obviously exploit, found out that java software were unpatched and exploited them. So what happened is, that it put the java jar files on the machine and unzipped it in the memory not on hard drive, hence went undetected from the antivirus on the system. Then started its operation and next thing we see is, it starts encrypting the files on the system. Checkmate, game over.</span></p>
<p><span style="font-family:Calibri;">&nbsp;</span><span style="font-family:Calibri;">So Ideal thing to do here, as prevention is to make sure, your machines are patched. </span></p>
<p><span style="font-family:Calibri;">&nbsp;</span><span style="font-family:Calibri;">I have also seen third party websites suggesting restriction of executable in appdata folder on the machine e.g.</span></p>
<p><span style="font-family:Calibri;">&nbsp;</span><span style="font-family:Calibri;">On following path</span></p>
<p><span style="font-family:Calibri;">&nbsp;</span><span style="font-family:Calibri;"><b>Path:</b> <b>%AppData%\*.exe</b></span></p>
<p><span style="font-family:Calibri;">&nbsp;</span><span style="font-family:Calibri;">i.e. Create rules to make sure executables cannot run on this location i.e. subfolder of %AppData%.</span></p>
<p><span style="font-family:Calibri;">&nbsp;</span><span style="font-family:Calibri;">But we don&rsquo;t either suggest or recommend it, as there could be good applications that may need to run from this location, however Applocker can be used to white list the legal applications to run on the machine.</span></p>
<p><span style="font-family:Calibri;">&nbsp;</span></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Times New Roman;font-size:medium;"> </span></p>]]></content:encoded>
    </item>
  </channel>
</rss>