<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Syncio Blog</title>
  <link rel="alternate" type="text/html" href="http://sync-io.net:83/" />
  <link rel="self" href="http://sync-io.net:83/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2008-07-16T10:24:00.9375-05:00</updated>
  <author>
    <name>Chris Misztur</name>
  </author>
  <subtitle>little tiny electrons</subtitle>
  <id>http://sync-io.net:83/</id>
  <generator uri="http://www.dasblog.net" version="2.0.7180.0">DasBlog</generator>
  <entry>
    <title>EventCollector: Intercepting the Forwarded Events log with System.Diagnostics.Eventlog class (Post 2)</title>
    <link rel="alternate" type="text/html" href="http://sync-io.net:83/2008/07/16/EventCollectorInterceptingTheForwardedEventsLogWithSystemDiagnosticsEventlogClassPost2.aspx" />
    <id>http://sync-io.net:83/PermaLink,guid,d5a63229-e712-42ec-a294-770972c12b7b.aspx</id>
    <published>2008-07-16T10:21:58.343-05:00</published>
    <updated>2008-07-16T10:24:00.9375-05:00</updated>
    <category term="Logging" label="Logging" scheme="http://sync-io.net:83/CategoryView,category,Logging.aspx" />
    <category term="Server2008" label="Server2008" scheme="http://sync-io.net:83/CategoryView,category,Server2008.aspx" />
    <category term="VB.NET" label="VB.NET" scheme="http://sync-io.net:83/CategoryView,category,VB.NET.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Otto's recent post on <a href="http://blogs.technet.com/otto/archive/2007/11/09/find-the-event-that-triggered-your-task.aspx">event
log triggers</a> explains how to: start a program, send an email or show a message
on the occurence of an event in the Event Log.  This is a great step forward,
however, some might feel that it is not enough to deploy a large scale logging and
notification environment with a focus on autonomy. 
</p>
        <p>
The alternative is to develop a piece of code that will subscribe to the <strong>__InstanceCreationEvent</strong> of
the <strong>Forwarded Events</strong> log.  The obstacle to using the existing <strong>System.Diagnostics.Eventlog</strong> class
is that the class does not interface with the <a href="http://msdn.microsoft.com/en-us/library/aa385225(VS.85).aspx">channeled
structure of the new Event Log</a> in Vista/2008.  (<em>The Forwarded Event log
is not visible to Eventlog.GetEventLogs() because it is a channel.</em>)  
</p>
        <p>
The following steps rectify this shortcoming:
</p>
        <address>1.   Create an overlapping ForwardedEvents classic log.
</address>
        <address>
          <font size="2">      <font face="Courier New">EventLog.CreateEventSource("ForwardedEvents",
"ForwardedEvents")</font></font>
        </address>
        <address>
          <font face="Courier New">
          </font> 
</address>
        <address>2.   Export and Remove ForwardedEvents channel from registry.
</address>
        <address>      <font face="Courier New">HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\ForwardedEvents</font></address>
        <address> 
</address>
        <address>3.   Recreate the Source Initiated subscription on the server.   
</address>
        <address> 
</address>
        <address>4.   Restart the Windows Event Collector service on the server.
</address>
        <address> 
</address>
        <address>5.   Restart the WINRM service on the client.
</address>
        <address> 
</address>
        <p>
          <font size="2">If everything worked, you should see incoming events in the <strong>ForwardedEvents</strong> log. 
Notice that the log name does not contain a space anymore.  This was done to
match the full name of our new event log to that of the removed channel.</font>
        </p>
        <p>
          <font size="2">
            <strong>ForwardedEvents</strong> log will now be part of the <strong>Eventlog.GetEventLogs()</strong> array. 
