<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do I search WindowsEventLog:Security to determine Parent Process of each started process? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227896#M44407</link>
    <description>&lt;P&gt;&lt;STRONG&gt;TL;DR&lt;/STRONG&gt; - I want a query to search through Windows Security Event Logs (Type 4688 - A new process has been created) and return all processes along with their parent process &lt;EM&gt;name&lt;/EM&gt; sorted by host.  This will eventually be a dashboard for any process that violates common parent/child relationships (ie. lsass.exe started by calc.exe).&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Problem&lt;/STRONG&gt;:&lt;BR /&gt;
Windows Security Event Logs do not record the &lt;EM&gt;name&lt;/EM&gt; of the parent process of newly started processes (Type 4688) only the hex value of the Parent Process ID (Creator_Process_ID).  But because I have these logs, I can manually use the Creator_Process_ID and find the event that has the same host and a New_Process_ID value that matches the Creator_Process_ID from the event in question.&lt;/P&gt;

&lt;P&gt;I have created two separate queries:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;One that returns all processes along with their associated host and process ID&lt;BR /&gt;
&lt;CODE&gt;index=wineventlog sourcetype=WinEventLog:Security EventCode=4688 | rename New_Process_ID as PID host as Source New_Process_Name as Process | dedup PID Source | table PID Source Process&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;A second that returns all processes along with their associated Creator_Process_ID&lt;BR /&gt;
&lt;CODE&gt;index=wineventlog sourcetype=WinEventLog:Security EventCode=4688 New_Process_Name=*smss.exe | table host New_Process_Name Creator_Process_ID&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I now need to figure out how to map the Creator_Process_ID from the second query to the name of the process from that host/PID from the first query.  I have tried some &lt;CODE&gt;JOIN&lt;/CODE&gt; queries but am not knowledgeable enough in such things to know if that is even the right approach. &lt;/P&gt;

&lt;P&gt;Thanks for the help. &lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 11:15:53 GMT</pubDate>
    <dc:creator>tmsteen</dc:creator>
    <dc:date>2020-09-29T11:15:53Z</dc:date>
    <item>
      <title>How do I search WindowsEventLog:Security to determine Parent Process of each started process?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227896#M44407</link>
      <description>&lt;P&gt;&lt;STRONG&gt;TL;DR&lt;/STRONG&gt; - I want a query to search through Windows Security Event Logs (Type 4688 - A new process has been created) and return all processes along with their parent process &lt;EM&gt;name&lt;/EM&gt; sorted by host.  This will eventually be a dashboard for any process that violates common parent/child relationships (ie. lsass.exe started by calc.exe).&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Problem&lt;/STRONG&gt;:&lt;BR /&gt;
Windows Security Event Logs do not record the &lt;EM&gt;name&lt;/EM&gt; of the parent process of newly started processes (Type 4688) only the hex value of the Parent Process ID (Creator_Process_ID).  But because I have these logs, I can manually use the Creator_Process_ID and find the event that has the same host and a New_Process_ID value that matches the Creator_Process_ID from the event in question.&lt;/P&gt;

&lt;P&gt;I have created two separate queries:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;One that returns all processes along with their associated host and process ID&lt;BR /&gt;
&lt;CODE&gt;index=wineventlog sourcetype=WinEventLog:Security EventCode=4688 | rename New_Process_ID as PID host as Source New_Process_Name as Process | dedup PID Source | table PID Source Process&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;A second that returns all processes along with their associated Creator_Process_ID&lt;BR /&gt;
&lt;CODE&gt;index=wineventlog sourcetype=WinEventLog:Security EventCode=4688 New_Process_Name=*smss.exe | table host New_Process_Name Creator_Process_ID&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;I now need to figure out how to map the Creator_Process_ID from the second query to the name of the process from that host/PID from the first query.  I have tried some &lt;CODE&gt;JOIN&lt;/CODE&gt; queries but am not knowledgeable enough in such things to know if that is even the right approach. &lt;/P&gt;

&lt;P&gt;Thanks for the help. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:15:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227896#M44407</guid>
      <dc:creator>tmsteen</dc:creator>
      <dc:date>2020-09-29T11:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search WindowsEventLog:Security to determine Parent Process of each started process?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227897#M44408</link>
      <description>&lt;P&gt;May be  more efficient to store the results of the first query in a lookup csv and use that in your second query.  I assume new processes do not get added very frequently, you could schedule the first query to run once a day (or more freq, if needed). Here's how you could do that. Once you have setup the .csv file as a lookup table &amp;amp; set appropriate lookup definition, run this at whatever frequency&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog sourcetype=WinEventLog:Security EventCode=4688 | rename New_Process_ID as PID host as Source New_Process_Name as Process | dedup PID Source | fields PID Source Process | outputlookup lookupfile.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Once you have that (you can verify by running &lt;CODE&gt;|inputlookup lookupfile.csv&lt;/CODE&gt;), use &lt;CODE&gt;lookup&lt;/CODE&gt; command to get process name in second query. Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog sourcetype=WinEventLog:Security EventCode=4688 New_Process_Name=*smss.exe | lookup PID AS Creator_Process_ID OUTPUT Source | table host New_Process_Name Creator_Process_ID Source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/SearchReference/Lookup"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/SearchReference/Lookup&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 16:10:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227897#M44408</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-03T16:10:10Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search WindowsEventLog:Security to determine Parent Process of each started process?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227898#M44409</link>
      <description>&lt;P&gt;Thanks for the answer.  I will play around with this today. &lt;/P&gt;

