<?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 Re: Question regarding brute force query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390160#M169439</link>
    <description>&lt;P&gt;Here's one way - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="wineventlog" sourcetype=wineventlog:security
(EventCode=4624 OR EventCode=4625 OR EventCode=4648 OR 
 EventCode=4768 OR EventCode=4769 OR EventCode=4771 OR 
 EventCode=4776) 
| stats dc(action) as Attempts, 
        count(eval(match(action,"failure"))) as Failed, 
        count(eval(match(action,"success"))) as Success 
        max(eval(case(match(action,"failure"),_time))) as lastFailed
        max(eval(case(match(action,"success"),_time))) as lastSuccess
        values(src) as src by user dest 
| where Attempts&amp;gt;1 AND Failed&amp;gt;10 AND Success&amp;gt;0
| where lastFailed &amp;lt; lastSuccess
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would work for what you asked for, but I'm not sure it really meets the business need.  &lt;/P&gt;

&lt;P&gt;Think about it this way - your actual employee or client could be trying to use his account as well during any given time frame, so a success that is unrelated to the brute force attack could be coincidentally in the time frame of your search.&lt;/P&gt;

&lt;P&gt;It seems like, if there are ten failures, THEN you need to analyze the successes in light of the failures.  Let me see if I can put something like that together.   &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Okay, this version is going to give you much closer to what you need.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="wineventlog" sourcetype=wineventlog:security
(EventCode=4624 OR EventCode=4625 OR EventCode=4648 OR 
 EventCode=4768 OR EventCode=4769 OR EventCode=4771 OR 
 EventCode=4776) 
| eventstats count(eval(match(action,"failure"))) as Failed, 
        count(eval(match(action,"success"))) as Success 
        by user dest 
| where Failed &amp;gt;= 10  AND Success &amp;gt; 0
| rename COMMENT as "The above gets rid of all events that are obviously not matches"


| rename COMMENT as "Sort into order, then add up strings of failures or successes"
| sort 0 user dest _time 
| streamstats reset_on_change=t count as UDcount by user dest action

| rename COMMENT as "Copy the prior record info, then test for a success after 10+ failures"
| streamstats current=f last(UDcount) as prevUDcount last(action) as prevAction by user dest
| eval KeepMe=case(action="success" AND prevAction="failure" AND prevUDcount &amp;gt;=10,"KeepMe")

| eventstats max(KeepMe) as KeepAll by user dest
| where KeepAll="KeepMe"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;At this point, you have all events for any suspicious combo of user and dest retained together.  The one success after a long row of failures will be marked with KeepMe="KeepMe", and the rest will be marked with KeepAll="KeepMe".&lt;/P&gt;</description>
    <pubDate>Mon, 14 May 2018 14:38:03 GMT</pubDate>
    <dc:creator>DalJeanis</dc:creator>
    <dc:date>2018-05-14T14:38:03Z</dc:date>
    <item>
      <title>Question regarding brute force query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390159#M169438</link>
      <description>&lt;P&gt;Please see this query for brute force detection-&lt;BR /&gt;
index="wineventlog" sourcetype=wineventlog:security  | search (EventCode=4624 OR EventCode=4625 OR EventCode=4648 OR EventCode=4768 OR EventCode=4769 OR EventCode=4771 OR EventCode=4776) | stats dc(action) as Attempts, count(eval(match(action,"failure"))) as Failed, count(eval(match(action,"success"))) as Success values(src) as src by user dest |where Attempts&amp;gt;1 AND Failed&amp;gt;10 AND Success&amp;gt;0.....&lt;BR /&gt;
So now whats happening i am getting results for failed&amp;gt;10 and success&amp;gt;0 but there could be scenario where 1st event would be success followed by 10 failures thats also coming but we dont want that .....its not brute force attack ....how i can accomplish first 10 events of failed followed by 11th event of success.&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 12:20:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390159#M169438</guid>
      <dc:creator>rahul_mckc_splu</dc:creator>
      <dc:date>2018-05-14T12:20:35Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding brute force query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390160#M169439</link>
      <description>&lt;P&gt;Here's one way - &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="wineventlog" sourcetype=wineventlog:security