You can deploy a <strong>ManagementEventWatcher</strong> to successfully intercept,
parse and take action on incoming events.
</font>
        </p>
        <font color="#a31515" size="2">
          <font color="#a31515" size="2">
          </font>
        </font>
        <img width="0" height="0" src="http://sync-io.net:83/aggbug.ashx?id=d5a63229-e712-42ec-a294-770972c12b7b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>ISA 2006 Cache and HTTP Kaspersky Antivirus</title>
    <link rel="alternate" type="text/html" href="http://sync-io.net:83/2008/06/18/ISA2006CacheAndHTTPKasperskyAntivirus.aspx" />
    <id>http://sync-io.net:83/PermaLink,guid,ddb0e831-f195-42f0-8975-85851e39eb9f.aspx</id>
    <published>2008-06-18T14:15:11.234-05:00</published>
    <updated>2008-06-18T14:31:26.890625-05:00</updated>
    <category term="ISA" label="ISA" scheme="http://sync-io.net:83/CategoryView,category,ISA.aspx" />
    <category term="Malware" label="Malware" scheme="http://sync-io.net:83/CategoryView,category,Malware.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Using the <a href="http://msdn.microsoft.com/en-us/library/ms816051.aspx">FPCCacheContents</a> Object
I was able to force-cache any file I wanted for any duration I wanted.  
</p>
        <p>
1.  I downloaded Cain&amp;Abel executable from source #1 and Kaspersky blocked
it.  I verified that traffic was coming from souce #1 with Wireshark. 
<br />
2.  I force-cached Cain&amp;Abel executable from source #2 to avoid IE caching
or anything that might invalidate this test.  The item now exists in ISA cache. 
<br />
3.  I downloaded Cain&amp;Abel executable from source #2 again.  I verified
that traffic was indeed coming from ISA Cache with Wireshark.  
<br />
I turned up KAV log files to Debug and verified that the Cain&amp;Abel executable
has not been flagged the first time it was downloaded.  Kaspersky blocked Cain&amp;Abel
from ISA Cache.<br />
  
<br />
Conclusion: 
</p>
        <ul>
          <li>
HTTP Kaspersky engine interfaces with cache and routed requests.  
</li>
          <li>
Anything can be forced into ISA cache. 
</li>
        </ul>
        <p>
See the ISA Monitor Utility for cache control.  <a href="http://sync-io.net/IsaTools.aspx">http://sync-io.net/IsaTools.aspx</a></p>
        <img width="0" height="0" src="http://sync-io.net:83/aggbug.ashx?id=ddb0e831-f195-42f0-8975-85851e39eb9f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>EventCollector: Subscribing HTTP XP/2003 clients (Post 1)</title>
    <link rel="alternate" type="text/html" href="http://sync-io.net:83/2008/06/18/EventCollectorSubscribingHTTPXP2003ClientsPost1.aspx" />
    <id>http://sync-io.net:83/PermaLink,guid,3a6627d1-946a-4c8a-b786-f3735703e32b.aspx</id>
    <published>2008-06-18T11:08:50.734-05:00</published>
    <updated>2008-07-16T09:52:31.171875-05:00</updated>
    <category term="Logging" label="Logging" scheme="http://sync-io.net:83/CategoryView,category,Logging.aspx" />
    <category term="Server2008" label="Server2008" scheme="http://sync-io.net:83/CategoryView,category,Server2008.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <font size="3">Setting up a Collector Initiated Subscription:</font>
        </p>
        <p>
1. <a href="http://www.microsoft.com/downloads/details.aspx?familyid=845289ca-16cc-4c73-8934-dd46b5ed1d33&amp;displaylang=en">Download</a> and
install <strong>WS-Management</strong>/<strong>WINRM</strong> on client <u>and</u> collector
computers.  Configure <strong>WINRM</strong> using command "<strong>winrm quickconfig</strong>".  <strong>Event
Viewer</strong> will be appended with a <strong>Microsoft-Windows-Forwarding/Operational</strong> log.
</p>
        <p>
2. Configure <strong>WECUTIL</strong> on collector computer using command "<strong>WECutil
QC</strong>".
</p>
        <p>