&lt;P&gt;Processes could be starting all the time, so this may not work for real time detection but should suffice for doing historical analysis. &lt;/P&gt;

&lt;P&gt;Can I manually run the lookup whenever I want and then follow up with the second query as needed?  &lt;/P&gt;

&lt;P&gt;End goal is to turn this into a dashboard panel so ultimately I would want both queries to run on demand in some sort of automated or 'one-click' fashion. &lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 16:24:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227898#M44409</guid>
      <dc:creator>tmsteen</dc:creator>
      <dc:date>2016-10-03T16:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search WindowsEventLog:Security to determine Parent Process of each started process?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227899#M44410</link>
      <description>&lt;P&gt;Yes, you can manually run to generate the lookup file. The other option would be to join the two queries, but anytime you use sub-searches, the queries run longer.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 16:37:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227899#M44410</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-03T16:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search WindowsEventLog:Security to determine Parent Process of each started process?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227900#M44411</link>
      <description>&lt;P&gt;Just got it working, at least manually.  Seems like it does the lookup portion separately so that part of the resulting table takes a small amount of time longer to generate but the results are exactly what I was looking for.  Thanks. &lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 18:52:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227900#M44411</guid>
      <dc:creator>tmsteen</dc:creator>
      <dc:date>2016-10-03T18:52:39Z</dc:date>
    </item>
    <item>
      <title>Re: How do I search WindowsEventLog:Security to determine Parent Process of each started process?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227901#M44412</link>
      <description>&lt;P&gt;Incomplete solution: Note that your "&lt;STRONG&gt;dedup PID Source&lt;/STRONG&gt;" command in the first search discards multiple new process events, since the PID (Process ID) is quite frequently reused on Windows (i.e. even within 1 hour on my test system), so you are only collecting the latest Process name tied to that PID at the time of the search -- i.e. not necessarily the Process name / PID that was the "Creator_Process_ID" in your second search. Instead try "&lt;STRONG&gt;| table _time PID Source Process | sort PID - _time&lt;/STRONG&gt;" or "&lt;STRONG&gt;| stats count values(Process) by PID&lt;/STRONG&gt;"  to see what you are discarding.&lt;/P&gt;

&lt;P&gt;Unfortunately this rather common use case appears to be a rather complex one to solve efficiently.&lt;/P&gt;

&lt;P&gt;Update: Just noticed that Win 10 and Server 2016 added "&lt;STRONG&gt;Creator_Process_Name&lt;/STRONG&gt;" field which would help identify parent &amp;amp; child process in the same event, and Sysmon new process Event ID 1 also includes "&lt;STRONG&gt;ParentImage&lt;/STRONG&gt;" name as well. ( &lt;A href="https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688" target="_blank"&gt;ref msft&lt;/A&gt; &lt;A href="https://securityaffairs.co/wordpress/65570/hacking/powershell-attacks.html" target="_blank"&gt;ref securityaffairs&lt;/A&gt; &lt;A href="https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=4688" target="_blank"&gt;ref sec:4688&lt;/A&gt; &lt;A href="https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?source=Sysmon&amp;amp;eventID=1" target="_blank"&gt;ref sysmon:1&lt;/A&gt;)&lt;/P&gt;

&lt;P&gt;1: &lt;A href="https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688" target="_blank"&gt;https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/event-4688&lt;/A&gt;&lt;BR /&gt;
  2: &lt;A href="https://securityaffairs.co/wordpress/65570/hacking/powershell-attacks.html" target="_blank"&gt;https://securityaffairs.co/wordpress/65570/hacking/powershell-attacks.html&lt;/A&gt;&lt;BR /&gt;
  3: &lt;A href="https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=4688" target="_blank"&gt;https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?eventid=4688&lt;/A&gt;&lt;BR /&gt;
  4: &lt;A href="https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?source=Sysmon&amp;amp;eventID=1" target="_blank"&gt;https://www.ultimatewindowssecurity.com/securitylog/encyclopedia/event.aspx?source=Sysmon&amp;amp;eventID=1&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:11:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-I-search-WindowsEventLog-Security-to-determine-Parent/m-p/227901#M44412</guid>
      <dc:creator>bwlm</dc:creator>
      <dc:date>2020-09-30T01:11:29Z</dc:date>
    </item>
  </channel>
</rss>

