<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Threat-Hunting on Riccardo Ancarani</title><link>https://riccardoancarani.github.io/tags/threat-hunting/</link><description>Recent content in Threat-Hunting on Riccardo Ancarani</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sat, 10 Oct 2020 00:00:00 +0000</lastBuildDate><atom:link href="https://riccardoancarani.github.io/tags/threat-hunting/index.xml" rel="self" type="application/rss+xml"/><item><title>Following Donut Crumbs</title><link>https://riccardoancarani.github.io/2020-10-10-following-donut-crumbs/</link><pubDate>Sat, 10 Oct 2020 00:00:00 +0000</pubDate><guid>https://riccardoancarani.github.io/2020-10-10-following-donut-crumbs/</guid><description>&lt;!-- MDTOC maxdepth:6 firsth1:1 numbering:0 flatten:0 bullets:1 updateOnSave:1 --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#intro"&gt;Intro&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#observations"&gt;Observations&lt;/a&gt; 
&lt;ul&gt;
&lt;li&gt;&lt;a href="#in-memory-pe"&gt;In-Memory PE&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#amsi-bypass"&gt;AMSI Bypass&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;!-- /MDTOC --&gt;
&lt;h2 id="intro"&gt;Intro&lt;/h2&gt; &lt;p&gt;To deal with some rainy Sunday depression I decided to investigate how &lt;a href="https://github.com/TheWover/donut" target="_blank" rel="noopener"&gt;Donut&lt;/a&gt; operates in memory and to see what traces it leaves (if any). I&amp;rsquo;ve been using Donut for quite some time, and I find it extremely useful from an operator&amp;rsquo;s perspective as it gives a lot of flexibility.&lt;/p&gt;
&lt;p&gt;For those who don&amp;rsquo;t know what Donut is, we could define it as a software that allows the conversion from PE/.NET assemblies/scripts into position independent code (PIC, or shellcode). When I first read the initial release paper, it sounded like black magic to me; but after some time and experience I started realising how it works (at an high level, 90% still magic) it made more sense.&lt;/p&gt;</description></item><item><title>Hunting for Skeleton Key Implants</title><link>https://riccardoancarani.github.io/2020-08-08-hunting-for-skeleton-key-implants/</link><pubDate>Sat, 08 Aug 2020 00:00:00 +0000</pubDate><guid>https://riccardoancarani.github.io/2020-08-08-hunting-for-skeleton-key-implants/</guid><description>&lt;!-- MDTOC maxdepth:6 firsth1:1 numbering:0 flatten:0 bullets:1 updateOnSave:1 --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#introduction"&gt;Introduction&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#attack-execution"&gt;Attack Execution&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#detection"&gt;Detection&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#other-detections-and-indicators"&gt;Other Detections and Indicators&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#references"&gt;References&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;!-- /MDTOC --&gt;
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt; &lt;p&gt;During a &lt;a href="https://github.com/RiccardoAncarani/talks/tree/master/r00tMI" target="_blank" rel="noopener"&gt;recent presentation&lt;/a&gt; I examined various ways of persisting within Active Directory (AD) and how every technique can be detected, using both intrinsic IoC of the specific technique or tooling default behaviour. One of the analysed attacks was the &lt;a href="https://attack.mitre.org/software/S0007/" target="_blank" rel="noopener"&gt;skeleton key&lt;/a&gt; implant.&lt;/p&gt;
&lt;p&gt;At an high level, skeleton key is an attack where an adversary deploys some code in a Domain Controller that alters the normal Kerberos/NTLM authentication process. Doing so, the attackers would have the ability to use a secondary and arbitrary password to impersonate any user within the domain, but without the operational risk of changing the actual password of the user. This attack is particularly effective because the victim user will still be able to use its password and therefore the set of changes in term of the AD structure is minimal if not non-existent.&lt;/p&gt;</description></item><item><title>Hunting for Impacket</title><link>https://riccardoancarani.github.io/2020-05-10-hunting-for-impacket/</link><pubDate>Sun, 10 May 2020 00:00:00 +0000</pubDate><guid>https://riccardoancarani.github.io/2020-05-10-hunting-for-impacket/</guid><description>&lt;!-- MDTOC maxdepth:6 firsth1:1 numbering:0 flatten:0 bullets:1 updateOnSave:1 --&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#introduction"&gt;Introduction&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#tools"&gt;Tools&lt;/a&gt; 
&lt;ul&gt;
&lt;li&gt;&lt;a href="#secretsdumppy"&gt;secretsdump.py&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#wmiexecpy"&gt;wmiexec.py&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="#dcomexecpy"&gt;dcomexec.py&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#final-words"&gt;Final Words&lt;/a&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;!-- /MDTOC --&gt;
&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt; &lt;p&gt;During an attack, lateral movement is crucial in order to achieve the operation&amp;rsquo;s objectives. Primarly, two main strategies exist that would allow an attacker to execute code or exfiltrate data from other hosts after obtaining a foothold within an environment:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Operate from the compromised endpoint/s&lt;/li&gt;
&lt;li&gt;Pivot and use their tooling to access other targets&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Operating from a compromised endpoint has its risks, every action you take as an attacker gives the blue team a detection opportunity (line totally stolen from Raphael Mudge from his &lt;a href="https://www.youtube.com/playlist?list=PL9HO6M_MU2nfQ4kHSCzAQMqxQxH47d1no" target="_blank" rel="noopener"&gt;videos&lt;/a&gt; ).&lt;/p&gt;</description></item><item><title>Hunting for SCShell Usage Using ELK</title><link>https://riccardoancarani.github.io/2019-12-16-hunting-for-scshell-usage-using-elk/</link><pubDate>Mon, 16 Dec 2019 00:00:00 +0000</pubDate><guid>https://riccardoancarani.github.io/2019-12-16-hunting-for-scshell-usage-using-elk/</guid><description>&lt;h2 id="introduction"&gt;Introduction&lt;/h2&gt; &lt;p&gt;In today&amp;rsquo;s post we&amp;rsquo;re going to create detections and hunt for the usage of the recent lateral movement technique called &lt;a href="https://github.com/Mr-Un1k0d3r/SCShell" target="_blank" rel="noopener"&gt;SCShell&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;In a nutshell, the SCShell technique is born from the limitation of lateral movement attacks like remote service creation that required the attacker to drop files on the remote filesystem. Raphael Mudge&amp;rsquo;s post &lt;a href="https://blog.cobaltstrike.com/2014/04/30/lateral-movement-with-high-latency-cc/" target="_blank" rel="noopener"&gt;Covert Lateral Movement with High-Latency C&amp;amp;C &lt;/a&gt; explains how it is possible to create remote services to execute cobaltstrike&amp;rsquo;s beacon after transferring it to the target&amp;rsquo;s host.
The aforementioned technique leaves considerable traces on the target host:&lt;/p&gt;</description></item><item><title>Hunting for Anomalous Usage of MSBuild and Covenant</title><link>https://riccardoancarani.github.io/2019-10-19-hunting-for-anomalous-usage-of-msbuild-and-covenant/</link><pubDate>Sat, 19 Oct 2019 00:00:00 +0000</pubDate><guid>https://riccardoancarani.github.io/2019-10-19-hunting-for-anomalous-usage-of-msbuild-and-covenant/</guid><description>&lt;p&gt;Today&amp;rsquo;s post will cover some of my experiments while practicing threat hunting. Specifically today we will cover hunting for malicious usage of &lt;code&gt;msbuild.exe&lt;/code&gt; used by Covenant.&lt;/p&gt;
&lt;p&gt;I literally started last week, so forgive me if I&amp;rsquo;m not following logging best practices or some detections are very unreliable!&lt;/p&gt;
&lt;p&gt;It must be noted that this specific case will fall under the class of tools default behaviours. For example, using similar techniques it would be possible to hunt for cobaltstrike&amp;rsquo;s default &lt;code&gt;spawn&lt;/code&gt; process &lt;code&gt;rundll32.exe&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Hunting for Suspicious LDAP Activity with SilkETW and Yara</title><link>https://riccardoancarani.github.io/2019-10-19-hunting-for-suspicious-ldap-activity-with-silketw-and-yara/</link><pubDate>Sat, 19 Oct 2019 00:00:00 +0000</pubDate><guid>https://riccardoancarani.github.io/2019-10-19-hunting-for-suspicious-ldap-activity-with-silketw-and-yara/</guid><description>&lt;h3 id="intro"&gt;Intro&lt;/h3&gt; &lt;p&gt;This is another post to document my journey of learning Threat Hunting. In today&amp;rsquo;s post we&amp;rsquo;re going to perform threat hunting activities with the aim of hunting for AD domain enumeration.&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re going to heavily rely on FireEye&amp;rsquo;s SilkETW and we&amp;rsquo;ll search for suspicious LDAP queries generated by our endpoints.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/fireeye/SilkETW" target="_blank" rel="noopener"&gt;SilkETW&lt;/a&gt; is a handy wrapper for Event Tracing for Windows (ETW) that will allow us to perform searches and ship to centralised logging platforms like ElasticSearch. ETW is defined by Microsoft as:&lt;/p&gt;</description></item></channel></rss>