3. Import subscription using command '<strong>WECUTIL cs <a href="http://sync-io.net:83/content/binary/sub_CI_Pull0.xml">sub_CI_Pull0.xml</a></strong>'
on the collector computer.
</p>
        <p>
          <u>NOTE:</u> Modify <strong>sub_CI_Pull0.xml</strong> before importing it.  I
used a domain account with administrative privilages.  The <a href="http://msdn.microsoft.com/en-us/library/aa385231%28VS.85%29.aspx">Event
Selection</a> xpath syntax is sensitive.  I was unable to create a query for
the Security log.  (<a href="http://support.microsoft.com/kb/323076">Security
Log Permissions</a>)
</p>
        <p>
4.  Run <strong>eventvwr.msc</strong> on the collector computer.  Right
click on your subscription and view Runtime Status.  Specified clients have to
display a green, Active status.  You will see events appearing in the <strong>Windows
Logs\Forwarded Events</strong> log shortly.
</p>
        <p>
          <font size="3">Setting up a Source Initiated Subscription:</font>
        </p>
        <p>
Source Initiated subscription is the preferred way of forwarding events as it is much
easier deployed via Group Policy.
</p>
        <p>
Repeat above steps 1 through 4, replacing sub_CI_Pull0.xml in step 3 with <strong><a href="http://sync-io.net:83/content/binary/sub_SI0.xml">sub_SI0.xml</a></strong>.
</p>
        <p>
The extra step to perform on XP/2003 clients is to <a href="http://msdn.microsoft.com/en-us/library/bb870973%28VS.85%29.aspx">tattoo
the registry</a> at:
</p>
        <p>
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\EventLog\EventForwarding\SubscriptionManager
</p>
        <address>Type: REG_SZ
</address>
        <address>Name: 1
</address>
        <address>Data: Server=collector.domain.com (FQDN of your collector, HTTP transport
only.  A valid URI is required for HTTPS, e.g. "Server=https://&lt;FQDN&gt;/wsman/SubscriptionManager/WEC")<br /></address>
        <p>
and then restart the <strong>WINRM </strong>service on the client.  These extra
steps should produce event 104 in your client's <strong>Windows Logs\Forwarded Events</strong> log
with the message: "The forwarder has successfully connected to the subscription manager
at address &lt;FQDN&gt;.", followed by event 100 with the message: "The subscription
&lt;sub_name&gt; is created successfully."
</p>
        <p>
          <u>WINRM notes:</u>
        </p>
        <ul>
          <li>
   WINRM configuration has not been altered from the default.  It seems
that setting TrustedHosts variable is not necessary (<strong>winrm set winrm/config/client
@{TrustedHosts="wildcard_machine_name_here"}</strong>)</li>
        </ul>
        <p>
          <u>EventCollector notes:</u>
        </p>
        <ul>
          <li>
   The Create Subscription GUI did not work for me at creating a collector
initiated subscription. 
</li>
          <li>
   For some reason I started getting an Access Denied error with this set
up and I had to either: change the User Account in Advanced Subscription Settings
from Machine Account to a Specific User account OR restart the WINRM service on the
client.<br /></li>
        </ul>
        <p>
          <font color="#ff0000">
            <strong>Please post comments and ideas you have.  I am
interested in how far we can go with this XP&lt;--&gt;2008 collector setup.</strong>
          </font>
        </p>
        <p>
 
