{"id":1530,"date":"2021-06-28T09:47:04","date_gmt":"2021-06-28T09:47:04","guid":{"rendered":"https:\/\/cas.cybercop-training.ch\/?page_id=1530"},"modified":"2021-06-28T11:25:48","modified_gmt":"2021-06-28T11:25:48","slug":"lab-3-create-hunts","status":"publish","type":"page","link":"https:\/\/cas.cybercop-training.ch\/index.php\/lab-3-create-hunts\/","title":{"rendered":"LAB 3 (Create Hunts)"},"content":{"rendered":"<h2>Task1 &#8211; Create a hunt for RDP brute force<\/h2>\n<p>If you have not done so, or you are not sure enable RDP. To do this open an elevated PowerShell in your Windows 10 VM:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Set-ItemProperty -Path 'HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server' -name \"fDenyTSConnections\" -value 0\r\nEnable-NetFirewallRule -DisplayGroup \"Remote Desktop\"<\/pre>\n<p>Perform an RDP bruteforce attack from your live cd:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Perform an RDP bruteforce attack from your live cd:\r\ncp \/usr\/share\/wordlists\/rockyou.txt.gz ~\r\ncd ~\r\ngunzip rockyou.txt.gz\r\nhydra -t 1 -V -f -l someuser -P rockyou.txt rdp:\/\/IP.OF.YOUR-WIN10.VM&lt;\/code&gt;&lt;\/pre&gt;\r\nWrite a detection rule for RDP bruteforce (e.g. X attacks in Y minutes).<\/pre>\n<h2>Task2 &#8211; Create a hunt for User added to local admin group<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">Run the following code on your Windows 10 VM in an elevated PowerShell:\r\nNew-LocalUser -Name \"hacker\" -Description \"Description of this account.\" -NoPassword\r\nAdd-LocalGroupMember -Group \"Administrators\" -Member \"hacker\"<\/pre>\n<h2>Answer and solution<\/h2>\n<h2>Hunt for Task 1<\/h2>\n<p>IP Address of my Hackinglab: <code>192.168.71.131<\/code><\/p>\n<p>Monitored Win10 Target: <code>192.168.71.130<\/code><\/p>\n<p>Starting RDP Bruteforce Attack with Hydra:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/bruteforce01.png\" alt=\"\" \/><\/p>\n<p>After a short while I can see the failed login attempts in my elastic cloud kibana dashboard:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/bruteforce02-1.png\" alt=\"\" \/><\/p>\n<p>For every failed login attempt a Windows <code>EventID 4625<\/code> is created.<br \/>\nNormally I&#8217;d suggest to create a treshold rule for that. That&#8217;s an effective way to detect bruteforce attacks.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/threshold_rule.png\" alt=\"\" \/><\/p>\n<p>But we need something in EQL. Let&#8217;s check the events:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/bruteforce03-1.png\" alt=\"\" \/><\/p>\n<p>Maybe we can create a rule where event.action contains <code>logon-failed<\/code> and destination.port is RDP <code>3389<\/code><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sequence with maxspan=5m\r\n[any where event.action like~ \"logon-failed\"]\r\n[any where event.action like~ \"logon-failed\"]\r\n[any where event.action like~ \"logon-failed\"]\r\n[any where event.action like~ \"logon-failed\"]\r\n[any where event.action like~ \"logon-failed\"]\r\n[any where destination.port == 3389]\r\n[any where destination.port == 3389]\r\n[any where destination.port == 3389]\r\n[any where destination.port == 3389]<\/pre>\n<p>Rule check in the <code>Correlation tab<\/code>! For some reasons the agent did generate thousands of events which made my console very slow \ud83d\ude41<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/bruteforce04.png\" alt=\"\" \/><\/p>\n<p>After creating the rule I did fire up again hydra and could immediatily see the results:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/bruteforce05.png\" alt=\"\" \/><\/p>\n<h2>Hunt for Task 2<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/user_add.png\" alt=\"\" \/><\/p>\n<p>Let&#8217;s check the timeline for events:<\/p>\n<p>The event.category <code>iam<\/code> looks interessting!<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/user_add02.png\" alt=\"\" \/><\/p>\n<p>I modify the filter and get some more results:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/user_add03.png\" alt=\"\" \/><\/p>\n<p>To finally build the rule I need the group name:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/user_add04.png\" alt=\"\" \/><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">sequence with maxspan=5m\r\n[iam where event.action == \"added-user-account\"]\r\n[iam where event.action == \"added-member-to-group\" and  user.target.group.name like~\"Administratoren\"]<\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/cas.cybercop-training.ch\/wp-content\/uploads\/2021\/06\/user_add05.png\" alt=\"\" \/><\/p>\n<h2>Notes<\/h2>\n<p>It looks like an easy exercise, but for various reasons it was very timeconsuming for me:<\/p>\n<ul>\n<li>it was a complete new tool for me (never worked with a elastic stack before)<\/li>\n<li>had problems to get familar with the EQL syntax<\/li>\n<li>sometimes the dashboard did react very slow if you don&#8217;t set filters<\/li>\n<li>took some time to find the transition from events to correlation and howto apply the EQL then<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Task1 &#8211; Create a hunt for RDP brute force If you have not done so, or you are not sure enable RDP. To do this open an elevated PowerShell in your Windows 10 VM: Set-ItemProperty -Path &#8218;HKLM:\\System\\CurrentControlSet\\Control\\Terminal Server&#8216; -name &#8222;fDenyTSConnections&#8220; -value 0 Enable-NetFirewallRule -DisplayGroup &#8222;Remote Desktop&#8220; Perform an RDP bruteforce attack from your live cd: [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1530","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/cas.cybercop-training.ch\/index.php\/wp-json\/wp\/v2\/pages\/1530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cas.cybercop-training.ch\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/cas.cybercop-training.ch\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/cas.cybercop-training.ch\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cas.cybercop-training.ch\/index.php\/wp-json\/wp\/v2\/comments?post=1530"}],"version-history":[{"count":4,"href":"https:\/\/cas.cybercop-training.ch\/index.php\/wp-json\/wp\/v2\/pages\/1530\/revisions"}],"predecessor-version":[{"id":1572,"href":"https:\/\/cas.cybercop-training.ch\/index.php\/wp-json\/wp\/v2\/pages\/1530\/revisions\/1572"}],"wp:attachment":[{"href":"https:\/\/cas.cybercop-training.ch\/index.php\/wp-json\/wp\/v2\/media?parent=1530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}