(EventCode=4624 OR EventCode=4625 OR EventCode=4648 OR 
 EventCode=4768 OR EventCode=4769 OR EventCode=4771 OR 
 EventCode=4776) 
| stats dc(action) as Attempts, 
        count(eval(match(action,"failure"))) as Failed, 
        count(eval(match(action,"success"))) as Success 
        max(eval(case(match(action,"failure"),_time))) as lastFailed
        max(eval(case(match(action,"success"),_time))) as lastSuccess
        values(src) as src by user dest 
| where Attempts&amp;gt;1 AND Failed&amp;gt;10 AND Success&amp;gt;0
| where lastFailed &amp;lt; lastSuccess
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This would work for what you asked for, but I'm not sure it really meets the business need.  &lt;/P&gt;

&lt;P&gt;Think about it this way - your actual employee or client could be trying to use his account as well during any given time frame, so a success that is unrelated to the brute force attack could be coincidentally in the time frame of your search.&lt;/P&gt;

&lt;P&gt;It seems like, if there are ten failures, THEN you need to analyze the successes in light of the failures.  Let me see if I can put something like that together.   &lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Okay, this version is going to give you much closer to what you need.  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="wineventlog" sourcetype=wineventlog:security
(EventCode=4624 OR EventCode=4625 OR EventCode=4648 OR 
 EventCode=4768 OR EventCode=4769 OR EventCode=4771 OR 
 EventCode=4776) 
| eventstats count(eval(match(action,"failure"))) as Failed, 
        count(eval(match(action,"success"))) as Success 
        by user dest 
| where Failed &amp;gt;= 10  AND Success &amp;gt; 0
| rename COMMENT as "The above gets rid of all events that are obviously not matches"


| rename COMMENT as "Sort into order, then add up strings of failures or successes"
| sort 0 user dest _time 
| streamstats reset_on_change=t count as UDcount by user dest action

| rename COMMENT as "Copy the prior record info, then test for a success after 10+ failures"
| streamstats current=f last(UDcount) as prevUDcount last(action) as prevAction by user dest
| eval KeepMe=case(action="success" AND prevAction="failure" AND prevUDcount &amp;gt;=10,"KeepMe")

| eventstats max(KeepMe) as KeepAll by user dest
| where KeepAll="KeepMe"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;At this point, you have all events for any suspicious combo of user and dest retained together.  The one success after a long row of failures will be marked with KeepMe="KeepMe", and the rest will be marked with KeepAll="KeepMe".&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 14:38:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390160#M169439</guid>
      <dc:creator>DalJeanis</dc:creator>
      <dc:date>2018-05-14T14:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding brute force query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390161#M169440</link>
      <description>&lt;P&gt;where lastFailed &amp;lt; lastSuccess is giving all failed followed by success ....(it is going wrong here)--if i have 100 success then i have 10 failures then again i have 100 success so this condition for where lastFailed &amp;lt; lastSuccess is true...&lt;/P&gt;

&lt;P&gt;I mean i should be true only when we first have failures followed by success not.... success then failures then again success...&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 16:49:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390161#M169440</guid>
      <dc:creator>rahul_mckc_splu</dc:creator>
      <dc:date>2018-05-14T16:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Question regarding brute force query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390162#M169441</link>
      <description>&lt;P&gt;please do the needful&lt;/P&gt;</description>
      <pubDate>Tue, 15 May 2018 08:17:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Question-regarding-brute-force-query/m-p/390162#M169441</guid>
      <dc:creator>rahul_mckc_splu</dc:creator>
      <dc:date>2018-05-15T08:17:30Z</dc:date>
    </item>
  </channel>
</rss>