</p>
        <p>
          <em>Reference Links:</em>
        </p>
        <p>
          <a href="http://blogs.technet.com/otto/default.aspx">
            <strong>http://blogs.technet.com/otto/default.aspx</strong>
          </a>
        </p>
        <p>
          <a href="http://support.microsoft.com/kb/936059">http://support.microsoft.com/kb/936059</a>
        </p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/library/aa384291%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/aa384291%28VS.85%29.aspx</a>
        </p>
        <p>
          <a href="http://certcities.com/editorial/columns/story.asp?EditorialsID=292">http://certcities.com/editorial/columns/story.asp?EditorialsID=292</a>
        </p>
        <p>
          <a href="http://technet2.microsoft.com/windowsserver/en/library/30757b93-7291-4254-b15e-f0aa5f45ac541033.mspx?mfr=true">http://technet2.microsoft.com/windowsserver/en/library/30757b93-7291-4254-b15e-f0aa5f45ac541033.mspx?mfr=true</a>
        </p>
        <p>
          <a href="http://technet.microsoft.com/en-us/magazine/cc137748.aspx">http://technet.microsoft.com/en-us/magazine/cc137748.aspx</a>
        </p>
        <p>
          <a href="http://support.microsoft.com/kb/912309">http://support.microsoft.com/kb/912309</a>
        </p>
        <p>
          <a href="http://openwsman.org/book/export/html/17">http://openwsman.org/book/export/html/17</a>
        </p>
        <p>
          <a href="http://blogs.technet.com/otto/archive/2007/02/09/sample-vista-ws-man-winrm-commands.aspx">http://blogs.technet.com/otto/archive/2007/02/09/sample-vista-ws-man-winrm-commands.aspx</a>
        </p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/library/bb870973%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/bb870973%28VS.85%29.aspx</a>
        </p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/library/bb736545%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/bb736545%28VS.85%29.aspx</a>
        </p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/library/bb427443%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/bb427443%28VS.85%29.aspx</a>
        </p>
        <p>
          <a href="http://www.microsoft.com/downloads/details.aspx?familyid=845289ca-16cc-4c73-8934-dd46b5ed1d33&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=845289ca-16cc-4c73-8934-dd46b5ed1d33&amp;displaylang=en</a>
        </p>
        <p>
          <a href="http://support.microsoft.com/kb/912030">http://support.microsoft.com/kb/912030</a>
        </p>
        <p>
          <a href="http://www.microsoft.com/technet/scriptcenter/newswire/winrm.mspx">http://www.microsoft.com/technet/scriptcenter/newswire/winrm.mspx</a>
        </p>
        <p>
          <a href="http://download.microsoft.com/download/5/D/6/5D6EAF2B-7DDF-476B-93DC-7CF0072878E6/wsm.doc">http://download.microsoft.com/download/5/D/6/5D6EAF2B-7DDF-476B-93DC-7CF0072878E6/wsm.doc</a>
        </p>
        <p>
          <a href="http://en.wikipedia.org/wiki/WS-Management">http://en.wikipedia.org/wiki/WS-Management</a>
        </p>
        <p>
          <a href="http://technet2.microsoft.com/WindowsVista/en/library/8fd4aad5-50bc-4389-bdae-e09ee464e46d1033.mspx?mfr=true">http://technet2.microsoft.com/WindowsVista/en/library/8fd4aad5-50bc-4389-bdae-e09ee464e46d1033.mspx?mfr=true</a>
        </p>
        <p>
          <a href="http://msdn.microsoft.com/en-us/library/aa385231%28VS.85%29.aspx">http://msdn.microsoft.com/en-us/library/aa385231%28VS.85%29.aspx</a>
        </p>
        <p>
          <em>Reference Posts:</em>
        </p>
        <p>
          <a href="http://forums.technet.microsoft.com/en-US/winserverManagement/thread/d6fd73ed-2e6d-43d1-943b-a45f9d81a461/">http://forums.technet.microsoft.com/en-US/winserverManagement/thread/d6fd73ed-2e6d-43d1-943b-a45f9d81a461/</a>
        </p>
        <p>
          <a href="http://forums.technet.microsoft.com/en-US/winserverManagement/thread/a4e8122a-3dc1-4954-bee7-bafed1fdb08e/">http://forums.technet.microsoft.com/en-US/winserverManagement/thread/a4e8122a-3dc1-4954-bee7-bafed1fdb08e/</a>
        </p>
        <p>
          <a href="http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.windows.server.networking&amp;tid=7dd38777-19d5-464d-aaeb-f31424b04ce1&amp;cat=&amp;lang=&amp;cr=&amp;sloc=&amp;p=1">http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.windows.server.networking&amp;tid=7dd38777-19d5-464d-aaeb-f31424b04ce1&amp;cat=&amp;lang=&amp;cr=&amp;sloc=&amp;p=1</a>
        </p>
        <p>
          <i>Attachments:</i>
        </p>
        <p>
          <a href="http://sync-io.net:83/content/binary/sub_CI_Pull0.xml">sub_CI_Pull0.xml (1.30
KB) </a>
        </p>
        <a href="http://sync-io.net:83/content/binary/sub_SI0.xml">sub_SI0.xml (1.46 KB)</a>
        <img width="0" height="0" src="http://sync-io.net:83/aggbug.ashx?id=3a6627d1-946a-4c8a-b786-f3735703e32b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Stopping Malware with ISA 2006</title>
    <link rel="alternate" type="text/html" href="http://sync-io.net:83/2008/04/23/StoppingMalwareWithISA2006.aspx" />
    <id>http://sync-io.net:83/PermaLink,guid,2e4ee447-abe3-4ba5-98c0-f8a8d1876179.aspx</id>
    <published>2008-04-22T20:09:16.218-05:00</published>
    <updated>2008-06-18T14:07:27.828125-05:00</updated>
    <category term="Malware" label="Malware" scheme="http://sync-io.net:83/CategoryView,category,Malware.aspx" />
    <category term="VB.NET" label="VB.NET" scheme="http://sync-io.net:83/CategoryView,category,VB.NET.aspx" />
    <category term="ISA" label="ISA" scheme="http://sync-io.net:83/CategoryView,category,ISA.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I recently came across MalwareDomains.com.  They provide a list of domain names
