Welcome. Thanks for joining this session of Blue Team Village Project Obsidian Incident Response and Huda Loop. My name is Julien and I will be your guide for this work. It will focus on the Huda Loop and how to use it during security incident response and illustrated by two alert case of the same incident. This is part of multiple walkthroughs around incident response, but also forensic, threat intel and various other aspects of cyber defense. We encourage you to attend other sessions, be it in real life or virtually. One of those is around triage and scoping, for which we will do a very quick reminder. Our agenda will be a quick introduction. The Huda Loop is a project that we are working on. We hope some key questions for incident response or two alert case, a lesson learned and conclusion. For incident response, we will start with the triage and scoping. This is developed in a different session. But as a reminder, the six phases of a security incident are preparation, identification, containment, eradication. Recovery and lesson learned. And as a fundamental part, always keep in mind that you should document, document and document what you are doing. Be it for your colleague, be it for an auditor, be it for your management. This is necessary for any security incident response. Please note also this presentation and the corresponding notebook will be available after DEF CON. Let's move to the Huda Loop. The Huda Loop has been developed by US Colonel John Boyd from the US Air Force in the 60s, following his experience during the Korean War. It was initially for dogfight, but the concept is widely applicable, most notably for us to security incident. What does Huda mean? Observe, orient, decide and act. It's a quick sequence of steps that during a dogfight helps you to assess the situation and evaluate where you are, what action you want to take and take the action. And it's usually operated multiple times inside a dogfight to help you win against your attacker. Ideally, because you are operating this loop faster than the attacker. It's kind of similar to the Deming Wheel in ISO standard, the famous Plan, Do, Check, Act, but more at the micro level versus the macro level of ISO standard. Obviously, all the observation, orientation, decision will be based on the context. Of outside information, of cultural information and past experience. Whatever has been analyzed during this event. Key question. During an incident, what is very important is identifying what you know and what you don't know. To quote Donald Allen Ransom, There are no knowns. There are known unknowns. And there are unknown knowns and unknown unknowns. The usual start is often, is it a false positive? Is it a known legitimate activity, known testing, be it a pen testing or something else? Do we have enough visibility to assess the situation and at a sufficient confidence level? That's very essential to say. We are not making confirmation bias and mis-evaluating things because we have just, for example, one source of information which would maybe not be reliable. We want to be sure that evidence can be preserved. To ensure that your colleague can do the same assessment. Or if things go to court, that court can evaluate the same situation. With the same information. We want to know, obviously, which users are impacted. Which role and permissions they had. Same thing for system. We want to know what stage of the attack it is. And is it live, active versus the attacker has left and you are only doing basically the cleaning or preventing the attacker to come back. How did it start? Who or what is the patient zero? Did lateral movement occur? Do we have just a single system impacted? Or are there many? Which data attacker has access with some legal impact? And last but not least, what is the business impact? Were there service unavailabilities? Some information disclosure or data tampering? Let's move to an early alert. As part of Project Obsidian, team has simulated different scenario and kill chain. Now we will see what happens is during an early level of this attack. We got a notification. In this case, user Brent Sorson got an email notification that he logged in the company gem post. But he didn't. In a very good company member, he notified security. You are security. What are you doing? So identification phase. As said for the OODA loop, we will do some question. Each question will result in one or maybe multiple observation. Those observation will orient investigation and result in decision and action. One quick reminder as a start for any incident or alert. Have a ticket where you will document things. Acknowledge the alert to the user when it's a manual report. And share the ticket reference. Depending on the context, you might or might not share more information. Document what's known, what's unknown, what's your understanding of the initial reporting of the alert. It's important to know that not all users are reporting things the same way. And one user can share a lot. A lot of details when another will give you, my computer is crashing. And you will have to ask the question to say, yeah, okay, is it a security incident? And why, what ints you to make a security report? Following this documentation and as part of avoiding any bias, you want to regularly have peer review. First iteration of the OODA loop. From an observation perspective, we look at the AD authentication log. Which show a password spray attack has happened and multiple accounts were compromised. We can orient ourselves by reaching out to IT or helpdesk to validate there is no related activity, pen testing, testing or similar that could be associated to this behavior. After we want to decide, do we want to move to the next phase or to more identification? Let's review how we can do this authentication. As part of our Jupyter Notebook, we are using MysticPy library to do a Splunk query. As an example, we collect successful and failed logon. Per user account and source IP. If we try to visualize this data, we have a nice chart on the AD authentication by user. And we can see this line, which is nearly always associated with a password spray. So normally this graph is interactive inside the presentation mode. It does not render as well as we want, but we can change things. Let's see a snapshot of the rendering where we have more of the user, but we can see that all the users of the company basically have an attempt to login. On the chart, we don't see if it's failed or not. Or successful. But if we review another visualization per IP user versus IP, we can see that all those logins are coming from a single IP address, which for some reason I can't change in the presentation. Sorry for that. With all the information, it's easier to say from the log, I want to get all successful logins from this identified attacker source IP. Which from your security documentation and all your IT documentation, you can confirm if this source IP is related to your company or not. In this case, we can find that from a single IP. We have five different users that have login and public IP. So it's likely that the attacker is using this as an entry point. Just with authentication log, we know the attack vector is a password spray. We have the source IP of the attacker. Maybe there is a single one. Maybe there is more. We have identified there is not just one account compromised, but five. It's important here to have not jumped the gun compared to the user report where if you had actions directly, you would have only one user contained or disabled. And which would not have blocked the attacker because there were five access. On the few things we don't know, are those account privileged? Are there any other entry points? And what activity happened after that? For further iteration of the Houda loop, we can check if there were password reset, if some MFA change happened, if some cloud app token changed. We may want to collect more information, be it through a VM snapshot or more granular artifact collection like process activity, network activity, etc. Depending on your environment, we may want to add telemetry if it's missing, host agent, log collection, network collection like IDS, IPS. And depending on your assessment of the incident, notify management. Depending on your company, that may happen earlier, that may happen later. Depends on your process. We won't dig further in this early alert case because we will review in the later alert case. Now moving to the contentment. Contentment should be proportional to the type of incident and the business impact. You are unlikely to stop a service that brings millions of revenue. If you have a small phishing from an agent. If you are a Nigerian president. And if the attacker is exfiltrating your customer data or your company intellectual property, it's very likely that action should be taken immediately. Those questions should be asked to your leadership early on and ideally in preparation phase, not during the incident. First typical action for contentment lock, disable the affected user account. We may re-evaluate. Is it enough? If it's not enough, we can decide to contain or isolate compromised system or suspicious one. If email propagation is used, we may want to freeze the mail server queue or recall or delete some email. That's only a few of the actions that may happen or may be needed during an incident. Following contentment, we are doing eradication. Normally, we always want to rebuild compromised assets because from a security analyst perspective, that's the only way to ensure that an asset is clean. Sometimes business will decide otherwise because the asset is a legacy, it can't be rebuilt or it will take too much time. Ultimately, that's an executive choice. Decision to balance between the risk. After any rebuild, you should ensure that the system is functional and protected. Depending on the assessment, we ensure that patch or configuration has been fixed to ensure it can't be attacked. And we obviously want to be sure that the business service is operational. For recovery, we declare return to normal service. Validate again that service are functional. Normal monitoring is functional. No abnormal behavior observed for some grace period. Ensure attacker is not coming back. Let's move to the late alert. We are more at the end stage of the attack. The previous alert has not happened or maybe was missed or misclassified. We have an automated security alert raised on the company gem post titled Mimikatz Execution Detection. What are you doing? Let's do a quick reminder of what is Mimikatz. It's a very popular security tool that's allowed to extract plaintext password, hash, and various secrets from memory. And it can perform various types of attacks, including pass the hash, pass the ticket. And it's very often used by attacker as an open source tool. We start again from identification. We talk about IT staff or business staff. It's very important that you have a good documentation, be it inventory, identity matrix, network matrix. That will help you a lot. But clearly, it will never replace helpful stuff. You still want to have documentations that will most often make your work easier and faster. It's not that you can't do that with Mimikatz. We try to validate the security on call or wait somebody on the bridge. First iteration of the OODA loop. Again, we try to validate the pen test or legitimate activity by IT or by some known user. Depending on your company, you may have user more normal or more abnormal than others. and doing some activity which may resemble an attacker. It's part of the knowledge and the baselines that you build over time in preparation of incidents. Next, we confirm that the Mimikatz execution is not legitimate. We want to know which credentials were stolen and are they reusable as is. Typically, is it end user accounts, service accounts, some cloud accounts? If it's local credential versus domain credential, are they domain admin or are they standard user? Are there some group policy object restriction in place typically to prevent the use of a domain admin outside of certain system? Are you using LAPS which is a Microsoft tool to ensure that only each local administrator password will be unique and this way they can't be reused to attack another system? We want to know what attacker action occurred and whether data is filtration active or not. Let's come back to our notebook. To explain query, we try to check the process activity. Here two example query with either event ID 4688 native process command line auditing in Windows or with sysmon event ID 1 which is an extra tool but often recommended by security people. From a visualization perspective, when we build the process tree of the genpos, we can see various activity attached to one of the user which is named pat resus and you can see that there is a cascade of activity that's mostly related to our shell but we will see other activity related to our shell in the future. In this screenshot, where you can see some task list call, some run DLL 32 with the mini dump argument, some who am I command. What we know from this process tree, we can say reconnaissance activity has happened. We have some who am I task list, possibly other command. We have a process memory dump which is unlikely to be any time legitimate. The who am I of task list, maybe your sysadmin can be responsible for it, but doing a process memory dump, very unlikely. And we know that lateral movement occurred. The cascading of PowerShell and CSC with a computer list argument is a result of post-ploit invoked port scan. The CSC is because PowerShell is calling a command let which is using cshar and as such, each call is resulting in a CSC children process that will do this live compilation of the blob. One thing that we don't know or we don't see in this process tree was Mimicats, or some PS exec, that you can be int in the faw premiums. So there can be various reasons. But one thing, obviously, the data can has been so tempered by the attacker or inadvertently, it can be wrong filter by the analyst. It can be a software bug or configuration is— issue. That's one reason you want to have multiple data source and validate they all goes into the same direction. If we review another log, we have identified that the activity is occurring on the RDP gem post. Zik was deployed in this environment. We can try to filter some of the activity, either by some top DNS list, top 1 million, top 10,000, and say what are the domain left. From some filtering action, we can identify those domain, interactsh.com, filepitzel, financial, magnumtempusfinancial.com, webwormhole.io, transfer.sh. What do we know? Likely the attacker has done an exfiltration or maybe he's doing it currently, depending on your timeline. The only case, and that's where it's important to know your company context, is maybe there is a legitimate legitimate business use case, but usually it will be for one service. Seeing four different services is less likely to be legitimate. We also have seen some typo requests on company domain magnum tempus financial, which suggests that the attacker was doing a manual execution. Sometimes it can be also a way to mislead the analyst by the attacker but at least as a first appreciation that seems the attacker was doing things manually not an automated or at least not a fully automated attack you can review the forensic station walkthrough for more uncontainment 1700 hey depending on the pace of your investigation you may stop the attacker before or during data expectation before data destruction and log wiping Again we want to lock or disable affected user account we may also want to restrict network access bit by domain ip address to block command control filtration of data that will depend a lot of what are the options available in your campaign if for example you have a proxy or only an ids if you are arriving very late during the incident and you already observe that we are in a stage where the attacker is doing event log clearing on many server and including domain controller which means that they basically own most of your network it's time if not already to escalate to crisis tier this will in usually include someone from each executive branch legal communication hr potentially more if you have not already done so but hopefully it is done inform the management we may want to unplug from the network or shut down impactor system unplugging from network is usually preferred as it will help to preserve evidence most notably in memory but it will depend a lot again on your context and what can you do especially in a remote setup in worst case more global network shutdown typically at office or data center or in the office center level maybe something needed you want to switch to out of band communication usually if an attacker has control on your domain controllers that means they also have control on your exchange or mail system your chat system likely you want to involve external partner your insurance your external returner which may be required or recommended by your insurance law enforcement information sharing and analysis center k isaac and national or sector cert those last two are very important because they help structure your the sharing of information and eventually share things in a way which are not liable for you and share this information in a way which is not necessarily identifiable it's important that you can help that if other company have made similar threats you can get more input to react faster typically to do the containment or to know that this threat actor is respecting their engagement when you pay them or they are not respecting those you want to validate your backup normally that's an early recovery step but especially in ransomware case it can influence contentment meaning results should be known only early if your attacker has destroyed your backup or if your backup are corrupt or have never been tested you probably have no backup and as a result you probably want to make more care on protecting system preserving evidence keep a copy of encrypted data if maybe a decryptor is found maybe in a month maybe in a year or whatever ultimately a very hard decision in a ransomware case is do you want or not pair ransomware that's a very trolley problem or cornelian dilemma that you should think carefully and discuss with relevant parties there is no right answer from a security or law enforcement perspective the recommendation will be always not pay but obviously if your company's life is at stake that's a harder call especially if you are at risk to finance terrorism or cyber criminal you also want to monitor internet the different various media and forum to ensure that your incident is not leaked too early and that you have time to prepare communication eradication phase we want to help you to protect the internet and also to protect the system like previously rebuilt assets but in a ransomware case you have probably very high number of system impacted and first you need if you have not already prepared it establish your priority for service recovery what should be repaired first Is it your business system, your payroll system, your Active Directory, whatever else? Ideally, that comes from your disaster recovery plan or business continuity plan and is done before any incident. But if it's not the case, that's your first step. After rebuilding assets. Next, like in the previous case, we want to validate system as functional and protected. We don't want the attacker to come back. Recovery. Same than previously. Return to normal service. Validate. Finally, the lesson learned. You should have a final communication to close an incident. And it should either include or be followed by the incident report. This should include executive summary, key findings with recommendation, what went good, what can be improved, a high-level timeline. Depending on your organization, alignment with MITRE ATT&CK, MITRE SHIP. NIST SP-853 or ISO 27. Maybe good addition. And part of all recommendations should feed your org risk register and be visible to decision-maker and executive. You don't want to let an incident un-use. Each incident is an opportunity for improvement. If you are not using it, you leave the door open to an attacker. It could be the same one. Or it could be another one. More will be developed in the final reporting work through. As a conclusion. Security incident response is very often a marathon. You need to take care of your team and yourself. Plan for overload. Plan for helper. Be it internal or external. Preparation is key. Establishing process, trust, and collaboration take time. Train early. Train like you fight. And fight like you train. Re-evaluate situation often during an incident. If you have better situational awareness than the attacker, the better. Know yourself. Know your enemy. And you can fight a hundred battles without disaster. OODA loop is one method to structure this. Last, make it easier for you and your team. Structure and automate the work so decision can be taken better and faster. Jupyter notebook is one way to structure, to automate things. And it helps to document and show the reasoning of investigation and avoid bias. This is the end of this walkthrough. Thanks a lot for attending it. I also want to thank all the contributors to Blue Team Village project Obsidian and to project Jupyter Notebook, Panda, Mystic Pie, Open Source Research. Enjoy Blue Team Village and DEF CON, be it virtually or in real life. Thanks to you. And join the conversation. On all Discord.