that have been associated with malware.  The list contains over 21000 valid entries
and I have decided to integrate it with ISA 2006 since it's rare to find such a free
resource that is actually kept up to date.
</p>
        <p>
The import tool is available here: <a href="http://sync-io.net/IsaTools.aspx">http://sync-io.net/IsaTools.aspx</a><a href="http://sync-io.net/Public/ISA_MalwareDomains_BETA.zip" target="_blank" rel="nofollow"><span class="yshortcuts" id="lw_1208912100_0"></span></a></p>
        <p>
Basically, you're able to import the domain.txt file into ISA as a URL or DNS set. 
Then you just set your deny access rule and away you go.  This utility can run
as a scheduled task.
</p>
        <img width="0" height="0" src="http://sync-io.net:83/aggbug.ashx?id=2e4ee447-abe3-4ba5-98c0-f8a8d1876179" />
      </div>
    </content>
  </entry>
  <entry>
    <title>CreateProcessAsUser from System Service (VB.NET)</title>
    <link rel="alternate" type="text/html" href="http://sync-io.net:83/2008/03/27/CreateProcessAsUserFromSystemServiceVBNET.aspx" />
    <id>http://sync-io.net:83/PermaLink,guid,d71d00da-05d7-4832-86fc-eeaf416cd7be.aspx</id>
    <published>2008-03-27T16:00:07.546-05:00</published>
    <updated>2008-06-24T16:11:06.046875-05:00</updated>
    <category term="Access Denied" label="Access Denied" scheme="http://sync-io.net:83/CategoryView,category,Access%2BDenied.aspx" />
    <category term="VB.NET" label="VB.NET" scheme="http://sync-io.net:83/CategoryView,category,VB.NET.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
The following code has been tested on Windows 2003 SP2.  The calling user
account must have 'Assign Primary Token' and 'Increase Quota' permissions to
properly execute CreateProcessAsUser; see MS KB285879.  
</p>
        <pre>
          <span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Public</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span> RunProc(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> CMD <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">ByVal</span> ARG <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span>) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">String</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> er <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> Int16 <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> exitCode <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> System.UInt32 <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Convert.ToUInt32(123) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> saThreadAttributes <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> SECURITY_ATTRIBUTES <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> SECURITY_ATTRIBUTES
saThreadAttributes.nLength <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Marshal.SizeOf(saThreadAttributes) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> impToken <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> System.IntPtr <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> IntPtr.Zero <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> priToken <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> System.IntPtr <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> IntPtr.Zero <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> LogonUser(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"DomainUser"</span>, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Domain"</span>, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"Passwd"</span>,
LogonType.LOGON32_LOGON_INTERACTIVE, _ LogonProvider.LOGON32_PROVIDER_DEFAULT, impToken) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> DuplicateTokenEx(impToken,
&amp;H2000000, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Nothing</span>,
SecurityImpersonationLevel.SecurityDelegation, TOKEN_TYPE.TokenPrimary, priToken) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> pi <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> PROCESS_INFORMATION <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> PROCESS_INFORMATION <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> si <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> STARTUPINFO <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> STARTUPINFO
si.cb <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Marshal.SizeOf(si)
si.lpDesktop <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> IntPtr.Zero <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Dim</span> saProcessAttributes <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">As</span> SECURITY_ATTRIBUTES <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">New</span> SECURITY_ATTRIBUTES
saProcessAttributes.nLength <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Marshal.SizeOf(saProcessAttributes) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Not</span> CreateProcessAsUser(priToken,
CMD, CMD &amp; <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"
"</span> &amp; ARG, saProcessAttributes, _ saThreadAttributes, <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">False</span>,
0, IntPtr.Zero, <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"c:\"</span>,
si, pi) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Then</span> er <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Marshal.GetLastWin32Error
RunProc <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> (<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"err
runas "</span> &amp; er) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Else</span> WaitForSingleObject(pi.hProcess,
Infinite) GetExitCodeProcess(pi.hProcess, exitCode) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span> CloseHandle(priToken)
CloseHandle(impToken) CloseHandle(pi.hProcess) CloseHandle(pi.hThread) <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">If</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">End</span><span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">Function</span></span>
        </pre>
        <img width="0" height="0" src="http://sync-io.net:83/aggbug.ashx?id=d71d00da-05d7-4832-86fc-eeaf416cd7be" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Protecting CIFS from unauthorized access with IPSEC</title>
    <link rel="alternate" type="text/html" href="http://sync-io.net:83/2008/03/20/ProtectingCIFSFromUnauthorizedAccessWithIPSEC.aspx" />
    <id>http://sync-io.net:83/PermaLink,guid,edb235b1-c20b-41c7-b2b8-a9ad90893f37.aspx</id>
    <published>2008-03-20T13:34:45.718-05:00</published>
    <updated>2008-03-20T13:34:45.71875-05:00</updated>
    <category term="Access Denied" label="Access Denied" scheme="http://sync-io.net:83/CategoryView,category,Access%2BDenied.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Let's pretend that Joe Smith working for company A just got an offer from company
B to steal company A's products database for one million dollars.  However company
A already has aleady secured their system pretty tightly.  All external storage
such as USB has been blocked, there are no floppies and Joe does not even have outside
email access.  Joe, however, does have CIFS access to the precious database. 
So he decides to bring a laptop from home, plugs into the network and obtains an IP
from the DHCP server.  He attempts to join Company A domain but is denied since
he is not an administrator.  Joe decides to navigate to '\\FileServer\Databases'. 
Windows prompts him for a username and password, so Joe types in 'CompanyA\JoeSmith'
and his usual domain password.  Voila, he gained access to the Databases share
and now is copying data from the file server onto his laptop; hands the data to company
B and receives a million dollars.  Scary, isn't it?
</p>
        <p>
Wouldn't it be much better if Joe brought his laptop, obtained and IP but when
he tried to access the shared folder all he would receive was an Access Denied message? 
Here is how:
</p>
        <p>
          <em>First of all this setup works because the Windows machine itself is a security
principal with an account name and password in Active Directory Services.</em>
        </p>
        <p>
We need to create two IPSEC policies, one for the file server and the second one for
all clients.  
</p>
        <p>
          <strong>File Server Setup:</strong>
        </p>
        <p>
IP Filter List will contain the following source ports:<br /><u>TCP 137<br />
TCP 139<br />
TCP 445<br />
UDP 137<br />
UDP 139<br /></u>The source IP address will be the file server's IP address and the destination
subnet will be any client grouping you choose.  
</p>
        <p>
The Filter Action will be a custom filter to negotiate security.  Inside the
Custom Security Methods use MD5 to protect 'data and address integrity without encryption'.  <em>Note:
Enabling encryption will affect SMB/CIFS performance.</em></p>
        <p>
          <strong>Client Setup:<br /></strong>The IP Filter List will contain the same source ports as the File Server
setup did.  However the source address will be the File Server's IP address and
the destination address will be My IP Address.<br />
The Filter Action will be the same custom filter as in the setup above.
</p>
        <p>
          <em>After applying the IPSEC policy through GPO, you can use the IPSEC Monitor MMC
to view statistics and associations.  Sniffing the cable should produce ISAKMP
protocol between the client and server.  Any existing CIFS connections will not
survive IPSEC taking effect, so remember to do this overnight or force a client reboot. 
Turning up event logging is also a good way to debug any failed key exchanges.</em>
        </p>
        <p>
          <em>Another approach is individual share protection by using the 'NTLM Authenticator'
user.</em>
        </p>
        <img width="0" height="0" src="http://sync-io.net:83/aggbug.ashx?id=edb235b1-c20b-41c7-b2b8-a9ad90893f37" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Anti-malware products are a scam!</title>
    <link rel="alternate" type="text/html" href="http://sync-io.net:83/2008/03/20/AntimalwareProductsAreAScam.aspx" />
    <id>http://sync-io.net:83/PermaLink,guid,4b1b52ce-132a-4d5d-9e9b-70a2df823f6c.aspx</id>
    <published>2008-03-20T12:58:14.453-05:00</published>
    <updated>2008-03-21T21:09:55.078125-05:00</updated>
    <category term="Malware" label="Malware" scheme="http://sync-io.net:83/CategoryView,category,Malware.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Every software company seems to be coming out with the next best way to protect your
computer from malware, including viruses.  What happened to educating users on
the risks of downloaded content execution and strategies of malware distribution? 
</p>
        <p>
I have included on Syncio's web site a guide to malware identification.  This
article is aimed at the more knowledgable user who wishes to identify the infection
prior to removing it. 
</p>
        <p>
          <a href="http://sync-io.net/Community/Rainbow/MalwareIdentity.mht">http://sync-io.net/Community/Rainbow/MalwareIdentity.mht</a>
        </p>
        <p>
A great resource for computing and networking concepts can be found at about.com.
</p>
        <p>
          <a href="http://compnetworking.about.com/od/basicnetworkingconcepts/">http://compnetworking.about.com/od/basicnetworkingconcepts/</a>
        </p>
        <p>
          <a href="http://www.about.com/compute/">http://www.about.com/compute/</a>
        </p>
        <p>
NSA has developed guides to securing your operating system.
</p>
        <p>
          <a href="http://www.nsa.gov/snac/downloads_os.cfm?MenuID=scg10.3.1">http://www.nsa.gov/snac/downloads_os.cfm?MenuID=scg10.3.1</a>.
</p>
        <p>
 
</p>
        <p>
In an upcoming blog I will describe the practical ways of recognizing malware before
it infects your computer...
</p>
        <img width="0" height="0" src="http://sync-io.net:83/aggbug.ashx?id=4b1b52ce-132a-4d5d-9e9b-70a2df823f6c" />
      </div>
    </content>
  </entry>
</feed>