<?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[Jake King - 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[Jake King - 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/jake-king</link>
    </image>
    <link>https://www.elastic.co/security-labs/author/jake-king</link>
    <atom:link href="https://www.elastic.co/security-labs/rss/author/jake-king.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[en]]></language>
    <lastBuildDate>Sat, 19 Sep 2026 16:23:33 GMT</lastBuildDate>
  <item>
    <title><![CDATA[Announcing the Elastic Bounty Program for Behavior Rule Protections]]></title>
    <description><![CDATA[Elastic is launching an expansion of its security bounty program, inviting researchers to test its SIEM and EDR rules for evasion and bypass techniques, starting with Windows endpoints. This initiative strengthens collaboration with the security community, ensuring Elastic’s defenses remain robust against evolving threats.]]></description>
    <content:encoded><![CDATA[<h2 id="introduction">Introduction</h2>
<p>We’re excited to introduce a new chapter in <a href="https://hackerone.com/elastic?type=team">our security bounty program</a> on HackerOne that we soft launched in December 2024. Elastic is now offering a unique opportunity for researchers to test our <a href="https://github.com/elastic/detection-rules">detection</a> rules (SIEM) and <a href="https://github.com/elastic/protections-artifacts/tree/main/behavior">endpoint</a> rules (EDR), helping to identify gaps, vulnerabilities, and areas for improvement. This program builds on the success of our existing collaboration with the security research community, with a fresh focus on external validation for SIEM and EDR rule protections, which are provided as prebuilt content for <a href="https://www.elastic.co/security">Elastic Security</a> and deeply connected to the threat research published on <a href="https://www.elastic.co/security-labs">Elastic Security Labs</a>.  </p>
<p>At Elastic, <a href="https://www.elastic.co/blog/continued-leadership-in-open-and-transparent-security">openness</a> has always been at the core of our philosophy. We prioritize being transparent about <em>how</em> we protect our users. Our protections for SIEM and EDR are not hidden behind a curtain or paywall. Anyone can examine and provide immediate feedback on our protections. This feedback pipeline has proven to be a powerful enabler to refine and improve, while fostering collaboration with security professionals worldwide. </p>
<p>While we have performed various forms of testing internally over the years, some of which still exist today — such as emulations via internal automation capabilities, unit tests, evaluations, smoke tests, peer review processes, pen tests, and participating in exercises like <a href="https://www.elastic.co/blog/nation-states-cyber-threats-locked-shields">Locked Shields</a>, we want to take it one step further. By inviting the global security community to test our rules, we plan to push the maturity of our detection capabilities forward and ensure they remain resilient against evolving adversary techniques.</p>
<h2 id="elasticssecuritybugbountyprogramoffering">Elastic’s security bug bounty program offering</h2>
<p>Elastic maintains a mature and proactive public bug bounty program, launched in 2017 which has paid out over $600,000 in awards since then. We value our continued partnership with the security research community to maintain the effectiveness of these artifacts, shared with the community to identify known and newly-discovered threats. </p>
<p>The scope of our bounty has included Elastic’s development supply chain, <a href="https://www.elastic.co/cloud">Elastic Cloud</a>, <a href="https://www.elastic.co/elastic-stack">the Elastic Stack</a>, our product solutions, and our corporate infrastructure. This initiative provides researchers with additional guided challenges and bonus structures that will contribute directly to hardening our security detection solutions.  </p>
<h2 id="anewbountyfocuselasticsecurityruleassessments">A new bounty focus: Elastic Security rule assessments</h2>
<p>This latest offering marks an exciting shift by expanding the scope of our bounty program to specifically focus on detection rulesets for the first time. While bounties have traditionally targeted vulnerabilities in products and platforms, this program invites the community to explore new ground: testing for evasion and bypass techniques that affect our rules.</p>
<p>By initially targeting rules for Windows endpoints, this initiative creates an opportunity for the security community to showcase creative ways of evading our defenses. The focus areas for this period include key <a href="https://attack.mitre.org/">MITRE ATT&amp;CK techniques</a>.</p>
<h3 id="whythisisimportant">Why this is important</h3>
<p>Elastic has consistently collaborated with our community, particularly through our community Slack, where members regularly provide feedback on our detection rules. This new bounty program doesn’t overshadow the incredible contributions already made: it adds another layer of involvement, offering a structured way to reward those who have dedicated time and effort to help us and our community defend against threats of all kinds.</p>
<p>By expanding our program to include detection rulesets, we’re offering researchers the chance to engage in a way that has a direct impact on our defenses. We demonstrate our belief in continuous improvement, ensuring we stay ahead of adversaries, and lead the industry in creative, yet exciting ways.</p>
<h2 id="summaryscopeandrewards">Summary scope and rewards</h2>
<p>For this initial offering, the bounty scope focuses on evasion techniques related to our detection (SIEM) and endpoint (EDR) rulesets, particularly for Windows. We are interested in submissions that focus on areas like:</p>
<ul>
<li><strong>Privilege evasion:</strong> Techniques that bypass detection without requiring elevated privileges</li>
<li><strong>MITRE ATT&amp;CK technique evasion:</strong> Creative bypasses of detection rules for specific techniques such as process injection, credential dumping, creative initial/execution access, lateral movement, and others</li>
</ul>
<p>Submissions will be evaluated based on their impact and complexity. Over time, we plan the scope will evolve so watch out for future announcements and the Hackerone offering. </p>
<p>For a full list of techniques and detailed submission guidelines, view current offering.</p>
<h4 id="timebounds">Time bounds</h4>
<p>For this bounty incubation period (Jan 28th 2025 - Sept 1  2025), the scope will be <em>Windows Behavior Alerts</em>. </p>
<h2 id="currentoffering">Current offering</h2>
<h3 id="behaviordetections">Behavior detections</h3>
<p>Elastic invites the security community to contribute to the continuous improvement of our detection (SIEM) and endpoint (EDR) rulesets. Our mission is to enhance the effectiveness and coverage of these rulesets, ensuring they remain resilient against the latest threats and sophisticated techniques. We encourage hackers to identify gaps, bypasses, or vulnerabilities in specific areas of our rulesets as defined in the scope below.</p>
<h4 id="whatwerelookingfor">What we’re looking for</h4>
<p>We are particularly interested in submissions that focus on:</p>
<ul>
<li><strong>Privileges</strong>: Priority is given to bypass and evasion techniques that do not require elevated privileges.</li>
<li><strong>Techniques Evasion</strong>: If a submission bypasses a single behavior detection but still triggers alerts, then it is not considered as a full bypass. </li>
</ul>
<p>Submissions will be evaluated based on their impact and complexity. The reward tiers are structured as follows:</p>
<ul>
<li><strong>Low</strong>: Alerts generated are only low severity</li>
<li><strong>Medium</strong>: No alerts generated (SIEM or Endpoint)</li>
<li><strong>High</strong>: —</li>
<li><strong>Critical</strong>: —</li>
</ul>
<h4 id="ruledefinition">Rule definition</h4>
<p>To ensure that submissions are aligned with our priorities, each offering under this category will be scoped to a specific domain, MITRE tactic, or area of interest. This helps us focus on the most critical areas while preventing overly broad submissions.</p>
<p>General examples of specific scopes offered at specific times might include:</p>
<ul>
<li><strong>Endpoint Rules:</strong> Testing for bypasses or privilege escalation rules within macOS, Linux, Windows platforms.</li>
<li><strong>Cloud Rules:</strong> Assessing the detection capabilities against identity-based attacks within AWS, Azure, GCP environments.</li>
<li><strong>SaaS Platform Rules:</strong> Validating the detection of OAuth token misuse or API abuse in popular SaaS applications.</li>
</ul>
<h4 id="submissionguidelines">Submission guidelines</h4>
<p>To be eligible for a bounty, submissions must:</p>
<ol>
<li><strong>Align with the Defined Scope:</strong> Submissions should strictly adhere to the specific domain, tactic, or area of interest as outlined in the bounty offering.</li>
<li><strong>Provide Reproducible Results:</strong> Include detailed, step-by-step instructions for reproducing the issue.</li>
<li><strong>Demonstrate Significant Impact:</strong> Show how the identified gap or bypass could lead to security risks while not triggering any SIEM or EDR rules within the scope of the <strong>Feature Details</strong>.</li>
<li><strong>Include Comprehensive Documentation:</strong> Provide all necessary code, scripts, or configurations used in the testing process to ensure the issue can be independently validated. The submission includes logs, screenshots, or other evidence showing that the attack successfully bypassed specific rules without triggering alerts, providing clear proof of the issue.</li>
</ol>
<h4 id="featuredetailsscope">Feature details scope</h4>
<p>For this offering, here are additional details to further scope down submissions for this period:</p>
<ul>
<li><strong>Target:</strong> <em>Windows Behavior Alerts</em></li>
<li><strong>Scenario</strong><ul>
<li>Goal: Gain execution of an arbitrary attacker delivered executable on a system protected by Elastic Defend without triggering any alerts</li>
<li>Story: User downloads a single non-executable file from their web browser and opens it. They may click through any security warnings that are displayed by the operating system</li>
<li>Extensions in scope: lnk, js, jse, wsf, wsh, msc, vbs, vbe, chm, psc1, rdp</li>
<li>Entire scenario must occur within 5 minutes, but a reboot is allowed</li></ul></li>
<li><strong>Relevant MITRE Techniques:</strong> <ul>
<li><a href="https://attack.mitre.org/techniques/T1055">Process Injection, Technique T1055 - Enterprise | MITRE ATT&amp;CK®</a> into Windows processes </li>
<li>Lateral Movement via <a href="https://attack.mitre.org/techniques/T1021">Remote Services, Technique T1021 - Enterprise | MITRE ATT&amp;CK®</a> and credentials</li>
<li><a href="https://attack.mitre.org/techniques/T1566/001/">Phishing: Spearphishing Attachment, Sub-technique T1566.001 - Enterprise | MITRE ATT&amp;CK®</a> (macro enabled docs, script, shortcuts etc.)</li>
<li><a href="https://attack.mitre.org/techniques/T1562/001/">Impair Defenses: Disable or Modify Tools, Sub-technique T1562.001 - Enterprise | MITRE ATT&amp;CK®</a> (tampering with agents without administrative privileges techniques or techniques related to tampering with Elastic agent, PPL bypass, BYOVD etc.) </li></ul></li>
<li><strong>Additional Success Criteria:</strong> <ul>
<li>Ideally the bypasses can be combined in one chain (e.g. one payload performing multiple techniques and bypassing multiple existing rules scoped for the same techniques) - to avoid bypasses based solely on our public FP exclusions.</li>
<li>For phishing-based initial access techniques, submissions must clearly specify the delivery method, including how the target receives and interacts with the payload (e.g., email attachment, direct download, or cloud file sharing).</li></ul></li>
<li><strong>Additional Exclusions:</strong></li>
</ul>
<p>Here are some examples of non-acceptable submissions, but not limited to:</p>
<ul>
<li>Techniques that rely on small x-process WriteProcessMemory</li>
<li>Techniques that rely on sleeps or other timing evasion methods</li>
<li>Techniques that rely on kernel mode attacks and require administrative privileges</li>
<li>Techniques that rely on <a href="https://attack.mitre.org/techniques/T1566/">Phishing, Technique T1566 - Enterprise | MITRE ATT&amp;CK®</a> that are user assisted beyond initial access (e.g. beyond 2 or more user clicks) </li>
<li>Techniques that rely on well-documented information already in public repositories or widely recognized within the security community without any novel evasion or modification.</li>
<li>Techniques that rely on legacy / unpatched systems</li>
<li>Techniques that rely on highly specific environmental conditions or external factors that are unlikely to occur in realistic deployment scenarios </li>
<li>Techniques that rely on rule exceptions</li>
<li>Techniques that require local administrator.</li>
<li>Code injection techniques that rely on small payload size (less than 10K bytes)</li>
<li>Techniques that rely on less than 10,000 bytes written at a time through a cross process WriteProcessMemory</li>
</ul>
<h4 id="questionsanddisclosure">Questions and disclosure</h4>
<p>Please view our <a href="https://github.com/elastic/.github/blob/main/SECURITY.md">Security Issues</a> page for any questions or concerns related to this offering.</p>
<h2 id="howtogetinvolved">How to get involved</h2>
<p>To participate and learn more, head over to<a href="https://hackerone.com/elastic"> HackerOne</a> for complete details on the bounty program, submission guidelines, and reward tiers. We look forward to seeing the contributions from the research community and using these findings to continuously enhance the Elastic Security rulesets. Sign up for a <a href="https://www.elastic.co/cloud/cloud-trial-overview">free cloud trial</a> to access Elastic Security!</p>
<p><em>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</em></p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/behavior-rule-bug-bounty</link>
    <guid isPermaLink="false">behavior-rule-bug-bounty</guid>
    <category><![CDATA[Detection Engineering]]></category>
    <dc:creator><![CDATA[Mika Ayenson,Samir Bousseaden,Rodrigo Silva,Jake King]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1531ebc8a6f70ebc/6a7c77d4e723d4bb29b0917f/behavior-rule-bug-bounty.jpg" length="0" type="image/jpeg"/>
    <pubDate>Wed, 29 Jan 2025 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Elastic Advances LLM Security with Standardized Fields and Integrations]]></title>
    <description><![CDATA[Discover Elastic’s latest advancements in LLM security, focusing on standardized field integrations and enhanced detection capabilities. Learn how adopting these standards can safeguard your systems.]]></description>
    <content:encoded><![CDATA[<h2 id="introduction">Introduction</h2>
<p>Last week, security researcher Mika Ayenson <a href="https://www.elastic.co/security-labs/embedding-security-in-llm-workflows">authored a publication</a> highlighting potential detection strategies and an LLM content auditing prototype solution via a proxy implemented during Elastic’s OnWeek event series. This post highlighted the importance of research pertaining to the safety of LLM technology implemented in different environments, and the research focus we’ve taken at Elastic Security Labs.</p>
<p>Given Elastic's unique vantage point leveraging LLM technology in our platform to power capabilities such as the Security <a href="https://www.elastic.co/guide/en/security/current/security-assistant.html">AI Assistant</a>, our desire for more formal detection rules, integrations, and research content has been growing. This publication highlights some of the recent advancements we’ve made in LLM integrations, our thoughts around detections aligned with industry standards, and ECS field mappings.</p>
<p>We are committed to a comprehensive security strategy that protects not just the direct user-based LLM interactions but also the broader ecosystem surrounding them. This approach involves layers of security detection engineering opportunities to address not only the LLM requests/responses but also the underlying systems and integrations used by the models.</p>
<p>These detection opportunities collectively help to secure the LLM ecosystem and can be broadly grouped into five categories:</p>
<ol>
<li><strong>Prompt and Response</strong>: Detection mechanisms designed to identify and mitigate threats based on the growing variety of LLM interactions to ensure that all communications are securely audited.</li>
<li><strong>Infrastructure and Platform</strong>: Implementing detections to protect the infrastructure hosting LLMs (including wearable AI Pin devices), including detecting threats against the data stored, processing activities, and server communication.</li>
<li><strong>API and Integrations</strong>: Detecting threats when interacting with LLM APIs and protecting integrations with other applications that ingest model output.</li>
<li><strong>Operational Processes and Data</strong>: Monitoring operational processes (including in AI agents) and data flows while protecting data throughout its lifecycle.</li>
<li><strong>Compliance and Ethical</strong>: Aligning detection strategies with well-adopted industry regulations and ethical standards. </li>
</ol>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt0a7a011f3d694f4b/6a7c80031967ea6aab32a7fe/image4.png" alt="Securing the LLM Ecosystem: five categories" title="Securing the LLM Ecosystem: five categories" />
Securing the LLM Ecosystem: five categories</p>
<p>Another important consideration for these categories expands into who can best address risks or who is responsible for each category of risk pertaining to LLM systems. </p>
<p>Similar to existing <a href="https://www.cisecurity.org/insights/blog/shared-responsibility-cloud-security-what-you-need-to-know">Shared Security Responsibility</a> models, Elastic has assessed four broad categories, which will eventually be expanded upon further as we continue our research into detection engineering strategies and integrations. Broadly, this publication considers security protections that involve the following responsibility owners:</p>
<ul>
<li><strong>LLM Creators</strong>: Organizations who are building, designing, hosting, and training LLMs, such as OpenAI, Amazon Web Services, or Google</li>
<li><strong>LLM Integrators</strong>: Organizations and individuals who integrate existing LLM technologies produced by LLM Creators into other applications</li>
<li><strong>LLM Maintainers</strong>: Individuals who monitor operational LLMs for performance, reliability, security, and integrity use-cases and remain directly involved in the maintenance of the codebase, infrastructure, and software architecture</li>
<li><strong>Security Users</strong>: People who are actively looking for vulnerabilities in systems through traditional testing mechanisms and means. This may expand beyond the traditional risks discussed in <a href="https://llmtop10.com/">OWASP’s LLM Top 10</a> into risks associated with software and infrastructure surrounding these systems</li>
</ul>
<p>This broader perspective showcases a unified approach to LLM detection engineering that begins with ingesting data using native Elastic <a href="https://www.elastic.co/integrations">integrations</a>; in this example, we highlight the AWS Bedrock Model Invocation use case. </p>
<h2 id="integratingllmlogsintoelastic">Integrating LLM logs into Elastic</h2>
<p>Elastic integrations simplify data ingestion into Elastic from various sources, ultimately enhancing our security solution. These integrations are managed through Fleet in Kibana, allowing users to easily deploy and manage data within the Elastic Agent. Users can quickly adapt Elastic to new data sources by selecting and configuring integrations through Fleet. For more details, see Elastic’s <a href="https://www.elastic.co/blog/elastic-agent-and-fleet-make-it-easier-to-integrate-your-systems-with-elastic">blog</a> on making it easier to integrate your systems with Elastic.</p>
<p>The initial ONWeek work undertaken by the team involved a simple proxy solution that extracted fields from interactions with the Elastic Security AI Assistant. This prototype was deployed alongside the Elastic Stack and consumed data from a vendor solution that lacked security auditing capabilities. While this initial implementation proved conceptually interesting, it prompted the team to invest time in assessing existing Elastic integrations from one of our cloud provider partners, <a href="https://docs.elastic.co/integrations/aws">Amazon Web Services</a>. This methodology guarantees streamlined accessibility for our users, offering seamless, one-click integrations for data ingestion. All ingest pipelines conform to ECS/OTel normalization standards, encompassing comprehensive content, including dashboards, within a unified package. Furthermore, this strategy positions us to leverage additional existing integrations, such as Azure and GCP, for future LLM-focused integrations.</p>
<h3 id="vendorselectionandapicapabilities">Vendor selection and API capabilities</h3>
<p>When selecting which LLM providers to create integrations for, we looked at the types of fields we need to ingest for our security use cases. For the starting set of rules detailed here, we needed information such as timestamps and token counts; we found that vendors such as Azure OpenAI provided content moderation filtering on the prompts and generated content. LangSmith (part of the LangChain tooling) was also a top contender, as the data contains the type of vendor used (e.g., OpenAI, Bedrock, etc.) and all the respective metadata. However, this required that the user also have LangSmith set up. For this implementation, we decided to go with first-party supported logs from a vendor that provides LLMs. </p>
<p>As we went deeper into potential integrations, we decided to land with AWS Bedrock, for a few specific reasons. Firstly, Bedrock logging has <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html">first-party support</a> to Amazon CloudWatch Logs and Amazon S3. Secondly, the logging is built specifically for model invocation, including data specific to LLMs (as opposed to other operations and machine learning models), including prompts and responses, and guardrail/content filtering. Thirdly, Elastic already has a <a href="https://www.elastic.co/integrations/data-integrations?solution=all-solutions&amp;category=aws">robust catalog</a> of integrations with AWS, so we were able to quickly create a new integration for AWS Bedrock model invocation logs specifically. The next section will dive into this new integration, which you can use to capture your Bedrock model invocation logs in the Elastic stack.</p>
<h3 id="elasticawsbedrockmodelintegration">Elastic AWS Bedrock model integration</h3>
<h4 id="overview">Overview</h4>
<p>The new Elastic <a href="https://docs.elastic.co/integrations/aws_bedrock">AWS Bedrock</a> integration for model invocation logs provides a way to collect and analyze data from AWS services quickly, specifically focusing on the model. This integration provides two primary methods for log collection: Amazon S3 buckets and Amazon CloudWatch. Each method is optimized to offer robust data retrieval capabilities while considering cost-effectiveness and performance efficiency. We use these LLM-specific fields collected for detection engineering purposes.</p>
<p>Note: While this integration does not cover every proposed field, it does standardize existing AWS Bedrock fields into the gen_ai category. This approach makes it easier to maintain detection rules across various data sources, minimizing the need for separate rules for each LLM vendor.</p>
<h3 id="configuringintegrationdatacollectionmethod">Configuring integration data collection method</h3>
<h4 id="collectinglogsfroms3buckets">Collecting logs from S3 buckets</h4>
<p>This integration allows for efficient log collection from S3 buckets using two distinct methods:</p>
<ul>
<li><strong>SQS Notification</strong>: This is the preferred method for collecting. It involves reading S3 notification events from an AWS Simple Queue Service (SQS) queue. This method is less costly and provides better performance compared to direct polling. </li>
<li><strong>Direct S3 Bucket Polling</strong>: This method directly polls a list of S3 objects within an S3 bucket and is recommended only when SQS notifications cannot be configured. This approach is more resource-intensive, but it provides an alternative when SQS is not feasible.</li>
</ul>
<h4 id="collectinglogsfromcloudwatch">Collecting logs from CloudWatch</h4>
<p>Logs can also be collected directly from CloudWatch, where the integration taps into all log streams within a specified log group using the filterLogEvents AWS API. This method is an alternative to using S3 buckets altogether. </p>
<h4 id="integrationinstallation">Integration installation</h4>
<p>The integration can be set up within the Elastic Agent by following normal Elastic <a href="https://www.elastic.co/guide/en/fleet/current/add-integration-to-policy.html">installation steps</a>. </p>
<ol>
<li>Navigate to the AWS Bedrock integration</li>
<li>Configure the <code>queue_url</code> for SQS or <code>bucket_arn</code> for direct S3 polling.</li>
</ol>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6e5bee0974717c60/6a7c8006bdcff03260c3d05d/image2.png" alt="New AWS Bedrock Elastic Integration" title="New AWS Bedrock Elastic Integration" /></p>
<h3 id="configuringbedrockguardrails">Configuring Bedrock Guardrails</h3>
<p>AWS Bedrock <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html">Guardrails</a> enable organizations to enforce security by setting policies that limit harmful or undesirable content in LLM interactions. These guardrails can be customized to include denied topics to block specific subjects and content filters to moderate the severity of content in prompts and responses. Additionally, word and sensitive information filters block profanity and mask personally identifiable information (PII), ensuring interactions comply with privacy and ethical standards. This feature helps control the content generated and consumed by LLMs and, ideally, reduces the risk associated with malicious prompts.</p>
<p>Note: other guardrail examples include Azure OpenAI’s <a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/content-filter?tabs=warning%2Cpython-new">content and response</a> filters, which we aim to capture in our proposed LLM standardized fields for vendor-agnostic logging. </p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt85c4eaffb6235f29/6a7c8009ebe0ad0d5641f6e4/image1.png" alt="AWS Bedrock Guardrails" title="AWS Bedrock Guardrails" /></p>
<p>When LLM interaction content triggers these filters, the response objects are populated with <code>amazon-bedrock-trace</code> and <code>amazon-bedrock-guardrailAction</code> fields, providing details about the Guardrails outcome, and nested fields indicating whether the input matched the content filter. This response object enrichment with detailed filter outcomes improves the overall data quality, which becomes particularly effective when these nested fields are aligned with ECS mappings.</p>
<h3 id="theimportanceofecsmappings">The importance of ECS mappings</h3>
<p>Field mapping is a critical part of the process for integration development, primarily to improve our ability to write broadly scoped and widely compatible detection rules. By standardizing how data is ingested and analyzed, organizations can more effectively detect, investigate, and respond to potential threats or anomalies in logs ingested into Elastic, and in this specific case, LLM logs.</p>
<p>Our initial mapping begins by investigating fields provided by the vendor and existing gaps, leading to the establishment of a comprehensive schema tailored to the nuances of LLM operations. We then reconciled the fields to align with our OpenTelemetry <a href="https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/llm-spans.md">semantic conventions</a>. These mappings shown in the table cover various aspects:</p>
<ul>
<li><strong>General LLM Interaction Fields</strong>: These include basic but critical information such as the content of requests and responses, token counts, timestamps, and user identifiers, which are foundational for understanding the context and scope of interactions.</li>
<li><strong>Text Quality and Relevance Metric Fields</strong>: Fields measuring text readability, complexity, and similarity scores help assess the quality and relevance of model outputs, ensuring that responses are not only accurate but also user-appropriate. </li>
<li><strong>Security Metric Fields</strong>: This class of metrics is important for identifying and quantifying potential security risks, including regex pattern matches and scores related to jailbreak attempts, prompt injections, and other security concerns such as hallucination consistency and refusal responses.</li>
<li><strong>Policy Enforcement Fields</strong>: These fields capture details about specific policy enforcement actions taken during interactions, such as blocking or modifying content, and provide insights into the confidence levels of these actions, enhancing security and compliance measures.</li>
<li><strong>Threat Analysis Fields</strong>: Focused on identifying and quantifying potential threats, these fields provide a detailed analysis of risk scores, types of detected threats, and the measures taken to mitigate these threats.</li>
<li><strong>Compliance Fields</strong>: These fields help ensure that interactions comply with various regulatory standards, detailing any compliance violations detected and the specific rules that were triggered during the interaction.</li>
<li><strong>OWASP Top Ten Specific Fields</strong>: These fields map directly to the OWASP Top 10 risks for LLM applications, helping to align security measures with recognized industry standards.</li>
<li><strong>Sentiment and Toxicity Analysis Fields</strong>: These analyses are essential to gauge the tone and detect any harmful content in the response, ensuring that outputs align with ethical guidelines and standards. This includes sentiment scores, toxicity levels, and identification of inappropriate or sensitive content.</li>
<li><strong>Performance Metric Fields</strong>: These fields measure the performance aspects of LLM interactions, including response times and sizes of requests and responses, which are critical for optimizing system performance and ensuring efficient operations.</li>
</ul>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt84445c915da3a6a8/6a7c800cbd21989e1c752241/image5.png" alt="General, quality, security, policy, and threat analysis fields" title="General, quality, security, policy, and threat analysis fields" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt900aeab49ac29107/6a7c800ede23154038fd1d88/image6.png" alt="Compliance, OWASP top 10, security tools analysis, sentiment and toxicity analysis, and performance fields" title="Compliance, OWASP top 10, security tools analysis, sentiment and toxicity analysis, and performance fields" /></p>
<p>Note: See the <a href="https://gist.github.com/Mikaayenson/cf03f6d3998e16834c1274f007f2666c">gist</a> for an extended table of fields proposed.</p>
<p>These fields are mapped by our LLM integrations and ultimately used within our detections. As we continue to understand the threat landscape, we will continue to refine these fields to ensure additional fields populated by other LLM vendors are standardized and conceptually reflected within the mapping.</p>
<h3 id="broaderimplicationsandbenefitsofstandardization">Broader Implications and Benefits of Standardization</h3>
<p>Standardizing security fields within the LLM ecosystem (e.g., user interaction and application integration) facilitates a unified approach to the security domain. Elastic endeavors to lead the charge by defining and promoting a set of standard fields. This effort not only enhances the security posture of individual organizations but also fosters a safer industry. </p>
<p><strong>Integration with Security Tools</strong>: By standardizing responses from LLM-related security tools, it enriches security analysis fields that can be shipped with the original LLM vendor content to a security solution. If operationally chained together in the LLM application’s ecosystem, security tools can audit each invocation request and response. Security teams can then leverage these fields to build complex detection mechanisms that can identify subtle signs of misuse or vulnerabilities within LLM interactions. </p>
<p><strong>Consistency Across Vendors</strong>: Insisting that all LLM vendors adopt these standard fields drives a singular goal to effectively protect applications, but in a way that establishes a baseline that all industry users can adhere to. Users are encouraged to align to a common schema regardless of the platform or tool. </p>
<p><strong>Enhanced Detection Engineering</strong>: With these standard fields, detection engineering becomes more robust and the change of false positives is decreased. Security engineers can create effective rules that identify potential threats across different models, interactions, and ecosystems. This consistency is especially important for organizations that rely on multiple LLMs or security tools and need to maintain a unified platform.</p>
<h4 id="samplellmspecificfieldsawsbedrockusecase">Sample LLM-specific fields: AWS Bedrock use case</h4>
<p>Based on the integration’s ingestion pipeline, field mappings, and processors, the AWS Bedrock data is cleaned up, standardized, and mapped to Elastic Common Schema (<a href="https://www.elastic.co/guide/en/ecs/current/ecs-reference.html">ECS</a>) fields. The core Bedrock fields are then introduced under the <code>aws.bedrock</code> group which includes details about the model invocation like requests, responses, and token counts. The integration populates additional fields tailored for the LLM to provide deeper insights into the model’s interactions which are later used in our detections.  </p>
<h3 id="llmdetectionengineeringexamples">LLM detection engineering examples</h3>
<p>With the standardized fields and the Elastic AWS Bedrock integration, we can begin crafting detection engineering rules that showcase the proposed capability with varying complexity. The below examples are written using <a href="https://www.elastic.co/guide/en/security/8.13/rules-ui-create.html#create-esql-rule">ES|QL</a>.</p>
<p>Note: Check out the detection-rules <a href="https://github.com/elastic/detection-rules/tree/main/hunting">hunting</a> directory and <a href="https://github.com/elastic/detection-rules/tree/main/rules/integrations/aws_bedrock"><code>aws_bedrock</code></a> rules for more details about these queries.</p>
<h4 id="basicdetectionofsensitivecontentrefusal">Basic detection of sensitive content refusal</h4>
<p>With current policies and standards on sensitive topics within the organization, it is important to have mechanisms in place to ensure LLMs also adhere to compliance and ethical standards. Organizations have an opportunity to monitor and capture instances where an LLM directly refuses to respond to sensitive topics.</p>
<p><strong>Sample Detection</strong>:</p>
<pre><code>from logs-aws_bedrock.invocation-*
 | WHERE @timestamp &gt; NOW() - 1 DAY
   AND (
     gen_ai.completion LIKE "*I cannot provide any information about*"
     AND gen_ai.response.finish_reasons LIKE "*end_turn*"
   )
 | STATS user_request_count = count() BY gen_ai.user.id
 | WHERE user_request_count &gt;= 3
</code></pre>
<p><strong>Detection Description</strong>: This query is used to detect instances where the model explicitly refuses to provide information on potentially sensitive or restricted topics multiple times. Combined with predefined formatted outputs, the use of specific phrases like "I cannot provide any information about" within the output content indicates that the model has been triggered by a user prompt to discuss something it's programmed to treat as confidential or inappropriate. </p>
<p><strong>Security Relevance</strong>: Monitoring LLM refusals helps to identify attempts to probe the model for sensitive data or to exploit it in a manner that could lead to the leakage of proprietary or restricted information. By analyzing the patterns and frequency of these refusals, security teams can investigate if there are targeted attempts to breach information security policies.</p>
<h3 id="potentialdenialofserviceorresourceexhaustionattacks">Potential denial of service or resource exhaustion attacks</h3>
<p>Due to the engineering design of LLMs being highly computational and data-intensive, they are susceptible to resource exhaustion and denial of service (DoS) attacks. High usage patterns may indicate abuse or malicious activities designed to degrade the LLM’s availability. Due to the ambiguity of correlating prompt request size directly with token count, it is essential to consider the implications of high token counts in prompts which may not always result from larger requests bodies. Token count and character counts depend on the specific model, where each can be different and is related to how embeddings are generated. </p>
<p><strong>Sample Detection</strong>:</p>
<pre><code>from logs-aws_bedrock.invocation-*
 | WHERE @timestamp &gt; NOW() - 1 DAY
   AND (
     gen_ai.usage.prompt_tokens &gt; 8000 OR
     gen_ai.usage.completion_tokens &gt; 8000 OR
     gen_ai.performance.request_size &gt; 8000
   )
 | STATS max_prompt_tokens = max(gen_ai.usage.prompt_tokens),
         max_request_tokens = max(gen_ai.performance.request_size),
         max_completion_tokens = max(gen_ai.usage.completion_tokens),
         request_count = count() BY cloud.account.id
 | WHERE request_count &gt; 1
 | SORT max_prompt_tokens, max_request_tokens, max_completion_tokens DESC
</code></pre>
<p><strong>Detection Description</strong>: This query identifies high-volume token usage which could be indicative of abuse or an attempted denial of service (DoS) attack. Monitoring for unusually high token counts (input or output) helps detect patterns that could slow down or overwhelm the system, potentially leading to service disruptions. Given each application may leverage a different token volume, we’ve chosen a simple threshold based on our existing experience that should cover basic use cases.</p>
<p><strong>Security Relevance</strong>: This form of monitoring helps detect potential concerns with system availability and performance. It helps in the early detection of DoS attacks or abusive behavior that could degrade service quality for legitimate users. By aggregating and analyzing token usage by account, security teams can pinpoint sources of potentially malicious traffic and take appropriate measures.</p>
<h4 id="monitoringforlatencyanomalies">Monitoring for latency anomalies</h4>
<p>Latency-based metrics can be a key indicator of underlying performance issues or security threats that overload the system. By monitoring processing delays, organizations can ensure that servers are operating as efficiently as expected.</p>
<p><strong>Sample Detection</strong>:</p>
<pre><code>from logs-aws_bedrock.invocation-*
 | WHERE @timestamp &gt; NOW() - 1 DAY
 | EVAL response_delay_seconds = gen_ai.performance.start_response_time / 1000
 | WHERE response_delay_seconds &gt; 5
 | STATS max_response_delay = max(response_delay_seconds),
         request_count = count() BY gen_ai.user.id
 | WHERE request_count &gt; 3
 | SORT max_response_delay DESC
</code></pre>
<p><strong>Detection Description</strong>: This updated query monitors the time it takes for an LLM to start sending a response after receiving a request, focusing on the initial response latency. It identifies significant delays by comparing the actual start of the response to typical response times, highlighting instances where these delays may be abnormally long.</p>
<p><strong>Security Relevance</strong>: Anomalous latencies can be symptomatic of issues such as network attacks (e.g., DDoS) or system inefficiencies that need to be addressed. By tracking and analyzing latency metrics, organizations can ensure that their systems are running efficiently and securely, and can quickly respond to potential threats that might manifest as abnormal delays.</p>
<h2 id="advancedllmdetectionengineeringusecases">Advanced LLM detection engineering use cases</h2>
<p>This section explores potential use cases that could be addressed with an Elastic Security integration. It assumes that these fields are fully populated and that necessary security auditing enrichment features (e.g., Guardrails) have been implemented, either within AWS Bedrock or via a similar approach provided by the LLM vendor. In combination with the available data source and Elastic integration, detection rules can be built on top of these Guardrail requests and responses to detect misuse of LLMs in deployment.</p>
<h3 id="maliciousmodeluploadsandcrosstenantescalation">Malicious model uploads and cross-tenant escalation</h3>
<p>A recent investigation into the Hugging Face Interface API revealed a significant risk where attackers could upload a maliciously crafted model to perform arbitrary code execution. This was achieved by using a Python Pickle file that, when deserialized, executed embedded malicious code. These vulnerabilities highlight the need for rigorous security measures to inspect and sanitize all inputs in AI-as-a-Service (AIAAS) platforms from the LLM, to the infrastructure that hosts the model, and the application API integration. Refer to <a href="https://www.wiz.io/blog/wiz-and-hugging-face-address-risks-to-ai-infrastructure">this article</a> for more details.</p>
<p><strong>Potential Detection Opportunity</strong>: Use fields like <code>gen_ai.request.model.id</code>, <code>gen_ai.request.model.version</code>, and prompt <code>gen_ai.completion</code> to detect interactions with anomalous models. Monitoring unusual values or patterns in the model identifiers and version numbers along with inspecting the requested content (e.g., looking for typical Python Pickle serialization techniques) may indicate suspicious behavior. Similarly, a check prior to uploading the model using similar fields may block the upload. Cross-referencing additional fields like <code>gen_ai.user.id</code> can help identify malicious cross-tenant operations performing these types of activities.</p>
<h3 id="unauthorizedurlsandexternalcommunication">Unauthorized URLs and external communication</h3>
<p>As LLMs become more integrated into operational ecosystems, their ability to interact with external capabilities like email or webhooks can be exploited by attackers. To protect against these interactions, it’s important to implement detection rules that can identify suspicious or unauthorized activities based on the model’s outputs and subsequent integrations.</p>
<p><strong>Potential Detection Opportunity</strong>: Use fields like <code>gen_ai.completion</code>, and <code>gen_ai.security.regex_pattern_count</code> to triage malicious external URLs and webhooks. These regex patterns need to be predefined based on well-known suspicious patterns.</p>
<h4 id="hierarchicalinstructionprioritization">Hierarchical instruction prioritization</h4>
<p>LLMs are increasingly used in environments where they receive instructions from various sources (e.g., <a href="https://openai.com/blog/custom-instructions-for-chatgpt">ChatGPT Custom Instructions</a>), which may not always have benign intentions. This build-your-own model workflow can lead to a range of potential security vulnerabilities, if the model treats all instructions with equal importance, and they go unchecked. Reference <a href="https://arxiv.org/pdf/2404.13208.pdf">here</a>. </p>
<p><strong>Potential Detection Opportunity</strong>: Monitor fields like <code>gen_ai.model.instructions</code> and <code>gen_ai.completion</code> to identify discrepancies between given instructions and the models responses which may indicate cases where models treat all instructions with equal importance. Additionally, analyze the <code>gen_ai.similarity_score</code>, to discern how similar the response is from the original request.</p>
<h3 id="extendeddetectionsfeaturingadditionalelasticruletypes">Extended detections featuring additional Elastic rule types</h3>
<p>This section introduces additional detection engineering techniques using some of Elastic’s rule types, Threshold, Indicator Match, and New Terms to provide a more nuanced and robust security posture. </p>
<ul>
<li><strong>Threshold Rules</strong>: Identify high frequency of denied requests over a short period of time grouped by <code>gen_ai.user.id</code> that could be indicative of abuse attempts. (e.g. OWASP’s LLM04) </li>
<li><strong>Indicator Match Rules</strong>: Match known malicious threat intel provided indicators such as the LLM user ID like the <code>gen_ai.user.id</code> which contain these user attributes. (e.g. <code>arn:aws:iam::12345678912:user/thethreatactor</code>) </li>
<li><strong>New Terms Rules</strong>: Detect new or unusual terms in user prompts that could indicate usual activity outside of the normal usage for the user’s role, potentially indicating new malicious behaviors.</li>
</ul>
<h2 id="summary">Summary</h2>
<p>Elastic is pioneering the standardization of LLM-based fields across the generative AI landscape to enable security detections across the ecosystem. This initiative not only aligns with our ongoing enhancements in LLM integration and security strategies but also supports our broad security framework that safeguards both direct user interactions and the underlying system architectures. By promoting a uniform language among LLM vendors for enhanced detection and response capabilities, we aim to protect the entire ecosystem, making it more secure and dependable. Elastic invites all stakeholders within the industry, creators, maintainers, integrators and users, to adopt these standardized practices, thereby strengthening collective security measures and advancing industry-wide protections.</p>
<p>As we continue to add and enhance our integrations, starting with AWS Bedrock, we are strategizing to align other LLM-based integrations to the new standards we’ve set, paving the way for a unified experience across the Elastic ecosystem. The seamless overlap with existing Elasticsearch capabilities empowers users to leverage sophisticated search and analytics directly on the LLM data, driving existing workflows back to tools users are most comfortable with. </p>
<p>Check out the <a href="https://www.elastic.co/security/llm-safety-report">LLM Safety Assessment</a>, which delves deeper into these topics.</p>
<p><strong>The release and timing of any features or functionality described in this post remain at Elastic's sole discretion. Any features or functionality not currently available may not be delivered on time or at all.</strong></p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/elastic-advances-llm-security</link>
    <guid isPermaLink="false">elastic-advances-llm-security</guid>
    <category><![CDATA[AI Security]]></category>
    <dc:creator><![CDATA[Mika Ayenson,Dan Kortschak,Jake King,Susan Chang,Andrew Kroh]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt4890c18c9eff0470/6a7c80113ce8e2dd09cef687/Security_Labs_Images_4.jpg" length="0" type="image/jpeg"/>
    <pubDate>Mon, 06 May 2024 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[500ms to midnight: XZ A.K.A. liblzma backdoor]]></title>
    <description><![CDATA[Elastic Security Labs is releasing an initial analysis of the XZ Utility backdoor, including YARA rules, osquery, and KQL searches to identify potential compromises.]]></description>
    <content:encoded><![CDATA[<h2 id="keytakeaways">Key Takeaways</h2>
<ul>
<li>On March 29, 2024, Andres Freund identified malicious commits to the command-line utility XZ, impacting versions 5.6.0 and 5.6.1 for Linux, and shared the information on the oss-security mailing list.</li>
<li>Andres’ discovery was made after an increase of <em>500ms</em> in latency was observed with SSH login attempts initiated from a development system, amongst other anomalies.</li>
<li>The backdoor identified has been designed to circumvent authentication controls within SSH to remotely execute code, potentially gaining access to other systems in the environment.</li>
<li>The code commits were added and signed by <a href="https://tukaani.org/xz-backdoor">JiaT75</a> (now suspended), who contributed to the popular open source project for several years.</li>
<li>Security researchers are still undertaking an initial analysis of the payload, dissecting both the build process and the backdoor.</li>
<li>Elastic has released both YARA signatures, detection rules, and osquery queries, allowing Linux system maintainers to understand the impact and block potential compromises early.</li>
</ul>
<h2 id="thexzliblzmabackdoorataglance">The XZ / liblzma backdoor at a glance</h2>
<p>On March 29 2024, the widely adopted XZ package used within many Linux distributions as a library used by the system to interact with SSH client connections (and many other system utilities) was pulled into the spotlight after a <em>500ms</em> delay with intermittent failures. What began as a routine investigation into that anomaly would take a surprising and unexpected twist: malicious, obfuscated code was planted in the package by a maintainer–code that was also in circulation for a few weeks via a poisoned build process.</p>
<p>Andres Freund, the developer who initially <a href="https://www.openwall.com/lists/oss-security/2024/03/29/4">identified the malicious contributions</a>, observed that the changes had been implemented in versions <code>5.6.0</code> and <code>5.6.1</code> of the XZ Utils package but had not been widely adopted across all Linux distributions, outside of select bleeding-edge variants typically used for early-stage testing.</p>
<p><a href="https://bsky.app/profile/filippo.abyssdomain.expert/post/3kowjkx2njy2b">Initial analysis</a> has shown that the backdoor is designed to circumvent authentication controls in <code>sshd</code> via <code>systemd</code> and attempts to execute code within a pre-authentication context. Observations made so far have shown that the malicious code is not in its final target state and was perhaps caught early through haphazard mistakes the developer neglected to consider, causing impacts to legitimate SSH use cases.</p>
<p>Alongside the malicious package being circulated within a small number of Linux distributions, several observations have been made in the popular package management software HomeBrew, which has impacted some macOS users. The maintainers of Homebrew-- and other software packages that included this library-- are presently rolling back to prior versions that aren't impacted by these malicious changes, although mainly out of an abundance of caution, as compromised builds were only targeting deb and rpm packages.</p>
<p>The following notice was released on the Tukaani Project’s homepage (the project owner of the <a href="https://github.com/tukaani-project/xz">XZ Utils Git repository</a>) shortly after the news of the backdoor broke.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltfe533000c76d34b8/6a7c754e5967e5a9085d7302/image2.png" alt="XZ Utils backdoor notification on the Tukaani Project" title="XZ Utils backdoor notification on the Tukaani Project" /></p>
<p>The compromise itself, while high risk, is relatively minor in terms of real-world impact given the stage of discovery. This situation should remind security professionals about the importance of understanding supply-chain compromise, monitoring Linux workloads, and auditing system controls. In this situation, defenders had the advantage of time. </p>
<h2 id="backdooranalysis">Backdoor analysis</h2>
<h3 id="xzbackdoorbuildprocess">XZ backdoor build process:</h3>
<p><a href="https://nvd.nist.gov/vuln/detail/CVE-2024-3094">CVE-2024-3094</a> explains how the changes in the <code>liblzma</code> were created from the malicious additions to the library’s build scripts and directly impacts any software that links the library on an impacted system.</p>
<p>The maliciously modified build script is divided into three stages, starting with the additions in <code>m4/build-to-host.m4</code> and progressing through the obfuscation and execution stages. At a high level, some obfuscation techniques include character substitution and selective byte processing commands via the <code>tr</code> and <code>head</code> commands to decode and execute the malicious payloads in the test files. Interestingly, many impacted tools used are standard Linux system tools typically used by administrators for legitimate purposes.</p>
<p>The <a href="https://gynvael.coldwind.pl/?lang=en&amp;id=782">build process</a> runs as follows :</p>
<ul>
<li><strong>Stage 0:</strong> The initial malicious code additions attempt to decode the Stage 1 script (hidden code segments) by changing byte values from specific test files, which under normal circumstances appear corrupt, to form a valid XZ stream.</li>
<li><strong>Stage 1:</strong> This stage leverages a bash file with special checks (e.g., the Linux architecture the script runs on) and Bash commands to analyze the environment (e.g. <code>[ "$(uname)" = "Linux" ]</code>) to ensure compatible conditions are met for the backdoor. Depending on the outcome of the checks, additional malicious scripts or payloads may be executed.</li>
<li><strong>Stage 2:</strong> This phase involves an infected.txt file, which details the altered extraction and compilation code modifications, namely:<ul>
<li>Reconstruction Data: Byte manipulation and decoding techniques on obfuscated compressed data from test files to reconstruct the malicious payload using commands like <code>sed</code> and <code>awk</code></li>
<li>Obfuscation and Extraction: Complex decryption and obfuscation techniques using the <code>tr</code> command to extract the binary backdoor to remain hidden from typical detection mechanisms</li>
<li>Build Process Manipulation: This changes the build and compilation steps to embed the binary backdoor into Linux system processes</li>
<li>Extension Mechanism: A design that allows for new scripts and updates to the backdoor without modifying the original payload</li>
<li>Future Stage Preparation: Sets the groundwork for malicious follow-up activities, like propagating the backdoor </li></ul></li>
</ul>
<h2 id="assessingimpact">Assessing impact:</h2>
<p>Given the limited usage of the impacted beta distributions and software, this compromise should impact few systems. Maintainers of Linux systems are however encouraged to ensure systems are not running impacted versions of <code>xzutils</code> / <code>liblzma</code> by leveraging the following osquery queries:</p>
<p><a href="https://gist.github.com/jamesspi/ee8319f55d49b4f44345c626f80c430f">Linux</a>:</p>
<pre><code>SELECT 'DEB Package' AS source, name, version,
  CASE
    WHEN version LIKE '5.6.0%' OR version LIKE '5.6.1%' THEN 'Potentially Vulnerable'
    ELSE 'Most likely not vulnerable'
  END AS status
FROM deb_packages
WHERE name = 'xz-utils' OR name = 'liblzma' OR name LIKE 'liblzma%'
UNION
SELECT 'RPM Package' AS source, name, version,
  CASE
    WHEN version LIKE '5.6.0%' OR version LIKE '5.6.1%' THEN 'Potentially Vulnerable'
    ELSE 'Most likely not vulnerable'
  END AS status
FROM rpm_packages
WHERE name = 'xz-utils' OR name = 'liblzma' OR name LIKE 'liblzma%';
</code></pre>
<p><a href="https://gist.github.com/jamesspi/5cb060b5e0e2d43222a71c876b56daab">macOS</a>:</p>
<pre><code>SELECT 'Homebrew Package' AS source, name, version,
  CASE
    WHEN version LIKE '5.6.0%' OR version LIKE '5.6.1%' THEN 'Potentially Vulnerable'
    ELSE 'Most likely not vulnerable'
  END AS status
FROM homebrew_packages
WHERE name = 'xz' OR name = 'liblzma';
</code></pre>
<p>The following KQL query can be used to query Elastic Defend file events: </p>
<pre><code>event.category : file and host.os.type : (macos or linux) and file.name : liblzma.so.5.6.*
</code></pre>
<p>Alternatively, manually checking the version of XZ running on a system is as simple as running the <a href="https://x.com/Kostastsale/status/1773890846250926445?s=20">following commands</a> (from researcher <a href="https://twitter.com/Kostastsale">Kostas</a>) and checking the output version. Remember, versions 5.6.0 and 5.6.1 are impacted and should be rolled back or updated to a newer version.</p>
<pre><code>for xz_p in $(type -a xz | awk '{print $NF}' | uniq); do strings "$xz_p" | grep "xz (XZ Utils)" || echo "No match found for $xz_p"; done
</code></pre>
<h2 id="malwareprotection">Malware protection</h2>
<p>The following <a href="https://github.com/elastic/protections-artifacts/blob/main/yara/rules/Linux_Trojan_XZBackdoor.yar">YARA signature</a> (disk and in-memory) is deployed in Elastic Defend to block the XZ backdoor.</p>
<pre><code>rule Linux_Trojan_XZBackdoor {
    meta:
        author = "Elastic Security"
        fingerprint = "f1982d1db5aacd2d6b0b4c879f9f75d4413e0d43e58ea7de2b7dff66ec0f93ab"
        creation_date = "2024-03-30"
        last_modified = "2024-03-31"
        threat_name = "Linux.Trojan.XZBackdoor"
        reference_sample = "5448850cdc3a7ae41ff53b433c2adbd0ff492515012412ee63a40d2685db3049"
        severity = 100
        arch_context = "x86"
        scan_context = "file, memory"
        license = "Elastic License v2"
        os = "linux"
    strings:
        /* potential backdoor kill-switch as per https://gist.github.com/q3k/af3d93b6a1f399de28fe194add452d01?permalink_comment_id=5006558#file-hashes-txt-L115 */
        $a1 = "yolAbejyiejuvnup=Evjtgvsh5okmkAvj"
/* function signature in liblzma used by sshd */
        $a2 = { F3 0F 1E FA 55 48 89 F5 4C 89 CE 53 89 FB 81 E7 00 00 00 80 48 83 EC 28 48 89 54 24 18 48 89 4C 24 10 }
 /* unique byte patterns in backdoored liblzma */
        $b1 = { 48 8D 7C 24 08 F3 AB 48 8D 44 24 08 48 89 D1 4C 89 C7 48 89 C2 E8 ?? ?? ?? ?? 89 C2 }
        $b2 = { 31 C0 49 89 FF B9 16 00 00 00 4D 89 C5 48 8D 7C 24 48 4D 89 CE F3 AB 48 8D 44 24 48 }
        $b3 = { 4D 8B 6C 24 08 45 8B 3C 24 4C 8B 63 10 89 85 78 F1 FF FF 31 C0 83 BD 78 F1 FF FF 00 F3 AB 79 07 }
    condition:
        1 of ($a*) or all of ($b*)
}
</code></pre>
<p>Detections of this signature  will appear in Elastic as follows: </p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt5387a8692f34f544/6a7c7551e88c655ce2005638/image4.png" alt="Detecting the Linux.Trojan.XZBackdoor signature in Elastic" title="Detecting the Linux.Trojan.XZBackdoor signature in Elastic" /></p>
<h2 id="behaviordetection">Behavior Detection</h2>
<p>Leveraging <a href="https://docs.elastic.co/en/integrations/endpoint">Elastic Defend</a>’s network and process events, we published a new EQL <a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/persistence_suspicious_ssh_execution_xzbackdoor.toml">detection rule</a> to identify instances where the SSHD service starts, spawns a shell process and immediately terminates unexpectedly all within a very short time span: </p>
<pre><code>sequence by host.id, user.id with maxspan=1s
 [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.name == "sshd" and
    process.args == "-D" and process.args == "-R"] by process.pid, process.entity_id
 [process where host.os.type == "linux" and event.type == "start" and event.action == "exec" and process.parent.name == "sshd" and 
  process.executable != "/usr/sbin/sshd"] by process.parent.pid, process.parent.entity_id
 [process where host.os.type == "linux" and event.action == "end" and process.name == "sshd" and process.exit_code != 0] by process.pid, process.entity_id
 [network where host.os.type == "linux" and event.type == "end" and event.action == "disconnect_received" and process.name == "sshd"] by process.pid, process.entity_id
</code></pre>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt7b98fd5a2b1f6822/6a7c7555437e0ffa4ddd536e/image1.png" alt="Matches while simulating execution via the backdoor using XZBot - github.com/amlweems/xzbot" title="Matches while simulating execution via the backdoor using XZBot - github.com/amlweems/xzbot" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltcf92489cad287715/6a7c7558227b1c0fb35924b7/image3.png" alt="Timeline view displaying events matching the EQL query" title="Timeline view displaying events matching the EQL query" /></p>
<h2 id="linuxthefinalfrontier">Linux: the final frontier</h2>
<p>While observations of supply chain-based attacks or exploitation of vulnerabilities rarely reach this level of global press coverage, Elastic’s observations described in the <a href="https://www.elastic.co/explore/security-without-limits/global-threat-report">2023 Global Threat Report</a> show that Linux-based signature events continue to grow in our dataset. This growth is partially tied to growth in the systems we observe that report on threat behavior, but it strongly suggests that adversaries are becoming increasingly focused on Linux systems. </p>
<p>Linux is and will continue to be on the <a href="https://www.elastic.co/security-labs/a-peek-behind-the-bpfdoor">minds of threat groups</a>, as its widespread adoption across the internet reinforces its importance. In this case, adversarial groups were trying to circumvent existing controls that would allow for future compromise through other means.</p>
<p>While the objectives of the person(s) behind the XZ backdoor haven’t been made clear yet, it is within the technical capabilities of many threat entities focused on espionage, extortion, destruction of data, intellectual property theft, and human rights abuses. With the ability to execute code on impacted Internet-accessible systems, it’s reasonable to assume that bad actors would further infiltrate victims. Elastic Security Labs sees that Linux visibility has been dramatically improving and enterprises have started to effectively manage their Linux populations, but many organizations reacting to this supply chain compromise are still at the start of that process.</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/500ms-to-midnight</link>
    <guid isPermaLink="false">500ms-to-midnight</guid>
    <category><![CDATA[Malware Analysis]]></category>
    <dc:creator><![CDATA[Samir Bousseaden,Mika Ayenson,Jake King]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt5dd05004b176c95c/6a7c755b80ee3847e660cfc3/500ms-to-midnight.jpg" length="0" type="image/jpeg"/>
    <pubDate>Fri, 05 Apr 2024 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Analysis of Log4Shell vulnerability & CVE-2021-45046]]></title>
    <description><![CDATA[In this post, we cover next steps the Elastic Security team is taking for users to continue to protect themselves against CVE-2021-44228, or Log4Shell.]]></description>
    <content:encoded><![CDATA[<blockquote>
  <p><em>To understand how Elastic is currently assessing internal risk of this vulnerability in our products please see the advisory</em><a href="https://discuss.elastic.co/t/apache-log4j2-remote-code-execution-rce-vulnerability-cve-2021-44228-esa-2021-31/291476"><em>here.</em></a></p>
  <p><em>This document was updated on December 17, 2021 to reflect a revised CVSS score for CVE-2021-45046, and new findings by the community.</em></p>
</blockquote>
<p>In recent days Log4Shell, or CVE-2021-44228, has dominated the news cycle in the world of information security and beyond. Elastic released an <a href="https://discuss.elastic.co/t/apache-log4j2-remote-code-execution-rce-vulnerability-cve-2021-44228-esa-2021-31/291476?ultron=log4js-exploit&amp;blade=announcement&amp;hulk=email&amp;mkt_tok=ODEzLU1BTS0zOTIAAAGBU8N1ZUOwzTcRbJCOiByHmeYiopMnarq-QPWBIyhPI3Vvsp6w-4q4PBbTGZ3fZ0sB75cpaUdOddA1k-6-yh3QwAicvJTgafdJWv_-9Cn2GoKLvsmt">advisory</a> detailing how Elastic products and users are impacted, and a <a href="https://www.elastic.co/blog/detecting-log4j2-with-elastic-security?ultron=log4js-exploit&amp;blade=announcement&amp;hulk=email&amp;mkt_tok=ODEzLU1BTS0zOTIAAAGBU8N1ZDYRbFq2QZ4ZK8tc2IbDatArsdI6WGcA2M90g4v02svJeqCXFeZ23R4TjeYii4KBGAkqMBgWc5IkxYrmefgwZBanjGQh8v66drUymiVSQFvs">blog</a> post describing how our users can leverage Elastic Security to help defend their networks.</p>
<p>Many readers have further questions as to how we’re tracking this issue within Elastic Security, what our coverage is now, and what we’re expecting to do next. This post outlines a few details for our current status, and provides details regarding a new, related vulnerability: CVE-2021-45046.</p>
<h2 id="elasticsecurityresponse">Elastic Security response</h2>
<p>As you may imagine, the team has worked tirelessly to ensure that we’re developing detections for both active exploitation of the vulnerability, as well as post-compromise indicators, and will continue active development until further notice.</p>
<p>We’re spending time focusing on detailed detections that better align with some of the emerging trends that adversaries are now taking advantage of as they have time to develop their attack strategies. And we’re not working in silence — those that may have had a chance to catch up on our <a href="https://www.elastic.co/blog/detecting-log4j2-with-elastic-security">original post</a> a few days ago will be pleasantly surprised we’ve added further detections and hunting examples, and will continue to do so as we learn more with the community.</p>
<p>Alongside the threat research and signature development, we’ve noted some interesting observations:</p>
<ul>
<li>We noted several instances of <a href="https://www.virustotal.com/gui/file/5b25db204b5cd5cc3193f4378dd270dced80da9d39874d8b6fdd75e97d2cc907/detection">generic crypto miners</a> for Linux being deployed that appeared to be related to exploitation of this CVE, but determined that they are benign true positives</li>
<li>We’ve stopped at least eight different families of malware being deployed using the log4j exploit, indicating widespread adoption of the exploit by threats of all kinds</li>
<li>While we are observing coverage across our full protection suite (such as behavior protection), it is noteworthy that our free basic-tier malware protection is successfully preventing initial access</li>
</ul>
<p>We will aim to keep users and readers apprised of findings, and hope to share additional observations in the wild as we see them.</p>
<h2 id="anewcontendercve202145046">A new contender: CVE-2021-45046</h2>
<p>While we watch the CVE-2021-44228 (Log4Shell) vulnerability dominate the news cycles, a new contender, <a href="https://nvd.nist.gov/vuln/detail/CVE-2021-45046">CVE-2021-45046</a>, was accidentally introduced to Log4j2j version 2.15.0, allowing adversaries to invoke a Denial of Service, and a remote code execution condition through specially crafted payloads. Previous mitigations to avoid Information Disclosure vulnerabilities by setting the <code>log4j2.noFormatMsgLookup</code> state to <code>true</code> do not mitigate against this new finding, according to the CVE details.</p>
<p>While initially CVE-2021-45046 carried a lower CVSS score of 3.7 due to the impact of the initially discovered condition that can be invoked, this was re-evaluated to a 9.0 indicating limited remote code execution was possible. The finding was shared on December 16, 2021 by <a href="https://twitter.com/pwntester/status/1471465662975561734">Alvaro Muñoz</a>, who identified that while the default setting formatMsgNoLookups was accurately set to true, there were alternative locations for lookups to take place. Technical details are still unfolding from the community, however the Log4j2 team shared the following message within their security updates:</p>
<p><em>The reason these measures are insufficient is that, in addition to the Thread Context attack vector mentioned above, there are still code paths in Log4j where message lookups could occur: known examples are applications that use Logger.printf("%s", userInput), or applications that use a custom message factory, where the resulting messages do not implement StringBuilderFormattable. There may be other attack vectors.</em></p>
<p><em>The safest thing to do is to upgrade Log4j to a safe version, or remove the JndiLookup class from the log4j-core jar.</em> <a href="https://logging.apache.org/log4j/2.x/security.html"><em>Reference here</em></a></p>
<p>Given this new information, and readily available<a href="https://twitter.com/marcioalm/status/1471740771581652995">POCs</a> available for exploitation, the Apache team has recommended those impacted upgrade to the latest, safe version of Log4j2, or alternatively remove the JndiLookup class from the log4j-core jar.</p>
<p>Elastic Security has observed many threat actors and benign scanners leveraging this new methodology already in some edge environments, with payloads incorporating previous attack methodologies such as key extraction attempts and base64 encoded payloads:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltaf380adbe4f47dec/6a7d7da7e3a219699099c689/scanning-attempts-vulnerability.jpg" alt="A preview of the rapid acceleration of scanning attempts adopting this new vulnerability" title="A preview of the rapid acceleration of scanning attempts adopting this new vulnerability" /></p>
<p>We anticipate adding further details as we learn them, and thank the team at lunasec specifically for providing a <a href="https://www.lunasec.io/docs/blog/log4j-zero-day-severity-of-cve-2021-45046-increased/">detailed, early summary</a> of this emerging situation, and of course, provide kudos to <a href="https://twitter.com/pwntester">Alvaro Muñoz</a> of Github Security Lab for the findings.</p>
<h2 id="thankyouagainfromelasticsecurity">Thank you (again!), from Elastic Security</h2>
<p>We want to thank all of the security teams across the globe for your tireless work this week. As we referenced before, openness and collaboration in the security community to safeguard all users is paramount when facing such a serious and pervasive vulnerability.</p>
<p>Existing Elastic Security users can access these capabilities within the product. If you’re new to Elastic Security, take a look at our <a href="https://www.elastic.co/training/elastic-security-quick-start">Quick Start guides</a> (bite-sized training videos to get you started quickly) or our <a href="https://www.elastic.co/training/free#fundamentals">free fundamentals training courses</a>.</p>
<p>Get started with a <a href="https://cloud.elastic.co/registration">free 14-day trial of Elastic Cloud</a>. Or <a href="https://www.elastic.co/downloads/">download</a> the self-managed version of the Elastic Stack for free.</p>
<h3 id="references">References</h3>
<p><a href="https://logging.apache.org/log4j/2.x/security.html">https://logging.apache.org/log4j/2.x/security.html</a></p>
<p><a href="https://www.lunasec.io/docs/blog/log4j-zero-day-severity-of-cve-2021-45046-increased/">https://www.lunasec.io/docs/blog/log4j-zero-day-severity-of-cve-2021-45046-increased/</a></p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/blog/analysis-of-log4shell-cve-2021-45046</link>
    <guid isPermaLink="false">analysis-of-log4shell-cve-2021-45046</guid>
    <category><![CDATA[Threat Hunting]]></category>
    <dc:creator><![CDATA[Jake King]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt055c3579864d3b40/6a7d7daa3cab1c74980e196b/photo-edited-12-e.jpg" length="0" type="image/jpeg"/>
    <pubDate>Wed, 30 Nov 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Detecting Exploitation of CVE-2021-44228 (Log4j2) with Elastic Security]]></title>
    <description><![CDATA[This blog post provides a summary of CVE-2021-44228 and provides Elastic Security users with detections to find active exploitation of the vulnerability in their environment. Further updates will be provided to this post as we learn more.]]></description>
    <content:encoded><![CDATA[<blockquote>
  <ul>
  <li><em>To understand how Elastic is currently assessing internal risk of this vulnerability in our products please see the advisory</em><a href="https://discuss.elastic.co/t/apache-log4j2-remote-code-execution-rce-vulnerability-cve-2021-44228-esa-2021-31/291476"><em>here.</em></a></li>
  <li><em>This blog has been updated (Dec. 17, 2021) with further detection and hunting improvements since its initial publish.</em></li>
  </ul>
</blockquote>
<h2 id="overview">Overview</h2>
<p>This blog post provides a summary of CVE-2021-44228 and provides Elastic Security users with detections to find active exploitation of the vulnerability in their environment.</p>
<p>Further updates will be provided to this post as we learn more. This version is accurate as of Tuesday, December 14, 2021. Updates from Apache may be investigated directly via the <a href="https://logging.apache.org/log4j/2.x/security.html#">security page</a> for Log4j2.</p>
<h2 id="summaryofcve202144228log4shell">Summary of CVE-2021-44228 (Log4Shell)</h2>
<p>Log4j2 is an open source logging framework incorporated into many Java based applications on both end-user systems and servers. In <a href="https://logging.apache.org/log4j/2.x/security.html#">late November 2021</a>, Chen Zhaojun of Alibaba identified a remote code execution vulnerability, ultimately being reported under the CVE ID : <a href="https://nvd.nist.gov/vuln/detail/CVE-2021-44228">CVE-2021-44228</a>, released to the public on December 10, 2021. The vulnerability is exploited through improper deserialization of user-input passed into the framework. It permits remote code execution and it can allow an attacker to leak sensitive data, such as environment variables, or execute malicious software on the target system.</p>
<p>The identified vulnerability impacts all versions of Log4j2 from version 2.0-beta9 to version 2.14.1. Early methods to patch the issue resulted in a number of release candidates, culminating in recommendations to upgrade the framework to Log4j2 2.15.0-rc2 at the time of this post.</p>
<p>Given the trivial complexity and the nature of observed widespread exploitation, mitigation should be considered critical in any environment that has identified software leveraging vulnerable versions of Log4j2.</p>
<h2 id="detectingexploitationoflog4shellinelasticsecurity">Detecting Exploitation of Log4Shell in Elastic Security</h2>
<p>Elastic Security users can use the following Event Correlation detection rule to identify active exploitation of the Log4j2 vulnerability. Depending on the format of the host based event data you may need to modify this detection to match your data fields.</p>
<p><strong>Detection Rule when using Endpoint data</strong></p>
<pre><code>sequence by host.id with maxspan=1m
 [network where event.action == "connection_attempted" and
  process.name : "java" and
  /*
     outbound connection attempt to
     LDAP, RMI or DNS standard ports
     by JAVA process
   */
  destination.port in (1389, 389, 1099, 53, 5353)] by process.pid
 [process where event.type == "start" and

  /* Suspicious JAVA child process */
  process.parent.name : "java" and
   process.name : ("sh",
                   "bash",
                   "dash",
                   "ksh",
                   "tcsh",
                   "zsh",
                   "curl",
                   "perl*",
                   "python*",
                   "ruby*",
                   "php*",
                   "wget")] by process.parent.pid
</code></pre>
<p><strong>Detection Rule when using Auditbeat data</strong></p>
<pre><code>sequence by agent.id with maxspan=1m
 [network where event.action == "connected-to" and
  process.name : "java" and
  /*
     outbound connection attempt to
     LDAP, RMI or DNS standard ports
     by JAVA process
   */
  destination.port in (1389, 389, 1099, 53, 5353)] by process.pid
 [process where event.type == "start" and

  /* Suspicious JAVA child process */
  process.parent.name : "java" and
   process.name : ("sh",
                   "bash",
                   "dash",
                   "ksh",
                   "tcsh",
                   "zsh",
                   "curl",
                   "perl*",
                   "python*",
                   "ruby*",
                   "php*",
                   "wget")] by process.parent.pid
</code></pre>
<p><strong>Detection rule when using Endgame streamed events</strong></p>
<pre><code>sequence by agent.id with maxspan=1m
 [network where event.category == "network" and
  process.name : "java" and
  /*
     outbound connection attempt to
     LDAP, RMI or DNS standard ports
     by JAVA process
   */
  destination.port in (1389, 389, 1099, 53, 5353)] by process.pid
 [process where event.type == "start" and

  /* Suspicious JAVA child process */
  process.parent.name : "java" and
   process.name : ("sh",
                   "bash",
                   "dash",
                   "ksh",
                   "tcsh",
                   "zsh",
                   "curl",
                   "perl*",
                   "python*",
                   "ruby*",
                   "php*",
                   "wget")] by process.parent.pid
</code></pre>
<p>This detection rule looks for a sequence of an outbound connection attempt to standard ports for LDAP, RMI and DNS (often abused via recently observed <a href="https://www.blackhat.com/docs/us-16/materials/us-16-Munoz-A-Journey-From-JNDI-LDAP-Manipulation-To-RCE.pdf">JAVA/JNDI</a> injection attacks) followed by a child process of the same Java process instance.</p>
<p>Now, let’s demonstrate how this rule detects exploitation of the log42j vulnerability:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt29f601a497011e99/6a7d7f0705b7b5463a188ad4/blog-elastic-security-1.jpg" alt="The screenshot above shows an attacker exploiting the vulnerability with a base-64 encoded payload" title="The screenshot above shows an attacker exploiting the vulnerability with a base-64 encoded payload" /></p>
<p>The screenshot above shows an attacker exploiting the vulnerability with a base-64 encoded payload targeting an <a href="https://github.com/christophetd/log4shell-vulnerable-app">example vulnerable application</a> created by <a href="https://github.com/christophetd">Christophe Tafani-Dereeper</a>.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltb49c679c1111ca25/6a7d7f09bd219851f6755249/blog-elastic-security-2.jpg" alt="This screenshot shows the detection of the active exploitation of CVE-2021-44228 within Elastic Security detailing both the alert and timeline view of the exploit." title="This screenshot shows the detection of the active exploitation of CVE-2021-44228 within Elastic Security detailing both the alert and timeline view of the exploit." /></p>
<p>This screenshot shows the detection of the active exploitation of CVE-2021-44228 within Elastic Security detailing both the alert and timeline view of the exploit.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt20f7c0a5a97545e9/6a7d7f0c5967e5fdb85da4c6/blog-elastic-security-3.jpg" alt="The screenshot above shows in the investigation of the detection alert that Java executed a shell script to download and run a bash script." title="The screenshot above shows in the investigation of the detection alert that Java executed a shell script to download and run a bash script." /></p>
<p>The screenshot above shows in the investigation of the detection alert that Java executed a shell script to download and run a bash script.</p>
<h2 id="updatedetectionhuntingimprovements">Update: Detection &amp; hunting improvements</h2>
<p><strong>Suspicious Shell Commands Execution via Java</strong></p>
<p>Based on observed publicly known malicious Java classes served via log4j exploit, you can hunt for suspicious shell scripts and ingress tool transfer commands:</p>
<pre><code>process where event.type == "start" and
  process.parent.name : "java*" and

  /* Ingress tools transfer via common shell command interpreters */

  /* linux or macos */
  (
   (process.name : ("sh", "bash", "python*") and
    process.command_line : ("*curl*|*sh*", "*wget*|*bash", "*curl*|*bash*", "*curl*|*bash*", "*http*|*sh*", "*python*http*")) or

  /* windows */
  (process.name : ("powershell.exe", "pwsh.exe", "cmd.exe") and
   process.command_line : ("*.downloadstring*", "*.downloadfile*", "*.downloaddata*", "*BitsTransfer*", "* -enc*", "* IEX*", "*wp-content*", "*wp-admin*", "*wp-includes*", "*$*$*$*$*$*", "*^*^*^*^*^*^*^*^*^*", "*.replace*", "*start-process*", "*http*", "*cmd*powershell*")))
</code></pre>
<p><strong>Untrusted File Execution via JAVA</strong></p>
<p>Identifies when a JAVA interpreter creates an executable file (PE/ELF) and the file is subsequently executed.</p>
<p><strong>Detection Rule when using Endpoint data</strong></p>
<pre><code>sequence by host.id with maxspan=5m
 [ file where event.type != "deletion" and
  process.name : ("java", "java.exe", "javaw.exe") and

  (file.extension : ("exe", "com", "pif", "scr") or
      /* Match Windows PE files by header data (MZ) */
  file.Ext.header_bytes : ("4d5a*", "7f454c46*")) and

  not file.path :  ("?:\\Program Files\\*",
                    "?:\\Program Files (x86)\\*") ] by file.path
 [ process where event.type == "start" and
  not process.code_signature.trusted == true ] by process.executable
</code></pre>
<p><strong>Detection rule when using Endgame streamed events</strong></p>
<pre><code>sequence by agent.id with maxspan=5m
  [ file where event.type != "deletion"
    process.name : ("java", "java.exe", "javaw.exe")] by file_path
  [ process where event.type == "start" and
  not process.code_signature.trusted == true] by process_path
</code></pre>
<p><strong>Potential CoinMiner activity</strong></p>
<p>Process with command line common to cryptocurrency miner (most observed campaigns leveraging log4j exploit are coinminers):</p>
<pre><code>process where event.type == "start" and
 process.command_line :
       ("* pool.*", "*-u*--coin*", "*.xmr.*", "*.xmr1.*",
        "*stratum*", "*elitter.net*", "*cryptonight*",
        "*-a scrypt*", "*stratum1*", "*-userpass*", "*-max-cpu-usage*",
      "*qhor.net*", "*-wallet*pool*", "*--donate-level*", "*supportxmr.com*")
</code></pre>
<p>Other relevant post exploitation detections :</p>
<p><a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_attempt_to_disable_iptables_or_firewall.toml">Attempt to Disable IPTables or Firewall</a></p>
<p><a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_deletion_of_bash_command_line_history.toml">Tampering of Bash Command-Line History</a></p>
<p><a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_log_files_deleted.toml">System Log File Deletion</a></p>
<p><a href="https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/execution_revershell_via_shell_cmd.toml">Potential Reverse Shell Activity via Terminal</a></p>
<p><a href="https://github.com/elastic/detection-rules/blob/main/rules/cross-platform/execution_suspicious_jar_child_process.toml">Suspicious JAVA Child Process</a></p>
<p><a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_attempt_to_disable_syslog_service.toml">Attempt to Disable Syslog Service</a></p>
<h2 id="elasticendgameeqlqueries">Elastic Endgame EQL Queries</h2>
<p><strong>Suspicious Java Netcon followed by Unusual Child Process</strong></p>
<pre><code>sequence with maxspan=5s
 [network where process_name == "java*" and destination_port in (1389, 389, 1099, 53, 5353) and
  destination_address != "127.0.0.1" and not destination_address == "::1"] by pid
 [process where opcode in (1,5) and
  /* Suspicious JAVA child process */
  parent_process_name == "java*" and
   process_name in ("sh", "bash", "dash", "ksh", "tcsh", "zsh", "curl", "perl*", "python*", "ruby*", "php*", "wget", "powershell.exe", "cmd.exe")] by ppid
</code></pre>
<p><strong>Suspicious Shell Commands Execution via Java</strong></p>
<pre><code>process where opcode in (1,5) and
  parent_process_name == "java*" and
  /* Ingress tools transfer via common shell command interpreters */

  /* linux or macos */
 (
  (process_name in ("sh", "bash", "python") and
   wildcard(command_line, "*curl*|*sh*", "*wget*|*bash", "*curl*|*bash*", "*curl*|*bash*", "*http*|*sh*", "*python*http*")) or
  /* windows */
  (process_name in ("powershell.exe", "pwsh.exe", "cmd.exe") and
   wildcard(command_line,"*.downloadstring*", "*.downloadfile*", "*.downloaddata*", "*BitsTransfer*", "* -enc*", "* IEX*", "*wp-content*", "*wp-admin*", "*wp-includes*", "*$*$*$*$*$*", "*^*^*^*^*^*^*^*^*^*","*.replace*", "*start-process*", "*http*", "*cmd*powershell*")))
</code></pre>
<p><strong>Common Coin Miners as a descendant of JAVA</strong></p>
<pre><code>process where opcode in (1, 3, 4, 5) and
 descendant of [process where opcode in (1, 3, 4, 5) and process_name == "java*"] and
 wildcard(command_line, "* pool.*", "*-u*--coin*", "*.xmr.*", "*.xmr1.*", "*stratum*", "*elitter.net*", "*cryptonight*", "*-a scrypt*", "*stratum1*",
"*-userpass*", "*-max-cpu-usage*", "*qhor.net*", "*-wallet*pool*",  "*--donate-level*", "*supportxmr.com*",
/* evasion commands */
"*base64*", "*history -c*", "*ld.so.preload*", "*nmi_watchdog*", "*ufw*disable*", "*.bash_history*", "*chmod*+x*",
"*tor2web*", "*kill*-9*", "*python*-c*http*")
</code></pre>
<p><strong>Untrusted File Execution via JAVA</strong></p>
<pre><code>sequence with maxspan=2m
  [ file where opcode != 2 and file_name == "*.exe" and process_name == "java*"] by file_path
  [ process where opcode in (1,5)] by process_path
</code></pre>
<h2 id="communitydetections">Community Detections</h2>
<p>A number of community members discussing widespread exploitation of the vulnerability have provided insights into a number of early detection methods that analysts may leverage to identify if systems they are using have been exploited or are under active exploitation:</p>
<ul>
<li><p>A series of <a href="https://gist.github.com/nathanqthai/01808c569903f41a52e7e7b575caa890">payloads</a> have been shared by the <a href="https://twitter.com/GreyNoiseIO/status/1469430126819618821">GreyNoise team</a>, including payloads containing both encoded and decoded variants for analysts looking to explore logs stored within their systems. This has been complemented with a list of initial <a href="https://twitter.com/GreyNoiseIO/status/1469334738225741832">tagged IPs</a> attempting exploitation of the vulnerability.</p></li>
<li><p><a href="https://twitter.com/cyb3rops/status/1469243580929740802?s=21">Florian Roth of Nextron Systems</a> has provided a <a href="https://gist.github.com/Neo23x0/e4c8b03ff8cdf1fa63b7d15db6e3860b">series of checks</a> for local exploitation using grep / zgrep, alongside some initial YARA signatures in a Gist listed on his Github account. Florian also shared a method for generating <a href="https://canarytokens.org/generate#">Thinkst</a> <a href="https://twitter.com/cyb3rops/status/1469405846010572816">CanaryTokens</a> to test systems you may manage for exploitability.</p></li>
<li><p><a href="https://twitter.com/mubix">Rob Fuller (Mubix)</a> has shared a list of known file hashes for vulnerable versions of the framework, <a href="https://github.com/mubix/CVE-2021-44228-Log4Shell-Hashes">here</a>.</p></li>
</ul>
<h2 id="additionalmitigationstrategies">Additional Mitigation Strategies</h2>
<p>Outside of the recommended guidance from the Apache team regarding the deployment of the latest, patched versions of the Log4j2 framework to update, a number of mitigations have been widely suggested to prevent exploitation:</p>
<ul>
<li><p><a href="https://www.fastly.com/blog/digging-deeper-into-log4shell-0day-rce-exploit-found-in-log4j">Fastly</a> have suggested checking if your version of Log4j supports executing the JVM with JAVA_OPTS=-Dlog4j2.formatMsgNoLookups=true to disable the lookup functionality to the remote server. This should apply to versions 2.10.0 through 2.15.0.</p></li>
<li><p>To prevent lateral movement from a vulnerable host, or exploitation over the network, limiting connectivity from potentially vulnerable systems to external resources to trusted applications and / or services is recommended.</p></li>
</ul>
<h2 id="thankyoufromelasticsecurity">Thank you, from Elastic Security.</h2>
<p>We want to thank all of the security teams across the globe for your tireless work today and through the weekend, especially those of you listed in this post. Openness and collaboration in the security community to safeguard all users is paramount when facing such a serious and pervasive vulnerability. We want you to know we are here with you every step of the way.</p>
<p>Existing Elastic Security can access these capabilities within the product. If you’re new to Elastic Security, take a look at our <a href="https://www.elastic.co/training/free#quick-starts">Quick Start guides</a> (bite-sized training videos to get you started quickly) or our <a href="https://www.elastic.co/training/free#fundamentals">free fundamentals training courses</a>. You can always get started with a <a href="https://cloud.elastic.co/registration">free 14-day trial of Elastic Cloud</a>. Or <a href="https://www.elastic.co/downloads/">download</a> the self-managed version of the Elastic Stack for free.</p>
<h2 id="referencematerial">Reference Material</h2>
<p><a href="https://www.lunasec.io/docs/blog/log4j-zero-day/">https://www.lunasec.io/docs/blog/log4j-zero-day/</a></p>
<p><a href="https://www.tenable.com/blog/cve-2021-44228-proof-of-concept-for-critical-apache-log4j-remote-code-execution-vulnerability">https://www.tenable.com/blog/cve-2021-44228-proof-of-concept-for-critical-apache-log4j-remote-code-execution-vulnerability</a></p>
<p><a href="https://www.crowdstrike.com/blog/log4j2-vulnerability-analysis-and-mitigation-recommendations/">https://www.crowdstrike.com/blog/log4j2-vulnerability-analysis-and-mitigation-recommendations/</a></p>
<p><a href="https://mbechler.github.io/2021/12/10/PSA_Log4Shell_JNDI_Injection/">https://mbechler.github.io/2021/12/10/PSA_Log4Shell_JNDI_Injection/</a></p>
<p><a href="https://www.greynoise.io/viz/query/?gnql=CVE-2021-44228">https://www.greynoise.io/viz/query/?gnql=CVE-2021-44228</a></p>
<p><a href="https://logging.apache.org/log4j/2.x/security.html#">https://logging.apache.org/log4j/2.x/security.html#</a></p>
<p><a href="https://github.com/christophetd/log4shell-vulnerable-app">https://github.com/christophetd/log4shell-vulnerable-app</a></p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/blog/detecting-log4j2-with-elastic-security</link>
    <guid isPermaLink="false">detecting-log4j2-with-elastic-security</guid>
    <category><![CDATA[Threat Hunting]]></category>
    <dc:creator><![CDATA[Jake King,Samir Bousseaden]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt07cd72987bda80b0/6a7d7f0f3ce8e2646ccf2608/blog-security-detection-720x420.png" length="0" type="image/png"/>
    <pubDate>Tue, 22 Nov 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Detecting and responding to Dirty Pipe with Elastic]]></title>
    <description><![CDATA[Elastic Security is releasing detection logic for the Dirty Pipe exploit.]]></description>
    <content:encoded><![CDATA[<h2 id="preamble">Preamble</h2>
<p>Dirty Pipe is a local privilege escalation vulnerability that is easily exploitable with a handful of working exploit POCs already available. Its broad scope (any user-readable file and affected Linux versions) along with its evolving nature (the SUID shell backdoor exploit) make CVE-2022-0847 especially dangerous for administrators of systems that are potentially vulnerable.</p>
<h3 id="whatisdirtypipecve20220847">What is Dirty Pipe (CVE-2022-0847)?</h3>
<p><a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-0847">CVE-2022-0847</a> is a Linux local privilege escalation vulnerability, discovered by security researcher Max Kellermann that takes advantage of the way the Linux kernel manages page files and named pipes allowing for the overwriting of data in read-only files. This vulnerability impacts Linux kernels 5.8 and later until any version before 5.16.11, 5.15.25, and 5.10.102.</p>
<h3 id="whatistheimpact">What is the impact?</h3>
<p>With many POC’s already released, this vulnerability can be easily exploited to gain root-level privileges by, for instance, rewriting sensitive files like “/etc/passwd” or hijacking a SUID root binary (like sudo) via injection of malicious code.</p>
<h3 id="whatiselasticdoingaboutit">What is Elastic doing about it?</h3>
<p>Elastic is releasing detection logic and Auditd rules that can be used to detect exploitation of this vulnerability.</p>
<h2 id="dirtypipedetails">Dirty Pipe Details</h2>
<p>The vulnerability can be exploited due to a flaw in the new pipe buffer structure where a flag member lacked proper initialization and could then contain a stale value. This could then be used to write to pages within the page cache behind read-only files, allowing for privilege escalation. Given the specific nature of this vulnerability, detection can be quite difficult.</p>
<h3 id="linuxpipescve20220847">Linux Pipes &amp; CVE-2022-0847</h3>
<p><a href="https://man7.org/linux/man-pages/man2/pipe.2.html">Pipes</a> are an interprocess communication mechanism represented as a file within Linux that can receive input data and provide an output for that data. The output of one process can become the input of another using a “pipe” to forward that data between.</p>
<p>Pipes are managed by the CPU in memory and their data is referred to as a “page”.</p>
<p>The exploitation of this vulnerability utilizes a process called “page splicing”. Page splicing is used to merge data between different pipe pages in memory without having to rewrite the data.</p>
<p>The flag we referenced in the summary is the PIPE_BUF_FLAG_CAN_MERGE flag. This must be set in order for a page cache to be merged and is only set when the pipe page becomes full. Howerver, if the page cache is emptied completely this flag remains (lack of initialization) which is where the problem lies.</p>
<p>The exploit functions generally by:</p>
<ol>
<li>Opening a new pipe</li>
<li>Filling the pipe’s page cache with arbitrary data in order to set the PIPE_BUF_FLAG_CAN_MERGE flag</li>
<li>Draining the page cache of data but retaining the PIPE_BUF_FLAG_CAN_MERGE flag and replacing the data with the new data they want to overwrite a read-only file with</li>
<li>The splice (“page splicing”) <a href="https://man7.org/linux/man-pages/man2/syscalls.2.html">syscall</a> is then used to merge the pages (the pipe page and target file page) leading to the new data being added to a target file bypassing the read-only permissions</li>
</ol>
<p>Many of the exploit POCs observed so far target the /etc/passwd file to overwrite and provide the users with elevated root privileges. Other variants of the exploit released allow for the creation of a SUID shell backdoor by overwriting a binary that has SUID permissions (superuser capabilities) giving the user a root shell and complete control.</p>
<p>We anticipate that adversaries and researchers will develop a multitude of other exploitation chains with this particular vulnerability.</p>
<h3 id="proofofconceptcode">Proof Of Concept Code</h3>
<p>The security community has developed a multitude of different tests that adversaries may take advantage of in future attacks against systems. POCs listed below are authored to help security researchers identify if systems are impacted by the vulnerability, and furthermore - test detection strategies.</p>
<ul>
<li>Original Max Kellermann write-up: <a href="https://dirtypipe.cm4all.com/">https://dirtypipe.cm4all.com/</a></li>
<li>SUID shell: ​​<a href="https://haxx.in/files/dirtypipez.c">https://haxx.in/files/dirtypipez.c</a></li>
<li>Passwd overwrite: <a href="https://github.com/liamg/traitor">https://github.com/liamg/traitor</a></li>
<li>Passwd overwrite: ​​<a href="https://github.com/imfiver/CVE-2022-0847">https://github.com/imfiver/CVE-2022-0847</a></li>
<li>Metasploit module: <a href="https://github.com/rapid7/metasploit-framework/pull/16303">https://github.com/rapid7/metasploit-framework/pull/16303</a></li>
</ul>
<h2 id="findingsystemsvulnerabletodirtypipe">Finding systems vulnerable to Dirty Pipe</h2>
<p>Beyond using a traditional vulnerabilty scanner, there are several ways to detect systems vulnerable to Dirty Pipe.</p>
<h3 id="usingtheelasticsecurityintegration">Using the Elastic Security Integration</h3>
<p>If you have Auditbeat, Filebeat (with the Auditd module enabled), or the Elastic Agent (with the Security or Auditd integrations deployed) you can use the Lens visualization tool (located in Kibana) to quickly compile and save a list of vulnerable systems as evidenced in the screenshot below:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt13f2063bf0dd6267/6a7d7ed3e88c65396300890c/dirty-pipe-with-elastic-image7.png" alt="Analyzing your infrastructure for kernel versions impacted by Dirty Pipe" title="Analyzing your infrastructure for kernel versions impacted by Dirty Pipe" /></p>
<h3 id="usingtheosquerymanagerintegration">Using the Osquery Manager Integration</h3>
<p>Additionally, you can use the <a href="https://docs.elastic.co/en/integrations/osquery_manager">Osquery Manager integration</a> to collect the kernel information from all endpoints. To do this, you need to add the Osquery Manager integration to an Elastic Agent policy (Integrations → Osquery Manager → Add Osquery Manager). Once you’ve added the integration, you can perform a simple query: SELECT version FROM kernel_info; which will return the hostname and Linux kernel version from all endpoints with the policy.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt26b896eaa909f0d1/6a7d7ed677b034fa0c3fc5e0/dirty-pipe-with-elastic-image3.jpg" alt="Using Osquery Manager to collect kernel versions" title="Using Osquery Manager to collect kernel versions" /></p>
<h2 id="detectingcve20220847exploitationusingauditd">Detecting CVE-2022-0847 exploitation using Auditd</h2>
<p><a href="https://linux.die.net/man/8/auditd">Auditd</a> is the userspace component of the Linux Auditing System. Auditd stands for Audit Daemon and is a background running service responsible for collecting and writing log files to disk. The Linux Audit System includes a kernel component that hooks system calls and communicates those to Auditd. Auditd is capable of logging System Calls, File Access, and certain pre-configured Audit events. You can install and enable Auditd for free with the package manager on your Linux distribution of choice.</p>
<h3 id="auditdrules">Auditd rules</h3>
<p>Auditd rules define what is to be captured and logged. These rules are generally defined in an audit.rules file and placed at /etc/audit/audit.rules or /etc/audit/rules.d/audit.rules. Events are written to /var/log/audit/audit.log on the local system.</p>
<p>Once you have installed and enabled Auditd, you can add the below lines to your audit.rules file to detect Dirty Pipe exploitation attempts.</p>
<pre><code>Dirty Pipe Auditd rules

-a always,exit -F arch=b64 -S splice -F a0=0x3 -F a2=0x5 -F a3=0x0 -F key=dirtypipe
-a always,exit -F arch=b64 -S splice -F a0=0x6 -F a2=0x8 -F a3=0x0 -F key=dirtypipe
-a always,exit -F arch=b64 -S splice -F a0=0x7 -F a2=0x9 -F a3=0x0 -F key=dirtypipe
</code></pre>
<blockquote>
  <p>The aforementioned rules were adapted by Elastic Security from initial findings by <a href="https://twitter.com/jonasl/status/1501840914381258756">Jonas LeJon</a>.</p>
</blockquote>
<h2 id="linuxauditingsystemeventcollectionwithelastic">Linux Auditing System event collection with Elastic</h2>
<p>There are a few different ways to collect Linux Auditing System events using Elastic. You can either use the Elastic Agent with the Auditd integration, Auditbeat, or the Auditd module for Filebeat.</p>
<blockquote>
  <p>Remember, if you’re using the Auditd integrations for the Elastic Agent or Filebeat, you’ll need to create the <a href="https://www.elastic.co/security-labs/detecting-and-responding-to-dirty-pipe-with-elastic#auditd-rules">Auditd rules described above</a>.</p>
</blockquote>
<h3 id="theelasticagentwauditdintegration">The Elastic Agent w/Auditd Integration</h3>
<p>The Elastic Agent with the <a href="https://docs.elastic.co/en/integrations/auditd">Auditd Integration</a> allows for the collection of Auditd rules. To collect these events, you need to add the Auditd integration to an Elastic Agent policy (Integrations → Auditd → Add Auditd).</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt7e44436ae5f6b862/6a7d7ed94c4bfb7275cca7da/dirty-pipe-with-elastic-image6.png" alt="Elastic Agent Auditd integration" title="Elastic Agent Auditd integration" /></p>
<p>Once this integration is installed to an Elastic Agent policy and deployed to endpoints, you will see Auditd events populated in Kibana.</p>
<p>You can verify that you are receiving Auditd events in Kibana by using the Kibana query event.dataset : "auditd.log".</p>
<h3 id="auditbeat">Auditbeat</h3>
<p>You can use the <a href="https://www.elastic.co/guide/en/beats/auditbeat/current/auditbeat-module-auditd.html">Auditbeat Auditd module</a> to collect the Linux Audit Framework logs. To do this, <a href="https://www.elastic.co/guide/en/beats/auditbeat/current/auditbeat-installation-configuration.html">install Auditbeat</a>. You might encounter errors if another process besides Auditbeat, such as Auditd, is registered to receive data from the Linux Audit Framework. To prevent this conflict, you can stop and disable Auditd from running.</p>
<pre><code>Stopping and disabling Auditd

sudo service auditd.service stop
sudo chkconfig auditd.service off
</code></pre>
<p>Edit the /etc/auditbeat/auditbeat.yml file to point to your local, remote, or cloud cluster and add the Dirty Pipe rules provided above in the Auditd rules section.</p>
<pre><code>Adding Dirty Pipe detection rules to the Auditbeat configuration file

# ===== Modules configuration =====

auditbeat.modules:

* module: auditd

# Load audit rules from separate files. Same format as audit.rules(7)

  audit_rule_files: [ '${path.config}/audit.rules.d/*.conf' ]
  audit_rules: |

## Define audit rules here

## Create file watches (-w) or syscall audits (-a or -A). Uncomment these

## examples or add your own rules

    -a always,exit -F arch=b64 -S splice -F a0=0x3 -F a2=0x5 -F a3=0x0 -F key=dirtypipe
    -a always,exit -F arch=b64 -S splice -F a0=0x6 -F a2=0x8 -F a3=0x0 -F key=dirtypipe
    -a always,exit -F arch=b64 -S splice -F a0=0x7 -F a2=0x9 -F a3=0x0 -F key=dirtypipe

…truncated…
</code></pre>
<p>Check the configuration and connectivity of Auditbeat using the test commands.</p>
<pre><code>Testing the Auditbeat configuration and output settings

sudo auditbeat test config
sudo auditbeat test output
</code></pre>
<p>Run the Auditbeat setup command using sudo auditbeat setup.</p>
<p>Start Auditbeat using sudo systemctl start auditbeat.service.</p>
<p>Now you should be able to verify events are being populated in the auditbeat-* Data View within Kibana.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt184c4f9d1f48d4e7/6a7d7edc73d9bd83ff29ab70/dirty-pipe-with-elastic-image4.jpg" alt="Auditbeat Data View in Kibana" title="Auditbeat Data View in Kibana" /></p>
<h3 id="filebeat">Filebeat</h3>
<p>You can use the <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-auditd.html">Auditd module for Filebeat</a> to collect the Auditd logs as well. To do this, <a href="https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-installation-configuration.html">install Filebeat</a> and then enable the Auditd module</p>
<p>sudo filebeat modules enable auditd</p>
<p>Next, go into the Auditd configuration file and enable log collection, test, setup, and then start Filebeat.</p>
<pre><code>Enabling Auditd log in the Filebeat configuration file

sudo vi /etc/filebeat/modules.d/auditd.yml

# Module: auditd

# Docs: &lt;https://www.elastic.co/guide/en/beats/filebeat/master/filebeat-module-auditd.html&gt;

* module: auditd
  log:
    enabled: true

# Set custom paths for the log files. If left empty

# Filebeat will choose the paths depending on your OS

    #var.paths:
</code></pre>
<pre><code>Testing the Filebeat configuration and output settings

sudo filebeat test config
sudo filebeat test output
</code></pre>
<p>Run the Filebeat setup command using sudo filebeat setup.</p>
<p>Start Filebeat using sudo systemctl start filebeat.service.</p>
<h2 id="detectingdirtypipewithelastic">Detecting Dirty Pipe with Elastic</h2>
<p>Now that Linux Audit Framework events are being populated by either the Elastic Agent, Auditbeat, or Filebeat, you can run queries to detect exploitation attempts using the Kibana Query Language (KQL) in Discover or the Endpoint Query Language (EQL) in Kibana’s Security → Timelines → New Timeline → Correlation query editor.</p>
<h3 id="huntqueriesinkibana">Hunt queries in Kibana</h3>
<p>KQL query compatible with using the Elastic Agent, Auditbeat, or Filebeat:</p>
<pre><code>KQL query to detect Dirty Pipe exploitation attempts

auditd.log.key : dirtypipe and process.name : *
</code></pre>
<p>EQL query compatible with using the Auditbeat:</p>
<pre><code>EQL query to detect Dirty Pipe exploitation attempts

process where tags : "dirtypipe" and not process.name : ""
</code></pre>
<h3 id="detectionenginealerts">Detection Engine alerts</h3>
<p>You can also create a Detection Engine alert to monitor for exploitation attempts.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1737e2bb4bf318cc/6a7d7edf51156ad5fd2bf80b/dirty-pipe-with-elastic-image2.jpg" alt="Dirty Pipe Detection Rule" title="Dirty Pipe Detection Rule" /></p>
<p>Exploitation attempts will be recorded in the Kibana Security Solution in the Alerts section.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3a0f1fb92cfbcedb/6a7d7ee22f00b2903cefbe58/dirty-pipe-with-elastic-image5.png" alt="A preview of alerts created pertaining to the log keys created by Auditd" title="A preview of alerts created pertaining to the log keys created by Auditd" /></p>
<h2 id="respondtoobservedthreats">Respond to Observed Threats</h2>
<p>Elastic makes it easy to quickly respond to a threat by isolating the host while still allowing it to communicate with your stack in order to continue monitoring actions taken and/or remediate the threat.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltdd32a4b0a1e446bb/6a7d7ee54c4bfbfc11cca7e2/dirty-pipe-with-elastic-image1.png" alt="In-platform capabilities of Elastic Security demonstrating response capabilities" title="In-platform capabilities of Elastic Security demonstrating response capabilities" /></p>
<h2 id="defenseindepthrecommendations">Defense in Depth Recommendations</h2>
<p>The following steps can be leveraged to improve a network’s protective posture:</p>
<ol>
<li>Review and ensure that you have deployed the latest stable and vendor-supplied kernel for your OS’</li>
<li>Review and implement the above detection logic within your environment using technology described in the post</li>
<li>Maintain backups of your critical systems to aid in quick recovery</li>
</ol>
<h2 id="references">References</h2>
<p>The following research was referenced throughout the document:</p>
<ul>
<li>Exploit CVE reference: <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-0847">CVE-2022-0847</a></li>
<li>Write-up using eBPF for some detections: <a href="https://sysdig.com/blog/cve-2022-0847-dirty-pipe-sysdig/">https://sysdig.com/blog/cve-2022-0847-dirty-pipe-sysdig</a></li>
<li>Original Max Kellermann write-up: <a href="https://dirtypipe.cm4all.com/">https://dirtypipe.cm4all.com/</a></li>
<li>SUID shell: ​​<a href="https://haxx.in/files/dirtypipez.c">https://haxx.in/files/dirtypipez.c</a></li>
<li>Passwd overwrite: <a href="https://github.com/liamg/traitor">https://github.com/liamg/traitor</a></li>
<li>Passwd overwrite: ​​<a href="https://github.com/imfiver/CVE-2022-0847">https://github.com/imfiver/CVE-2022-0847</a></li>
<li>Metasploit module: <a href="https://github.com/rapid7/metasploit-framework/pull/16303">https://github.com/rapid7/metasploit-framework/pull/16303</a></li>
<li>Original Auditd detection logic: <a href="https://twitter.com/jonasl/status/1501840914381258756?s=20&amp;t=MIWwwXpl5t0JiopVxX5M5Q">https://twitter.com/jonasl/status/1501840914381258756?s=20&amp;t=MIWwwXpl5t0JiopVxX5M5Q</a></li>
</ul>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/blog/detecting-and-responding-to-dirty-pipe-with-elastic</link>
    <guid isPermaLink="false">detecting-and-responding-to-dirty-pipe-with-elastic</guid>
    <category><![CDATA[Threat Hunting]]></category>
    <dc:creator><![CDATA[Colson Wilhoit,Samir Bousseaden,Jake King,Andrew Pease]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt40b1b089c0593a13/6a7d7ee8227b1c230459579c/photo-edited-01@2x.jpg" length="0" type="image/jpeg"/>
    <pubDate>Fri, 09 Sep 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Elastic protects against data wiper malware targeting Ukraine: HERMETICWIPER]]></title>
    <description><![CDATA[Analysis of the HERMETICWIPER malware targeting Ukranian organizations.]]></description>
    <content:encoded><![CDATA[<h2 id="introduction">Introduction</h2>
<p>On February 23, 2022, the ESET threat research team <a href="https://twitter.com/ESETresearch/status/1496581903205511181">disclosed a series of findings</a> pertaining to a Data Wiper malware campaign, impacting hundreds of systems across Ukraine, named <a href="https://twitter.com/juanandres_gs/status/1496607141888724997">HERMETICWIPER</a>. Elastic previously published research on <a href="https://www.elastic.co/security-labs/operation-bleeding-bear">Operation Bleeding Bear</a>, a campaign targeted towards Ukrainian assets with similar destructive intentions.</p>
<p>Malware Wipers remain a common tactic of adversaries looking to cause havoc on systems impacted by their payloads. Typically this class of malware is designed to wipe the contents of any drives a system may have, rendering the end-users personal data lost. Many more recent examples of this class of payload incorporate tactics that also tamper with the boot process, with HERMETICWIPER being no exception.</p>
<p>Customers leveraging the Elastic Agent version 7.9+, and above are protected against this specific malware, with further research being undertaken to improve detection efficacy.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt04fcee5e7d91ef88/6a7c8094437e0f3f10dd55ac/malware-targeting-ukraine-hermeticwiper-8.png" alt="" /></p>
<h2 id="malwarewipersukrainiantargets">Malware Wipers &amp; Ukrainian Targets</h2>
<p>Unfortunately, this is not the first time this year that Ukranian systems have been the target of Data-wiping payloads - Microsoft <a href="https://therecord.media/microsoft-data-wiping-malware-disguised-as-ransomware-targets-ukraine-again/">published findings</a> pertaining to similar, observed attacks that impacted systems within Ukraine, however initially impacting a far smaller number of systems. The publication outlined that the targeting of this specific earlier campaign was focused on multiple government agencies, non-profits, and information technology organizations throughout the country.</p>
<h2 id="malwarestageanalysis">Malware Stage Analysis</h2>
<p>HERMETICWIPER is digitally signed by Hermetica Digital Ltd., an organization <a href="https://opencorporates.com/companies/cy/HE419469">registered</a> in Cyprus, and embeds 4 legitimate driver files from <a href="https://www.easeus.com/partition-manager">EaseUS Partition Manager</a> that are compressed using MS-DOS utility (mscompress). Hermetica Digital Ltd. has revoked the code-signing certificate.</p>
<p>Upon execution, HERMETICWIPER creates a kernel mode service and interacts with it via DeviceIoControl API function. The main objective is to corrupt any attached physical drive and render the system data unrecoverable.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte5d222b3030c8e66/6a7c80976c6eac4b7af0e39b/malware-targeting-ukraine-hermeticwiper-20.png" alt="" /></p>
<p>Below is a summary of the events generated during the installation phase using, Windows events logs and Elastic Agent.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blted12be3c10f74326/6a7c809a448e4e67a15bab08/malware-targeting-ukraine-hermeticwiper-16.jpg" alt="" /></p>
<p>Following the installation process, HERMETICWIPER determines the dimensions of each partition by calculating the bytes in each sector and sectors in each cluster using the GetDiskFreeSpaceW Windows API <a href="https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdiskfreespacew">function</a>.</p>
<p>The malware interacts with the IOCTL interface, passing the parameter IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS with a value of 0x560000 to the device driver in order to retrieve the physical location of the root driver (\.\C). The root drive corresponds to the volume Windows uses to boot, and its identification is essential to achieve a destructive impact.</p>
<p>The NTFS/FAT boot sector and random file physical offsets are enumerated for each accessible physical drive, and then overwritten by the output of the CryptGenRandom <a href="https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom">API function</a> and a series of FSCTL_GET_RETRIEVAL_POINTERS and FSCTL_MOVE_FILE IOCTLs.</p>
<p>Once the system crashes or restarts, the system is unable to boot and the data is corrupted.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt98a0106e64de8e0d/6a7c809d33fa8ac0c41fc906/malware-targeting-ukraine-hermeticwiper-15.jpg" alt="" /></p>
<h2 id="interestingfunctionality">Interesting Functionality</h2>
<p>Similar to different ransomware families, HERMETICWIPER avoids specific critical folders and files during the wiping process. This ensures the machine is still operable and will not impact the disk wiping/file corrupting process at a later stage.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt4207a9dec99c0adf/6a7c809fead8ec7f91ba48e2/malware-targeting-ukraine-hermeticwiper-13.jpg" alt="" /></p>
<p>Another interesting technique observed when targeted files are queued for wiping is how they are accessed by concatenating the value ::$INDEX_ALLOCATION to a filename. This documented <a href="https://sec-consult.com/blog/detail/pentesters-windows-ntfs-tricks-collection/">NTFS trick</a> is an additional method to bypass access-control list (ACL) permissions on targeted files to provide more reliability when accessing these files.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt88deb72380288459/6a7c80a21967ea106a32a834/malware-targeting-ukraine-hermeticwiper-19.jpg" alt="" /></p>
<p>HERMETICWIPER also modifies two registry settings during execution (ShowCompColor and ShowInfoTip), setting those key values to 0. Within Windows, when a user chooses to compress NTFS directories/files, there is a setting that allows the user to differentiate them in Windows Explorer showing them as blue representing compressed data or green for encrypted data. This is an attempt by the malware to not set off any suspicious behavior to the user with different coloring on directories/files before the disk corruption occurs on the machine.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta8b61ca26000215e/6a7c80a5227b1c31a7592668/malware-targeting-ukraine-hermeticwiper-6.jpg" alt="" /></p>
<h2 id="shreddingcomponentanalysis">Shredding Component Analysis</h2>
<p>The malware wipes specific target folders/files writing pre-generated random data at specific disk addresses. It does this by setting up 4 different shredding queues in the binary.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt5b3bf24224e42797/6a7c80a7da3d054b3b633d58/malware-targeting-ukraine-hermeticwiper-3.jpg" alt="" /></p>
<p>Each queue usage and its functionality is undetermined, but are used at different points in the sample. The shredding queue is composed of a linked list of targets which contain random pre-generated data (generated at queuing) of the size of the target, the disk number and a linked list of “file” parts with disk addresses and sizes.</p>
<pre><code>HERMETICWIPER Structure for ShredTarget function

struct ctf::ShredTarget
{
ctf::ShredTarget *p_next;
ctf::ShredTarget *p_prev;
ctf::FilePart *p_parts;
int disk_number;
uint8_t *p_random_filled_buffer;
int p_random_filled_buffer_size;
};
</code></pre>
<pre><code>HERMETICWIPER Structure for FilePart function

struct ctf::FilePart
{
ctf::FilePart *p_next;
ctf::FilePart *p_prev;
uint64_t start_address;
uint64_t size;
};
</code></pre>
<pre><code>HERMETICWIPER targeting file, folder, and disk partitions

ctf::QueueFileShred
ctf::QueueFolderShred
ctf::callback::IfPathContainNtUserQueueFileShred
ctf::callback::QueueNtfsBitmapAndLogAttributeShred
ctf::callback::QueueFileShredIfNotSymlink
ctf::callback::QueuePartitionFirstClusterShred
ctf::callback::QueuePartitionShred
</code></pre>
<p>The malware emphasizes the following items that are targeted for shredding.</p>
<ul>
<li>The dropped driver if something goes wrong or after service start:</li>
</ul>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt63361f3e0fe24718/6a7c80aaead8ec3b96ba48e8/malware-targeting-ukraine-hermeticwiper-4.jpg" alt="" /></p>
<ul>
<li>The malware process itself if driver launch goes wrong:</li>
</ul>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltb574ab8048b20699/6a7c80adc33f4fc724d54a16/malware-targeting-ukraine-hermeticwiper-image-21.jpg" alt="" /></p>
<ul>
<li>The disk’s partition first cluster (enumerates up to 100):</li>
</ul>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltc476abb9ea75d0ba/6a7c80af4c4bfbbc54cc7881/malware-targeting-ukraine-hermeticwiper-7.jpg" alt="" /></p>
<ul>
<li>The System Volume information direct used to store Windows restore points:</li>
</ul>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blted3f23efeec1fa93/6a7c80b2da3d05214f633d5c/malware-targeting-ukraine-hermeticwiper-14.jpg" alt="" /></p>
<p>Interestingly if the computer doesn’t belong to a domain controller it will target more assets:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt9a9f2123b5cd3fdf/6a7c80b5fc63ab1445646f0a/malware-targeting-ukraine-hermeticwiper-5.jpg" alt="" /></p>
<p>After queuing the different targets previously described, the sample starts different synchronous/asynchronous shredding threads for each of its queues:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt0e5579863c9bd189/6a7c80b74c4bfb77a1cc7885/malware-targeting-ukraine-hermeticwiper-10.jpg" alt="" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6c38466ab22e964a/6a7c80ba1967ea4e5e32a844/malware-targeting-ukraine-hermeticwiper-12.jpg" alt="" /></p>
<p>The thread launcher will then start a new thread for each target.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt3a79009285e1e8e0/6a7c80bc42a117f2ef95609a/malware-targeting-ukraine-hermeticwiper-9.jpg" alt="" /></p>
<p>The shredding thread will then iterate through the target’s file parts and use the driver for writing at addresses on specified disk.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt34572d27383c86cc/6a7c80bf5967e5094d5d7503/malware-targeting-ukraine-hermeticwiper-17.jpg" alt="" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltf9bf9544fb4e9957/6a7c80c2c2cc097930243356/malware-targeting-ukraine-hermeticwiper-1.jpg" alt="" /></p>
<h2 id="driveranalysis">Driver Analysis</h2>
<p>The driver that is loaded by the user mode component is quite similar to the driver that belongs to Eldos Rawdisk and has been leveraged previously by threat actors like <a href="https://securelist.com/shamoon-the-wiper-further-details-part-ii/57784/">Shamoon</a> and Lazarus. The difference is that HERMETICWIPER abuses a driver (epmntdrv.sys) that belongs to EaseUS Partition Master, a legitimate disk partitioning software.</p>
<p>When the driver is loaded, it creates a device named \Device\EPMNTDRV and creates a symbolic link to be exposed to user mode. Then, it initializes the driver object with the following entry points.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt67d72aa6b82a7016/6a7c80c53ce8e2f9bbcef6c9/malware-targeting-ukraine-hermeticwiper-2.jpg" alt="" /></p>
<p>Looking at the dispatch function that handles the IRP_MJ_CREATE requests, we can see that the driver builds the name of the symlink \Device\HarddiskX\Partition0 and saves a pointer to its file object on the driver’s file object fs context. The driver then uses the volume manager device object to obtain a pointer to the highest level device object in the disk device stack.</p>
<p>After that, it iterates over the stack looking for the Disk driver, that is the Microsoft storage class driver that implements functionality common to all storage devices. Once found, it saves a pointer to its device object in the FsContext2 field of the file object structure.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt8bca0b58f6d6f395/6a7c80c773d9bd4a8d297bc8/malware-targeting-ukraine-hermeticwiper-11.jpg" alt="" /></p>
<p>Moving to the function that handles the write requests, we can see that it builds an asynchronous <a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/gettingstarted/i-o-request-packets">Input Output Request Packet</a> (IRP), which is an API used for drivers to communicate with each other, and forwards it the volume manager device. The buffer used in the IRP is described by the <a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/ns-wdm-_mdl">Memory Descriptor List</a> (MDL) driver function. Finally, a completion routine is provided that will free the MDL and release memory used by the IRP.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blta1393af07b5fa243/6a7c80cae02faca9db5d04a3/malware-targeting-ukraine-hermeticwiper-18.png" alt="" /></p>
<p>The read requests are similar to the write requests in concept, in other words, the IoBuildsynchronousFsdRequest() <a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-iobuildsynchronousfsdrequest">API function</a> uses the IRP_MJ_READ <a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/ifs/irp-mj-read">driver function</a> instead of the IRP_MJ_WRITE <a href="https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/irp-mj-write">driver function</a> when sending the IRP to the driver. Finally, the routine that handles I/O control codes finds the highest device object in the stack where the volume manager is located and calls IoBuildDeviceIoControlRequest() to forward the IRP that contains the I/O control code to the appropriate driver.</p>
<blockquote>
  <p>All in all, the driver functionality is very simple. It acts as a proxy between user space and the low level file system drivers, allowing raw disk sector manipulation and as a result circumventing Windows operating system security features.</p>
</blockquote>
<h2 id="prebuiltdetectionenginealerts">Prebuilt Detection Engine Alerts</h2>
<p>The following existing <a href="https://github.com/elastic/detection-rules">public detection rules</a> can also be used to detect some of the employed post exploitation techniques described by Symantec Threat Intelligence Team and ESET [<a href="https://symantec-enterprise-blogs.security.com/blogs/threat-intelligence/shuckworm-gamaredon-espionage-ukraine">1</a>][<a href="https://symantec-enterprise-blogs.security.com/blogs/threat-intelligence/ukraine-wiper-malware-russia">2</a>][<a href="https://www.welivesecurity.com/2022/03/01/isaacwiper-hermeticwizard-wiper-worm-targeting-ukraine/">3</a>] :</p>
<ul>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/execution_suspicious_cmd_wmi.toml">Suspicious Cmd Execution via WMI</a> (Deployment of wiper via Impacket WMI)</li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/lateral_movement_direct_outbound_smb_connection.toml">Direct Outbound SMB Connection</a> (SMB spreader)</li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/lateral_movement_remote_services.toml">Remotely Started Services via RPC</a> (Remcom)</li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/lateral_movement_executable_tool_transfer_smb.toml">Lateral Tool Transfer</a> (staging PE via file shares for remote execution)</li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/credential_access_cmdline_dump_tool.toml">Potential Credential Access via Windows Utilities</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/credential_access_suspicious_lsass_access_memdump.toml">Potential Credential Access via LSASS Memory Dump</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/execution_from_unusual_directory.toml">Process Execution from an Unusual Directory</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/execution_from_unusual_path_cmdline.toml">Execution from Unusual Directory - Command Line</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/persistence_suspicious_scheduled_task_runtime.toml">Scheduled Task Execution</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/persistence_local_scheduled_task_creation.toml">Scheduled Task Creation</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/windows/defense_evasion_mshta_beacon.toml">Suspicious MSHTA Execution</a></li>
</ul>
<h2 id="yararules">YARA Rules</h2>
<pre><code>rule Windows_Wiper_HERMETICWIPER {
    meta:
        Author = "Elastic Security"
        creation_date = "2022-02-24"
        last_modified = "2022-02-24"
        os = "Windows"
        arch = "x86"
        category_type = "Wiper"
        family = "HERMETICWIPER"
        threat_name = "Windows.Wiper.HERMETICWIPER"
        description = "Detects HERMETICWIPER used to target Ukrainian organization"
        reference_sample = "1bc44eef75779e3ca1eefb8ff5a64807dbc942b1e4a2672d77b9f6928d292591"

    strings:
        $a1 = "\\\\?\\C:\\Windows\\System32\\winevt\\Logs" wide fullword
        $a2 = "\\\\.\\EPMNTDRV\\%u" wide fullword
        $a3 = "tdrv.pdb" ascii fullword
        $a4 = "%s%.2s" wide fullword
        $a5 = "ccessdri" ascii fullword
        $a6 = "Hermetica Digital"
    condition:
        all of them
}
</code></pre>
<h2 id="observables">Observables</h2>
<p>| Observable                                                       | Type    | Reference     | Note          |
| ---------------------------------------------------------------- | ------- | ------------- | ------------- |
| 1bc44eef75779e3ca1eefb8ff5a64807dbc942b1e4a2672d77b9f6928d292591 | SHA-256 | Wiper malware | HERMETICWIPER |
| 0385eeab00e946a302b24a91dea4187c1210597b8e17cd9e2230450f5ece21da | SHA-256 | Wiper malware | HERMETICWIPER |
| 3c557727953a8f6b4788984464fb77741b821991acbf5e746aebdd02615b1767 | SHA-256 | Wiper malware | HERMETICWIPER |
| 2c10b2ec0b995b88c27d141d6f7b14d6b8177c52818687e4ff8e6ecf53adf5bf | SHA-256 | Wiper malware | HERMETICWIPER |</p>
<h2 id="artifacts">Artifacts</h2>
<p>Artifacts are also available for <a href="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt42ce05ad40a762e8/628e88d9bd980555189d997b/hermeticwiper-indicators.zip">download</a> in both ECS and STIX format in a combined zip bundle.</p>
<h2 id="references">References</h2>
<p>The following research was referenced throughout the document:</p>
<ul>
<li><a href="https://twitter.com/ESETresearch/status/1496581903205511181">https://twitter.com/ESETresearch/status/1496581903205511181</a></li>
<li><a href="https://twitter.com/juanandres_gs/status/1496607141888724997">https://twitter.com/juanandres_gs/status/1496607141888724997</a></li>
<li><a href="https://elastic.co/security-labs/operation-bleeding-bear">https://elastic.co/security-labs/operation-bleeding-bear</a></li>
<li><a href="https://therecord.media/microsoft-data-wiping-malware-disguised-as-ransomware-targets-ukraine-again/">https://therecord.media/microsoft-data-wiping-malware-disguised-as-ransomware-targets-ukraine-again/</a></li>
<li><a href="https://opencorporates.com/companies/cy/HE419469">https://opencorporates.com/companies/cy/HE419469</a></li>
<li><a href="https://www.easeus.com/partition-manager">https://www.easeus.com/partition-manager</a></li>
<li><a href="https://docs.microsoft.com/en-us/windows/win32/devio/device-input-and-output-control-ioctl-">https://docs.microsoft.com/en-us/windows/win32/devio/device-input-and-output-control-ioctl-</a></li>
<li><a href="https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdiskfreespacew">https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-getdiskfreespacew</a></li>
<li><a href="https://docs.microsoft.com/en-us/windows/win32/secauthz/access-tokens">https://docs.microsoft.com/en-us/windows/win32/secauthz/access-tokens</a></li>
<li><a href="https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-findresourcew">https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-findresourcew</a></li>
<li><a href="https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadresource">https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadresource</a></li>
</ul>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper</link>
    <guid isPermaLink="false">elastic-protects-against-data-wiper-malware-targeting-ukraine-hermeticwiper</guid>
    <category><![CDATA[Malware Analysis]]></category>
    <dc:creator><![CDATA[Daniel Stepanic,Mark Mager,Remco Sprooten,Jake King,Andrew Pease]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltd1e55aa245cc570c/6a7c80cd448e4e27cc5bab14/photo-edited-11@2x.jpg" length="0" type="image/jpeg"/>
    <pubDate>Fri, 09 Sep 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[A peek behind the BPFDoor]]></title>
    <description><![CDATA[In this research piece, we explore BPFDoor — a backdoor payload specifically crafted for Linux in order to gain re-entry into a previously or actively compromised target environment.]]></description>
    <content:encoded><![CDATA[<h2 id="preamble">Preamble</h2>
<p><a href="https://doublepulsar.com/bpfdoor-an-active-chinese-global-surveillance-tool-54b078f1a896">BPFDoor</a> is a backdoor payload specifically crafted for Linux. Its purpose is for long-term persistence in order to gain re-entry into a previously or actively compromised target environment. It notably utilizes BPF along with a number of other techniques to achieve this goal, taking great care to be as efficient and stealthy as possible. PWC researchers discovered this very interesting piece of malware in 2021. PWC attributes this back door to a specific group from China, Red Menshen, and detailed a number of interesting components in a high-level threat research post released <a href="https://www.pwc.com/gx/en/issues/cybersecurity/cyber-threat-intelligence/cyber-year-in-retrospect/yir-cyber-threats-report-download.pdf">last week</a>.</p>
<p>PWC’s findings indicated that ​​Red Menshen had focused their efforts on targeting specific Telecommunications, Government, Logistics, and Education groups across the Middle East and Asia. This activity has been across a Monday-to-Friday working period, between 01:00 UTC and 10:00 UTC, indicating that the operators of the malware were consistent in their attacks, and operation during a working week.</p>
<p>Perhaps most concerningly, the payload itself has been observed across the last 5 years in various phases of development and complexity, indicating that the threat actor responsible for operating the malware has been at it for some time, undetected in many environments.</p>
<blockquote>
  <p><strong>BPFDoor Tools</strong></p>
  <p>The Elastic Security Team has created a few tools that will aid researchers in analyzing the BPFDoor malware.</p>
  <p>The BPFDoor scanner will allow you to scan for hosts infected with the BPFDoor malware and the BPFDoor configuration extractor will allow you to extrapolate the malware’s configuration or hardcoded values which can lead to additional observations you can use for further analysis, developing additional signatures or connecting to the backdoor utilizing our client.</p>
  <ul>
  <li><a href="https://www.elastic.co/security-labs/bpfdoor-scanner">BPFDoor scanner</a></li>
  <li><a href="https://www.elastic.co/security-labs/bpfdoor-configuration-extractor">BPFDoor configuration extractor</a></li>
  </ul>
</blockquote>
<h2 id="attacklifecycle">Attack Lifecycle</h2>
<p>This inherently passive backdoor payload is built to be a form of persistence – a method to regain access if the first or second stage payloads are lost. It is built for and intended to be installed on high-uptime servers or appliances, IoT/SCADA, or cloud systems with access to the Internet. The backdoor usually sits in temporary storage so if a server were to be rebooted or shut down, the backdoor would be lost.</p>
<p>It should be assumed that if this malware is found on a system the initial-access (1st stage) or post-exploitation (2nd stage) payloads are still most likely present and possibly active elsewhere in the environment. This backdoor excels at stealth, taking every opportunity to blend in and remain undetected.</p>
<p>In the below steps, we will break BPFDoor’s actions down according to the vast majority of the samples available.</p>
<ol>
<li>When executed the binary copies itself into /dev/shm/. A temporary filesystem /dev/shm stands for shared memory and is a temporary file storage facility serving as an efficient means of inter-process communication</li>
<li>Renames its process to kdmtmpflush, a hardcoded process name</li>
<li>Initializes itself with the -init flag and forks itself. Forking in Linux means creating a new process by duplicating the calling process</li>
<li>Deletes itself by removing the original binary invoked. The forked process continues to run</li>
<li>Alters the forked processes’ creation and modification time values, also known as <a href="https://attack.mitre.org/techniques/T1070/006/">timestomping</a></li>
<li>Creates a new process environment for itself and removes the old one setting (spoofing) a new process name. It changes the way it appears on the system akin to wearing a mask. The process is still kdmtmpflush but if you were to run a ps you would see whatever value it set</li>
<li>Creates a process ID (PID) file in /var/run. PID files are text files containing the process of the associated program meant for preventing multiple starts, marking residency, and used by the program to stop itself. This file resides in /var/run, another temporary file storage facility</li>
<li>Creates a raw network socket. On Linux, a socket is an endpoint for network communication that allows you to specify in detail every section of a packet allowing a user to implement their own transport layer protocol above the internet (IP) level</li>
<li>Sets BPF filters on the raw socket. <a href="https://www.kernel.org/doc/html/v5.12/networking/filter.html">BPF</a> allows a user-space program to attach a filter onto any socket and allow or disallow certain types of data to come through the socket</li>
<li>Observes incoming packets</li>
<li>If a packet is observed that matches the BPF filters and contains the required data it is passed to the backdoor for processing</li>
<li>It forks the current process again</li>
<li>Changes the forked processes working directory to /</li>
<li>Changes (spoofs) the name of the forked process to a hardcoded value</li>
<li>Based on the password or existence of a password sent in the “magic packet” the backdoor provides a reverse shell, establishes a bind shell, or sends back a ping</li>
</ol>
<blockquote>
  <p><strong>Atypical BPFDoor sample</strong></p>
  <p>Of note there is one <a href="https://www.virustotal.com/gui/file/07ecb1f2d9ffbd20a46cd36cd06b022db3cc8e45b1ecab62cd11f9ca7a26ab6d/detection">sample</a> we have come across that does not seem to exhibit steps 1 - 4. It doesn’t alter its initial name to a hardcoded value and simply executes from its placed location, otherwise, it models the same behavior.</p>
</blockquote>
<p>Below you can see visual representations of the BPFDoor process tree, utilizing Elastic’s Analyzer View. The first image displays the tree prior to active use of the backdoor (i.e reverse shell, bind shell, or pingback) and the second image after a reverse shell has connected and performed post-exploitation activities.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt41668c92f0ade3ee/6a7c7581437e0fdd9cdd537e/analyzer-view.png" alt="Elastic Analyzer View of the BPFDoor initial invocation process tree" title="Elastic Analyzer View of the BPFDoor initial invocation process tree" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt5730f12cf60d8692/6a7c7584e88c657a97005644/bpfdoor_analyzer.png" alt="Elastic Analyzer View of BPFDoor following a reverse shell connection and post exploitation actions" title="Elastic Analyzer View of BPFDoor following a reverse shell connection and post exploitation actions" /></p>
<h2 id="defenseevasioninsights">Defense Evasion Insights</h2>
<p>BPFDoor is interesting given the anti-forensics, and obfuscation tactics used. Astute readers will observe slight differences in the PID tree visible when running a ps ajxf on an infected host when compared to executed data within the Analyzer View inside of Elastic. This is due to the process name spoofing mentioned in step 6 (above) of the attack lifecycle above. The image below is taken from a system running BPFDoor with an active reverse shell connection established:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt323e10b2ad14a84f/6a7c75872f00b2a867ef8c2b/observed-process.jpg" alt="An observed running process created by the BPFDoor reverse shell" title="An observed running process created by the BPFDoor reverse shell" /></p>
<p>The difference lies in the fact that kdmtmpflush and sh are run prior to spoofing, and are captured at runtime by Elastic Endpoint. This is an accurate representation of the processes active on the host, further confirming the importance of appropriate observation software for Linux hosts - you can’t always trust what you see on the local system:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt43df33460f229a29/6a7c75898fc2d053223e86d7/analyzer-terminated.jpg" alt="Elastic Analyzer View of BPFDoor demonstrating real process capture." title="Elastic Analyzer View of BPFDoor demonstrating real process capture." /></p>
<p>BPFDoor also holds in its repertoire the ability to subvert the traditional Linux socket client - server architecture in order to hide its malicious traffic. The methods which it utilizes to achieve this are both unusual and intriguing.</p>
<p>The sockets interface is almost synonmous with TCP/IP communication. This simple interface has endured for over 40 years - predating both Linux and Windows implementations.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6d391b8dc265f82f/6a7c758c96b5a6325f875391/tcp-ip.png" alt="Example of how TCP/IP and socket interfaces function" title="Example of how TCP/IP and socket interfaces function" /></p>
<p>BPFDoor uses a raw socket (as opposed to ‘cooked’ ones that handle IP/TCP/UDP headers transparently) to observe every packet arriving at the machine, ethernet frame headers and all. While this might sound like a stealthy way to intercept traffic, it’s actually not – on any machine with a significant amount of network traffic the CPU usage will be consistently high.</p>
<p>That’s where BPF comes in - an extremely efficient, kernel-level packet filter is the perfect tool to allow the implant to ignore 99% of network traffic and only become activated when a special pattern is encountered. This implant looks for a so-called magic packet in every TCP, UDP and ICMP packet received on the system.</p>
<p>Once activated, a typical reverse shell - which this back door also supports - creates an outbound connection to a listener set up by the attacker. This has the advantage of bypassing firewalls watching inbound traffic only. This method is well-understood by defenders, however. The sneakiest way to get a shell connected would be to reuse an existing packet flow, redirected to a separate process.</p>
<p>In this attack, the initial TCP handshake is done between the attacker and a completely legitimate process – for example nginx or sshd. These handshake packets happen to be also delivered to the backdoor (like every packet on the system) but are filtered out by BPF. Once the connection is established, however, BPFDoor sends a magic packet to the legitimate service. The implant receives it and makes a note of the originating IP and port the attacker is using, and it opens a new listening socket on an inconspicuous port (42391 - 43391).</p>
<p>The implant then reconfigures the firewall to temporarily redirect all traffic from the attacker’s IP/port combination to the new listening socket. The attacker initiates a second TCP handshake on the same legitimate port as before, only now iptables forwards those packets to the listening socket owned by the implant. . This establishes the communication channel between attacker and implant that will be used for command and control. The implant then covers its tracks by removing the iptables firewall rules that redirected the traffic.</p>
<p>Despite the firewall rule being removed, traffic on the legitimate port will continue to be forwarded to the implant due to how Linux statefully tracks connections. No visible traffic will be addressed to the implant port (although it will be delivered there).</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt021decdd384bc882/6a7c75904c4bfbf81ccc7670/network-flows.png" alt="A diagram representing the aforementioned network flows" title="A diagram representing the aforementioned network flows" /></p>
<h2 id="bpffilters">BPF Filters</h2>
<p>As stated in step 9 (above), <a href="https://www.kernel.org/doc/html/v5.12/networking/filter.html">BPF</a> or Berkeley Packet Filters is a technology from the early ’90s that allows a user-space program to attach a network filter onto any socket and allow or disallow certain types of data to come through the socket. These filters are made up of bytecode that runs on an abstract virtual machine in the Linux kernel. The BPF virtual machine has functionality to inspect all parts of incoming packets and make an allow/drop decision based on what it sees. . You can see in the image example below what this looks like within the BPFDoor source code:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltfffca6986c4a71ac/6a7c7593c33f4fb4d1d5474f/bpfdoor-source-code.jpg" alt="BPFDoor source code BPF Filters" title="BPFDoor source code BPF Filters" /></p>
<p>We took this BPF code, converted it, and wrote it up as pseudo code in an effort to aid our research and craft packets able to successfully get through these filters in order to activate the backdoor.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltc407bebc522ff510/6a7c7596de23158081fd1bf9/bpf-pseudocode.jpg" alt="BPFDoor source code BPF Filter Pseudocode" title="BPFDoor source code BPF Filter Pseudocode" /></p>
<p>The above capabilities allow BPFDoor to attach a filter onto any socket and allow or disallow certain types of data to come through the socket - used carefully by the adversary to invoke a series of different functions within the payload.</p>
<h2 id="historicalanalysis">Historical Analysis</h2>
<p>We wanted to see over time, between BPFDoor payloads, what, if anything, the threat actors modified. A number of samples were detonated and analyzed ranging from the uploaded source code to a <a href="https://www.virustotal.com/gui/file/599ae527f10ddb4625687748b7d3734ee51673b664f2e5d0346e64f85e185683/detection">sample</a> uploaded last month. We found that the behavior over time did not change a great deal. It maintained the same relative attack lifecycle with a few variations with the hardcoded values such as passwords, process names, and files - this is not uncommon when compared to other malware samples that look to evade detection or leverage payloads across a variety of victims.</p>
<p>We posture that the threat group would change passwords and update process or file names in an effort to improve operational security and remain hidden. It also makes sense that the general functionality of the backdoor would not change in any great way. As the saying goes “If it’s not broken, don’t fix it”. Our malware analysis and reverse engineering team compared the source code (uploaded to <a href="https://www.virustotal.com/gui/file/8b9db0bc9152628bdacc32dab01590211bee9f27d58e0f66f6a1e26aea7552a6/detection">VirusTotal</a> and found on <a href="https://pastebin.com/raw/kmmJuuQP">Pastebin</a>) to a recently uploaded sample highlighting some of the notable changes within the main function of the malware in the images below.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltf6df45798b2791fb/6a7c759851156a2de42bc6da/pastebin.jpg" alt="A side by side comparison of the main functions for the Pastebin source code and a sample uploaded to VT last month focusing on the hardcoded string values for the passwords, process names and file name" title="A side by side comparison of the main functions for the Pastebin source code and a sample uploaded to VT last month focusing on the hardcoded string values for the passwords, process names and file name" /></p>
<p>As we mentioned earlier, one recent <a href="https://www.virustotal.com/gui/file/07ecb1f2d9ffbd20a46cd36cd06b022db3cc8e45b1ecab62cd11f9ca7a26ab6d/detection">sample</a> we have come across that does not seem to exhibit some of the tactics of prior payloads has been observed - It doesn’t alter its initial name to a hardcoded value and simply executes from its placed location, otherwise, it models relatively the same behavior.</p>
<h2 id="linuxmalwaresophistication">Linux Malware Sophistication</h2>
<p>A trend we have had the privilege of observing at Elastic, is the threat landscape of Linux targeted attacks - these being focused often on cloud workloads, or systems that typically have less observational technology configured in many of the environments we see. The trend of complex, well-designed payloads is something that is often simply overlooked, and specifically in the case of BPFDoor, remained hidden for years.</p>
<p>It is important to consider these workloads a critical component of your security posture: A lack of visibility within cloud workloads will eventually lead to large gaps in security controls - adversarial groups are further growing to understand these trends, and act accordingly. Best practices state that endpoint defenses should be consistent across the fleet of systems under management, and conform to a least privilege architecture.</p>
<h2 id="detectionofbpfdoor">Detection of BPFDoor</h2>
<p>After researching this malware it became apparent as to why the backdoor remained in use and hidden for so long. If you aren’t intimately familiar with Linux process abnormalities or weren’t looking for it you would generally not detect it. Even though it takes advantage of Linux capabilities in a stealthy manner to evade detection, there are still opportunities for both behavioral and signature-based detections.</p>
<p>The first area of opportunity we witnessed while testing was the behavior we observed during the initial execution of the malware, specifically its working directory, in a shared memory location /dev/shm. This is a native temporary filesystem location in Linux that uses RAM for storage, and a binary executing from it let alone generating network connections is fairly uncommon in practice.</p>
<p>During execution, BPFDoor removes existing files from /dev/shm and copies itself there prior to initialization. A detection for this would be any execution of a binary from this directory as root (you have to be root to write to and read from this directory).</p>
<p>This was verified by detonating the binary in a VM while our Elastic Agent was installed and observing the sequence of events. You can see an image of this detection on the Kibana Security Alerts page below. This rule is publicly available as an Elastic SIEM detection rule - <a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/execution_process_started_in_shared_memory_directory.toml">Binary Executed from Shared Memory Directory</a>:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt57b853d4f7062a4d/6a7c759cc33f4f0ac8d54753/Elastic_Alert_in_Kibana_-_Binary_Executed_from_Shared_Memory_Directory.png" alt="Elastic Alert in Kibana - Binary Executed from Shared Memory Directory" title="Elastic Alert in Kibana - Binary Executed from Shared Memory Directory" /></p>
<p>The second opportunity we noticed, for detection, was a specific PID file being created in /var/run. We noticed the dropped PID file was completely empty while doing a quick query via the <a href="https://docs.elastic.co/en/integrations/osquery_manager">Osquery integration</a> to the /var/run directory. While this is not inherently malicious, it is unusual for the file size of a PID to be 0 or above 10 bytes and thus we created an additional rule centered around detecting this unusual behavior.</p>
<p>Our <a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/execution_abnormal_process_id_file_created.toml">Abnormal Process ID or Lock File Created</a> rule identifies the creation of a PID file in the main directory of /var/run with no subdirectory, ignoring common PID files to be expected:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt48c60446fc9f758d/6a7c759e227b1c20d65924c3/abnormal-process.png" alt="Elastic Alert in Kibana - Abnormal Process ID or Lock File Created" title="Elastic Alert in Kibana - Abnormal Process ID or Lock File Created" /></p>
<p>The third area we wanted to look at was the network connections tied to two of the three capabilities (reverse shell and bind shell) the backdoor possesses. We wanted to see if there were any suspicious network connections tied to process or user abnormalities we could sequence together based off of the way BPFDoor handles establishing a reverse or bind shell.</p>
<p>The reverse shell was the first capability focused on. Taking a deep look at the process tree in and around the reverse shell establishment allowed us to key in on what would be considered a strange or even abnormal sequence of events leading to and involving an outbound network connection.</p>
<p>We developed a hunt rule sequence that identifies an outbound network connection attempt followed by a session id change as the root user by the same process entity. The reason we developed these network focused hunt rules is due to possible performance issues caused if running these continually.</p>
<p>The bind shell was the last capability we honed in on. Identifying an abnormal sequence of events surrounding the bind shell connection was difficult due to the way it forks then accepts the connection and kills the accepting process post established connection. Therefore we had to focus on the sequence of events within the process entity id directly involving the network connection and subsequent killing of the accepting process.</p>
<p>After developing the 2 detection rules along with the 2 hunt rules listed below and in addition to the 6 YARA signatures deployed we were able to detect BPFDoor in a myriad of different ways and within different stages of its life cycle. As stated earlier though, if you detect this malware in your environment it should be the least of your concerns given the threat actor will most likely have already successfully compromised your network via other means.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltd21cb607ec0121a3/6a7c75a1c33f4f368ed5475f/complete-bpfdoor.png" alt="Elastic Detection Summary of complete BPFDoor attack lifecycle" title="Elastic Detection Summary of complete BPFDoor attack lifecycle" /></p>
<h3 id="existingdetectionrules">Existing Detection Rules</h3>
<p>The following Elastic Detection Rules will identify BPFDoor activity:</p>
<ul>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/execution_abnormal_process_id_file_created.toml">Abnormal Process ID or Lock File Created</a></li>
<li><a href="https://github.com/elastic/detection-rules/blob/main/rules/linux/execution_process_started_in_shared_memory_directory.toml">Binary Executed from Shared Memory Directory</a></li>
</ul>
<h3 id="huntingqueries">Hunting Queries</h3>
<p>This EQL rule can be used to successfully identify BPFDoor reverse shell connections having been established within your environment:</p>
<p><strong>EQL BPFDoor reverse shell hunt query</strong></p>
<pre><code>sequence by process.entity_id with maxspan=1m
[network where event.type == "start" and event.action == "connection_attempted" and user.id == "0" and not process.executable : ("/bin/ssh", "/sbin/ssh", "/usr/lib/systemd/systemd")]
[process where event.action == "session_id_change" and user.id == "0"]
</code></pre>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt35ee79454b81f394/6a7c75a477b03428753f93bf/attempt-by-root.png" alt="Elastic Alert in Kibana - Suspicious Network Connection Attempt by Root" title="Elastic Alert in Kibana - Suspicious Network Connection Attempt by Root" /></p>
<p>The hunt rule we created here identifies a sequence of events beginning with a session id change, followed by a network connection accepted, in correlation with ptmx file creation and a deletion of the process responsible for accepting the network connection. This EQL rule can be used to successfully identify BPFDoor bind shell connections within your environment:</p>
<p><strong>EQL BPFDoor bind shell hunt query</strong></p>
<pre><code>sequence by process.entity_id with maxspan=1m
[process where event.type == "change" and event.action == "session_id_change" and user.id == 0 and not process.executable : ("/bin/ssh", "/sbin/ssh", "/usr/lib/systemd/systemd")]
[network where event.type == "start" and event.action == "connection_accepted" and user.id == 0]
[file where event.action == "creation" and user.id == 0 and file.path == "/dev/ptmx"]
[process where event.action == "end" and user.id == 0 and not process.executable : ("/bin/ssh", "/sbin/ssh", "/usr/lib/systemd/systemd")]
</code></pre>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt67322006be6d16d7/6a7c75a777b03490663f93c7/Elastic_Alert_in_Kibana_-_Suspicious_Network_Connection_Accept_by_Root.png" alt="Elastic Alert in Kibana - Suspicious Network Connection Accept by Root" title="Elastic Alert in Kibana - Suspicious Network Connection Accept by Root" /></p>
<h3 id="yararules">YARA Rules</h3>
<p>In addition to behavioral detection rules in the Elastic Endpoint, we are releasing a set of BPFDoor Yara signatures for the community.</p>
<p><strong>BPFDoor YARA rule</strong></p>
<pre><code>rule Linux_Trojan_BPFDoor_1 {

    meta:
        Author = "Elastic Security"
        creation_date = "2022-05-10"
        last_modified = "2022-05-10"
        os = "Linux"
        arch = "x86"
        category_type = "Trojan"
        family = "BPFDoor"
        threat_name = "Linux.Trojan.BPFDoor"
        description = "Detects BPFDoor malware."
        reference_sample = "144526d30ae747982079d5d340d1ff116a7963aba2e3ed589e7ebc297ba0c1b3"
    strings:
        $a1 = "hald-addon-acpi: listening on acpi kernel interface /proc/acpi/event" ascii fullword
        $a2 = "/sbin/iptables -t nat -D PREROUTING -p tcp -s %s --dport %d -j REDIRECT --to-ports %d" ascii fullword
        $a3 = "avahi-daemon: chroot helper" ascii fullword
        $a4 = "/sbin/mingetty /dev/tty6" ascii fullword
        $a5 = "ttcompat" ascii fullword
    condition:
        all of them
}

rule Linux_Trojan_BPFDoor_2 {
    meta:
        Author = "Elastic Security"
        creation_date = "2022-05-10"
        last_modified = "2022-05-10"
        os = "Linux"
        arch = "x86"
        category_type = "Trojan"
        family = "BPFDoor"
        threat_name = "Linux.Trojan.BPFDoor"
        description = "Detects BPFDoor malware."
        reference_sample = "3a1b174f0c19c28f71e1babde01982c56d38d3672ea14d47c35ae3062e49b155"
    strings:
        $a1 = "hald-addon-acpi: listening on acpi kernel interface /proc/acpi/event" ascii fullword
        $a2 = "/sbin/mingetty /dev/tty7" ascii fullword
        $a3 = "pickup -l -t fifo -u" ascii fullword
        $a4 = "kdmtmpflush" ascii fullword
        $a5 = "avahi-daemon: chroot helper" ascii fullword
        $a6 = "/sbin/auditd -n" ascii fullword
    condition:
        all of them
}

rule Linux_Trojan_BPFDoor_3 {
    meta:
        Author = "Elastic Security"
        creation_date = "2022-05-10"
        last_modified = "2022-05-10"
        os = "Linux"
        arch = "x86"
        category_type = "Trojan"
        family = "BPFDoor"
        threat_name = "Linux.Trojan.BPFDoor"
        description = "Detects BPFDoor malware."
        reference_sample = "591198c234416c6ccbcea6967963ca2ca0f17050be7eed1602198308d9127c78"
    strings:
        $a1 = "[-] Spawn shell failed." ascii fullword
        $a2 = "[+] Packet Successfuly Sending %d Size." ascii fullword
        $a3 = "[+] Monitor packet send." ascii fullword
        $a4 = "[+] Using port %d"
        $a5 = "decrypt_ctx" ascii fullword
        $a6 = "getshell" ascii fullword
        $a7 = "getpassw" ascii fullword
        $a8 = "export %s=%s" ascii fullword
    condition:
        all of them
}

rule Linux_Trojan_BPFDoor_4 {
    meta:
        Author = "Elastic Security"
        creation_date = "2022-05-10"
        last_modified = "2022-05-10"
        os = "Linux"
        arch = "x86"
        category_type = "Trojan"
        family = "BPFDoor"
        threat_name = "Linux.Trojan.BPFDoor"
        description = "Detects BPFDoor malware."
        reference_sample = "591198c234416c6ccbcea6967963ca2ca0f17050be7eed1602198308d9127c78"
    strings:
        $a1 = { 45 D8 0F B6 10 0F B6 45 FF 48 03 45 F0 0F B6 00 8D 04 02 00 }
    condition:
        all of them
}

rule Linux_Trojan_BPFDoor_5 {
    meta:
        Author = "Elastic Security"
        creation_date = "2022-05-10"
        last_modified = "2022-05-10"
        os = "Linux"
        arch = "x86"
        category_type = "Trojan"
        family = "BPFDoor"
        threat_name = "Linux.Trojan.BPFDoor"
        description = "Detects BPFDoor malware."
        reference_sample = "76bf736b25d5c9aaf6a84edd4e615796fffc338a893b49c120c0b4941ce37925"
    strings:
        $a1 = "getshell" ascii fullword
        $a2 = "/sbin/agetty --noclear tty1 linux" ascii fullword
        $a3 = "packet_loop" ascii fullword
        $a4 = "godpid" ascii fullword
        $a5 = "ttcompat" ascii fullword
        $a6 = "decrypt_ctx" ascii fullword
        $a7 = "rc4_init" ascii fullword
        $b1 = { D0 48 89 45 F8 48 8B 45 F8 0F B6 40 0C C0 E8 04 0F B6 C0 C1 }
    condition:
        all of ($a*) or 1 of ($b*)
}

rule Linux_Trojan_BPFDoor_6 {
    meta:
        Author = "Elastic Security"
        creation_date = "2022-05-10"
        last_modified = "2022-05-10"
        os = "Linux"
        arch = "x86"
        category_type = "Trojan"
        family = "BPFDoor"
        threat_name = "Linux.Trojan.BPFDoor"
        description = "Detects BPFDoor malware."
        reference_sample = "dc8346bf443b7b453f062740d8ae8d8d7ce879672810f4296158f90359dcae3a"
    strings:
        $a1 = "getpassw" ascii fullword
        $a2 = "(udp[8:2]=0x7255) or (icmp[8:2]=0x7255) or (tcp[((tcp[12]&amp;0xf0)&gt;&gt;2):2]=0x5293)" ascii fullword
        $a3 = "/var/run/haldrund.pid" ascii fullword
        $a4 = "Couldn't install filter %s: %s" ascii fullword
        $a5 = "godpid" ascii fullword
    condition:
        all of them
}
</code></pre>
<h2 id="interactingwithbpfdoor">Interacting with BPFDoor</h2>
<p>The Elastic Security Team has released several tools that can aid in further research regarding BPFDoor to include a network scanner used to identify infected hosts, a BPFDoor malware configuration extractor, and a BPFDoor client binary that can be used to actively interact with a sample.</p>
<h3 id="bpfdoorscanner">BPFDoor Scanner</h3>
<p>The Elastic Security Team <a href="https://www.elastic.co/security-labs/bpfdoor-scanner">has released</a> a Python script that can identify if you have BPFDoor infected hosts.</p>
<p>The scanner sends a packet to a defined IP address using the default target port (68/UDP)and default interface. It listens to return traffic on port 53/UDP.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt4ea780e46561cb69/6a7c75aa96b5a6535a875399/BPFDoor_scanner_tool.jpg" alt="BPFDoor scanner tool" title="BPFDoor scanner tool" /></p>
<h3 id="bpfdoorconfigurationextractor">BPFDoor Configuration Extractor</h3>
<p>This tool will allow you to extract configurations from any BPFDoor malware you may have collected. This will allow you to develop additional signatures and further analysis of the malware as well as your environment.</p>
<p>The BPFDoor configuration extractor can be downloaded <a href="https://www.elastic.co/security-labs/bpfdoor-configuration-extractor">here</a>.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltee7e9cd6a3489103/6a7c75ad9f525100b2663e7e/BPFDoor_configuration_extractor.jpg" alt="BPFDoor configuration extractor" title="BPFDoor configuration extractor" /></p>
<h3 id="bpfdoorclientpoc">BPFDoor Client POC</h3>
<p>Quickly after beginning our research into this malware we realized we would also need to actively interact with BPFDoor in order to observe the full extent of the capabilities that it possesses and monitor what these capabilities would look like from a host and SIEM level.</p>
<p>In order to do this, we had to break down the BPF filters in the BPFDoor source code so we could craft packets for the different protocols. To do this, we used <a href="https://scapy.net/">Scapy</a>, a packet manipulation program, to ensure we could pass the filters for the purpose of activating the backdoor. Once we ensured we could pass the filters, Rhys Rustad-Elliott, an engineer at Elastic built a BPFDoor client that accepts a password, IP address, and port allowing you to connect to a BPFDoor sample and interact if you possess the sample’s hardcoded passwords.</p>
<p>Depending on the password or lack of password provided, BPFDoor will behave exactly the same way it would in the wild. You can invoke a reverse shell, establish a bind shell, or connect to it with no supplied password to receive a ping-back confirming its installation.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt0049a313558a81d2/6a7c75b0448e4ea7365ba980/A_preview_of_the_BPFDoor_Client_developed_by_Elastic_Security_to_assist_in_research.jpg" alt="A preview of the BPFDoor Client developed by Elastic Security to assist in research" title="A preview of the BPFDoor Client developed by Elastic Security to assist in research" /></p>
<p>Researchers looking to use BPFDoor can <a href="mailto:threat-notification@elastic.co">reach out to Elastic Security</a> for access to the BPFDoor client POC. Please note that these tools will be shared at our discretion with those in the trusted security community looking to improve the detection of this vulnerability.</p>
<h2 id="impact">Impact</h2>
<p>The following MITRE ATT&amp;CK Tactic, Techniques, and Sub-techniques have been observed with the BPFDoor malware.</p>
<h3 id="tactics">Tactics</h3>
<p>Tactics represent the “why” of an ATT&amp;CK technique or sub-technique. It is the adversary’s tactical goal: the reason for performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/tactics/TA0002/">Execution</a></li>
</ul>
<h3 id="techniquessubtechniques">Techniques (sub-techniques)</h3>
<p>Techniques (and sub-techniques) represent ‘how’ an adversary achieves a tactical goal by performing an action.</p>
<ul>
<li><a href="https://attack.mitre.org/techniques/T1106/">Native API</a></li>
<li><a href="https://attack.mitre.org/techniques/T1133/">External Remote Services</a></li>
<li><a href="https://attack.mitre.org/techniques/T1564/">Hide Artifacts</a></li>
<li><a href="https://attack.mitre.org/techniques/T1070/">Indicator Removal on Host</a></li>
<li><a href="https://attack.mitre.org/techniques/T1095/">Non-Application Layer Protocol</a></li>
<li><a href="https://attack.mitre.org/techniques/T1059/004">Command and Scripting Interpreter: Unix Shell</a></li>
<li><a href="https://attack.mitre.org/techniques/T1548/001/">Abuse Elevation Control Mechanism: Setuid and Setgid</a></li>
</ul>
<h2 id="sourcepseudocode">Source Pseudocode</h2>
<p>To clearly articulate the details of this malware, we’ve created <a href="https://www.elastic.co/pdf/bpfdoor_pseudocode.pdf">two diagrams</a> that outline the specific pseudocode for BPFDoor based on the source code uploaded to VT and found on Pastebin. While this contains a lot of detail, it is simple to understand if researchers choose to further this research.</p>
<h2 id="summary">Summary</h2>
<p>While threat groups continue to increase in maturity, we expect this kind of mature, well designed and hidden threat will continue to be found within Linux environments. These kinds of findings reiterate the importance of comprehensive security controls across the entirety of a fleet, rather than simply focusing on user endpoints.</p>
<p>BPFDoor demonstrates a perfect example of how important monitoring workloads within Linux environments can be. Payloads such as this are near-on impossible to observe and detect without sufficient controls, and should be considered a moving trend within the general adversarial landscape.</p>
<h2 id="observables">Observables</h2>
<p>| Observable                                                       | Type         | Reference            | Note                             |
| ---------------------------------------------------------------- | ------------ | -------------------- | -------------------------------- |
| /dev/shm/kdmtmpflush                                             | process name | BPFDoor process name | Observed process name of BPFDoor |
| /var/run/haldrund.pid                                            | file name    | BPFDoor file name    | Observed BPFDoor PID file        |
| /var/run/kdevrund.pid                                            | file name    | BPFDoor file name    | Observed BPFDoor PID file        |
| /var/run/xinetd.lock                                             | file name    | BPFDoor file name    | Observed BPFDoor lock file       |
| 74ef6cc38f5a1a80148752b63c117e6846984debd2af806c65887195a8eccc56 | SHA-256      | BPFDoor malware      |                                  |
| 07ecb1f2d9ffbd20a46cd36cd06b022db3cc8e45b1ecab62cd11f9ca7a26ab6d | SHA-256      | BPFDoor malware      |                                  |
| 76bf736b25d5c9aaf6a84edd4e615796fffc338a893b49c120c0b4941ce37925 | SHA-256      | BPFDoor malware      |                                  |
| 93f4262fce8c6b4f8e239c35a0679fbbbb722141b95a5f2af53a2bcafe4edd1c | SHA-256      | BPFDoor malware      |                                  |
| 96e906128095dead57fdc9ce8688bb889166b67c9a1b8fdb93d7cff7f3836bb9 | SHA-256      | BPFDoor malware      |                                  |
| 599ae527f10ddb4625687748b7d3734ee51673b664f2e5d0346e64f85e185683 | SHA-256      | BPFDoor malware      |                                  |
| 2e0aa3da45a0360d051359e1a038beff8551b957698f21756cfc6ed5539e4bdb | SHA-256      | BPFDoor malware      |                                  |
| f47de978da1dbfc5e0f195745e3368d3ceef034e964817c66ba01396a1953d72 | SHA-256      | BPFDoor malware      |                                  |
| fd1b20ee5bd429046d3c04e9c675c41e9095bea70e0329bd32d7edd17ebaf68a | SHA-256      | BPFDoor malware      |                                  |
| 5faab159397964e630c4156f8852bcc6ee46df1cdd8be2a8d3f3d8e5980f3bb3 | SHA-256      | BPFDoor malware      |                                  |
| f8a5e735d6e79eb587954a371515a82a15883cf2eda9d7ddb8938b86e714ea27 | SHA-256      | BPFDoor malware      |                                  |
| 5b2a079690efb5f4e0944353dd883303ffd6bab4aad1f0c88b49a76ddcb28ee9 | SHA-256      | BPFDoor malware      |                                  |
| 97a546c7d08ad34dfab74c9c8a96986c54768c592a8dae521ddcf612a84fb8cc | SHA-256      | BPFDoor malware      |                                  |
| c80bd1c4a796b4d3944a097e96f384c85687daeedcdcf05cc885c8c9b279b09c | SHA-256      | BPFDoor malware      |                                  |
| 4c5cf8f977fc7c368a8e095700a44be36c8332462c0b1e41bff03238b2bf2a2d | SHA-256      | BPFDoor malware      |                                  |</p>
<h2 id="references">References</h2>
<ul>
<li>https://doublepulsar.com/bpfdoor-an-active-chinese-global-surveillance-tool-54b078f1a896</li>
<li>https://www.pwc.com/gx/en/issues/cybersecurity/cyber-threat-intelligence/cyber-year-in-retrospect/yir-cyber-threats-report-download.pdf</li>
<li>https://www.pangulab.cn/en/post/the_bvp47_a_top-tier_backdoor_of_us_nsa_equation_group</li>
</ul>
<h2 id="artifacts">Artifacts</h2>
<p>Artifacts are also available for <a href="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt294e7cd5c4b8a050/628e88d93b9b8554904a703c/bpfdoor-indicators.zip">download</a> in both ECS and STIX format in a combined zip bundle.</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/a-peek-behind-the-bpfdoor</link>
    <guid isPermaLink="false">a-peek-behind-the-bpfdoor</guid>
    <category><![CDATA[Malware Analysis]]></category>
    <dc:creator><![CDATA[Jake King,Colson Wilhoit]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blteaa6bbb157abca2b/6a7c75b22f00b2eb12ef8c3b/blog-security-detection-720x420.png" length="0" type="image/png"/>
    <pubDate>Wed, 13 Jul 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Okta and LAPSUS$: What you need to know]]></title>
    <description><![CDATA[The latest organization under the microscope of the LAPSUS$ group is Okta. Threat hunt for the recent breach targeting Okta users using these simple steps in Elastic]]></description>
    <content:encoded><![CDATA[<blockquote>
  <p>Readers Note:</p>
  <p>Elastic has undergone a series of investigations internally and has not yet identified malicious actions that may pertain to this event. Okta has also released two statements relating to the incident in question that may be reviewed <a href="https://www.okta.com/blog/2022/03/updated-okta-statement-on-lapsus/"><u>here</u></a> and <a href="https://www.okta.com/blog/2022/03/okta-official-statement-on-lapsus-claims/"><u>here</u></a>.</p>
</blockquote>
<h2 id="thelapsusdgroup">The LAPSUS$ group</h2>
<p>Financially motivated adversary groups executing ransomware attacks have rightfully gotten our attention in recent years. Similar to Lulzec, there’s a new group catching attention with different motivations, targeting larger organizations.</p>
<p>The LAPSUS$ group emerged onto the scene a number of months ago, targeting high-profile organizations such as Nvidia, Samsung, and Ubisoft — making various demands that in some cases, resulted in either data dumps or screenshots of internal systems shared via the group’s Telegram account. These were sometimes determined by user-voted polls within the group, suggesting that this is only the beginning of a series of attacks the group is undertaking more frequently as they gain press coverage.</p>
<p>Groups of this nature focus on data theft and extortion via means of social engineering — commonly, targeted spear phishing campaigns.</p>
<p>The latest organization under the microscope of the LAPSUS$ group is Okta, the identity provider for thousands of companies of all sizes. Surprisingly, LAPSUS$ chose to note in their release of information that their targeting of Okta was not for access to Okta’s systems, but rather that of their customers:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1054e991d4e2fd8f/6a7c8f7851156a01972bcb63/1.jpg" alt="A screenshot of the Telegram account that LAPSUS$ has coordinated, showing access to internal communication, administrative and customer tools, as well as customer accounts" title="A screenshot of the Telegram account that LAPSUS$ has coordinated, showing access to internal communication, administrative and customer tools, as well as customer accounts" /></p>
<h2 id="thelatesttargetokta">The latest target: Okta</h2>
<p>After LAPSUS$ sent a notification last night to the Telegram account, Okta’s CEO responded with a series of Tweets and an <a href="https://sec.okta.com/articles/2022/03/official-okta-statement-lapsus-claims"><u>official statement</u></a> regarding the suspected compromise, stating that it occurred in January 2022, similar to dates visible in the screenshots from Telegram post:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1e3fd515e3557898/6a7c8f7ac33f4f6c83d54cca/2.jpg" alt="Todd McKinnon confirmed on Twitter some details surrounding the attack on Okta infrastructure via a subprocessor" title="Todd McKinnon confirmed on Twitter some details surrounding the attack on Okta infrastructure via a subprocessor" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt6d6b71e082d71159/6a7c8f7de3a219c8c1999999/3.jpg" alt="An official statement by David Bradbury, the CSO at Okta, posted March 22" title="An official statement by David Bradbury, the CSO at Okta, posted March 22" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltf19cbbcdded97e4f/6a7c8f807cfd7a6676314f73/4.jpg" alt="The updated statement provided by Okta, suggesting that no immediate action by customers is needed" title="The updated statement provided by Okta, suggesting that no immediate action by customers is needed" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt325ef2711193faa9/6a7c8f8396b5a6d4fd8757ec/5.png" alt="After this publication, LAPSUS$ published this response" title="After this publication, LAPSUS$ published this response" /></p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltf665daf65d2373eb/6a7c8f864c4bfb2d55cc7afb/Okta-CISO-Update.jpg" alt="Further updates provided by the CSO at Okta at 6.31 PM" title="Further updates provided by the CSO at Okta at 6.31 PM" /></p>
<p>While the initial notice provided some insights into potential scope and timing of the incident, many customers are still interested in identifying the scope of the access, and how to assess if there is any local impact within their organization.</p>
<p>The updated notice released by Okta suggested that access was limited to a specific end-user system with no ability to create or delete users or download customer information. However, it did have the ability to reset passwords and MFA tokens for users, while not obtaining access to them. Responses from LAPSUS$ are included for context, and suggest more may need to be investigated.</p>
<p>In the third update notification shared by David Bradbury at Okta, a correction was made indicating that a small (2.5% of customer base) were potentially impacted by the incident. Further details will be shared via a Webinar scheduled at 8AM, PDT Wednesday, March 23rd.. A link to sign up for the webinar is located within the <a href="https://www.okta.com/blog/2022/03/updated-okta-statement-on-lapsus/">aforementioned update post.</a></p>
<p>As more information pertaining to the breach is released by either LAPSUS$ or Okta, we will maintain the accuracy of information shared within this post.</p>
<h2 id="threathuntingoktalogsinelastic">Threat hunting Okta logs in Elastic</h2>
<p>The good news is that customers of Okta do have access to relatively comprehensive log information regarding activity within their account. Okta has configured a default 90 day retention window for system events. Okta <a href="https://www.okta.com/blog/2022/03/updated-okta-statement-on-lapsus/"><u>released an updated statement</u></a> stating customers do not have to respond to the incident immediately, but for those wishing to investigate further, the following threat hunting information is still valuable.</p>
<p>The process to get started with ingesting Okta logs is simple — a prebuilt integration for Okta Log ingestion is available as a one-click module configurable within Kibana:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1451806feeb4067b/6a7c8f8973d9bd2123297e5c/6.jpg" alt="Integrations for Okta are available via One-click installation within the Elastic webapp" title="Integrations for Okta are available via One-click installation within the Elastic webapp" /></p>
<p>Alternatively, the <a href="https://www.elastic.co/guide/en/beats/filebeat/master/filebeat-module-okta.html#filebeat-module-okta"><u>Okta Filebeat Module</u></a> can easily be added to Elastic to provide insights into previous account activity.</p>
<p>Configuring the Okta Module is simple, providing you tweak the initial_interval value to 90 days:</p>
<pre><code>~ ~ ~
- module: okta
  system:
    var.url: https://yourOktaDomain/api/v1/logs
    var.api_key: XXXX-XXXX...XXXX-XXXX'
    var.initial_interval: 90d # will fetch events starting 90 days ago.
~ ~ ~
</code></pre>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltbc5d9a24b752e5a3/6a7c8f8cda3d0542ab633fbd/7.jpg" alt="A prebuilt dashboard that is shipped alongside the Okta Module for Filebeat" title="A prebuilt dashboard that is shipped alongside the Okta Module for Filebeat" /></p>
<p>Once events are ingested, a number of Lucene queries are easily leveraged for early/initial signs of compromise. While these events are not a comprehensive set of queries, they should provide ample detail for any security team to investigate potential suspicious activity:</p>
<p>MFA device reset via console for any user:</p>
<h6 id="eventmoduleoktaandeventactionusermfafactorreset_all">event.module:"okta" AND event.action:"user.mfa.factor.reset_all"</h6>
<p>User Account email update records updated to a new value:</p>
<h6 id="eventmoduleoktaandeventactionuseraccountupdate_primary_email">event.module:"okta" AND event.action:"user.account.update_primary_email"</h6>
<p>User Privilege granted for an account within your Okta organization:</p>
<h6 id="eventmoduleoktaandeventactionuseraccountprivilegegrant">event.module:"okta" AND event.action:"user.account.privilege.grant"</h6>
<p>Okta Administrative staff have a series of privileges that allow for user-impersonation via their management service. Logs pertaining to this action should be inspected:</p>
<h6 id="eventmoduleoktaandeventactionusersessionimpersonationgrantoreventactionusersessionimpersonationinitiate">event.module:okta AND (event.action:user.session.impersonation.grant OR event.action:user.session.impersonation.initiate)</h6>
<p>There are many other ways to look for suspicious activity in your Okta data. In addition to these queries, Elastic provides a large set of prebuilt detections for suspicious Okta activity used by other adversarial groups in our <a href="https://github.com/elastic/detection-rules/tree/main/rules/integrations/okta"><u>open detection-rules repo</u></a>. This will be useful in generating alerts as Okta logs are coming into Elastic. You can use the query logic in those rules to drive other hunts beyond the four we mention above as well.</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blteedd71741140ee8e/6a7c8f8e2f00b279c8ef90d9/8.png" alt="A snapshot of the current rules pertaining to Okta ingested data within Elastic Security" title="A snapshot of the current rules pertaining to Okta ingested data within Elastic Security" /></p>
<blockquote>
  <p><em>Not familiar with what suspicious Okta data looks like?</em></p>
  <p><em>Read the</em> <a href="https://www.elastic.co/blog/testing-okta-visibility-and-detection-dorothy"><u><em>blog</em></u></a> <em>from December 2020 where we discussed the subject and released an open adversary simulation tool called</em> <a href="https://github.com/elastic/dorothy"><u><em>Dorothy</em></u></a> <em>to help security teams test</em> <em>visibility, monitoring, and detection capabilities for Okta logs.</em></p>
  <p><em>We expect many security teams will give SSO logs extra attention in light of this incident, and this tool may help teams get up to speed on the subject.</em></p>
</blockquote>
<h2 id="earliereventsmicrosoftnvidiasamsungubisoft">Earlier events: Microsoft, Nvidia, Samsung, Ubisoft</h2>
<p>As previously stated, the LAPSUS$ group has been on a serious compromise train over the past few months, targeting a number of high-profile targets. Numerous details have been shared across a number of different media outlets, and a common theme of social engineering and internal access has been observed across many of the attacks:</p>
<ul>
<li><a href="https://www.bleepingcomputer.com/news/microsoft/lapsus-hackers-leak-37gb-of-microsofts-alleged-source-code/"><u>37GB of Source Code was leaked from Microsoft</u></a> in an earlier dump identified this week</li>
<li><a href="https://www.zdnet.com/article/ubisoft-reveals-security-incident-forcing-company-wide-password-refresh/#ftag=RSSbaffb68"><u>Ubisoft </u></a>- Company-wide password reset after unusual activity identified on systems located</li>
<li><a href="https://www.zdnet.com/article/ubisoft-reveals-security-incident-forcing-company-wide-password-refresh/#ftag=RSSbaffb68"><u>Nvidia issues</u></a> notice after internal systems indicate data compromise</li>
<li><a href="https://www.bloomberg.com/news/articles/2022-03-07/samsung-says-hackers-breached-company-data-galaxy-source-code"><u>Samsung confirms source-code</u></a> compromise via the LAPSUS$ group</li>
</ul>
<p>As further information is uncovered, and mechanisms for detection improve, Elastic Security will continue to provide further updates to this and provide subsequent posts relating to detections.</p>
<p>If you haven’t checked out the Elastic Security solution, take a look at our <a href="https://www.elastic.co/training/free#quick-starts"><u>Quick Start guides</u></a> (bite-sized training videos to get you started quickly) or our <a href="https://www.elastic.co/training/free#fundamentals"><u>free fundamentals training courses</u></a>. You can always get started with a <a href="https://cloud.elastic.co/registration"><u>free 14-day trial of Elastic Cloud</u></a>. Or <a href="https://www.elastic.co/downloads/"><u>download</u></a> the self-managed version of the Elastic Stack for free.</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/okta-and-lapsus-what-you-need-to-know</link>
    <guid isPermaLink="false">okta-and-lapsus-what-you-need-to-know</guid>
    <category><![CDATA[Threat Intelligence]]></category>
    <dc:creator><![CDATA[Jake King]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blte271fd2677f90cb5/6a7c8f92bd21987ccc7524bf/blog-security-detection-720x420.png" length="0" type="image/png"/>
    <pubDate>Thu, 02 Jun 2022 00:00:00 GMT</pubDate>
  </item>
  <item>
    <title><![CDATA[Nimbuspwn: Leveraging vulnerabilities to exploit Linux via Privilege Escalation]]></title>
    <description><![CDATA[Microsoft 365 Defender team released a post detailing several identified vulnerabilities. These vulnerabilities allow adversarial groups to escalate privileges on Linux systems, allowing for deployment of payloads, ransomware, or other attacks.]]></description>
    <content:encoded><![CDATA[<h2 id="summary">Summary</h2>
<p>The Microsoft 365 Defender team released a <a href="https://www.microsoft.com/security/blog/2022/04/26/microsoft-finds-new-elevation-of-privilege-linux-vulnerability-nimbuspwn/">post</a> detailing several identified vulnerabilities. These vulnerabilities allow adversarial groups to easily escalate privileges on Linux systems, allowing for deployment of payloads, ransomware, or other malicious actions. Collectively known as Nimbuspwn, these vulnerabilities include a series of security issues within networkd-dispatcher, specifically directory traversal, symlink race, and <a href="https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use">TOCTU</a> race conditions.</p>
<p>Details are covered in their <a href="https://www.microsoft.com/security/blog/2022/04/26/microsoft-finds-new-elevation-of-privilege-linux-vulnerability-nimbuspwn/">detailed post</a>, and further information will be available within the two requested CVEs: <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29799">CVE-2022-29799</a> and <a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-29800">CVE-2022-29800</a>. At the time of publication these CVE IDs are still reserved.</p>
<p>While this class of vulnerability requires local shell access to exploit, it should be considered important for those that currently leverage networkd-dispatcher within their Linux workload environments. A patch by the creator has been implemented to resolve the issue under the guidance of Microsoft, and should be implemented by those that have systems impacted by this vulnerability.</p>
<h2 id="detectingnimbuspwnactivitywithinelastic">Detecting Nimbuspwn activity within Elastic</h2>
<p>Our research team at Elastic has focused on building out a series of initial detections that leverage Elastic Security, alongside OSquery.</p>
<p>Firstly, those wishing to understand what systems in their environment may be impacted need to determine systems that have networkd-dispatcher installed:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt7320d42226a9b0fa/6a7c8f5b7cfd7a6c52314f5f/elastic-blog-nimbuspwn.png" alt="OSquery search" title="OSquery search" /></p>
<p>Writing an OSquery search that returns the installed version of Networkd-Dispatcher is relatively trivial, and understanding the systems that may be at risk are returned at a glance. In the screenshot above, we can see an example host listed with a version number of 2.1-2, specific to Ubuntu. The version installed within your environment may be slightly different depending on the distribution. An example query has been provided below.</p>
<pre><code>Select version from deb_packages rpm_packages where name=’networkd-dispatcher’;
</code></pre>
<p>We leveraged the initial research paper from Microsoft, determining a specific malicious pattern adversaries may use to exploit this vulnerability:</p>
<p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/bltfd0d736cc374452a/6a7c8f5e80ee38223b60d351/elastic-blog-nimbuspwn-2.jpg" alt="EQL Detection Rule to detect suspicious child processes of Networkd-Dispatcher" title="EQL Detection Rule to detect suspicious child processes of Networkd-Dispatcher" /></p>
<p>The Elastic Security team wrote an EQL Detection Rule to detect suspicious child processes of Networkd-Dispatcher. Any child-process detected by this rule should be considered highly suspicious given the circumstances, and should be investigated. Further analysis will likely be provided as our security community builds more POCs for this exploit. An example query appears below:</p>
<pre><code>process where event.type == "start" and process.parent.name : "networkd-dispatcher" and not process.name in ("networkctl", "networkd-dispatcher")
</code></pre>
<p>Given the nature of this exploit, we expect far greater diversity in POCs over the coming weeks. You can expect updates in the form of further signatures or rules accordingly.</p>
<h2 id="defensiverecommendations">Defensive recommendations</h2>
<p>Organizations impacted by vulnerabilities discovered by the Microsoft team should follow guidance provided by Microsoft in their initial post, and update their instances of networkd-dispatcher. Elastic recommends investigating hosts that are found to be running vulnerable versions of network-dispatcher with the aforementioned detections for any sign of compromise.</p>
<p>Not already using Elastic Security? You can always get started with a <a href="https://cloud.elastic.co/registration">free 14-day trial</a> of Elastic Cloud.</p>]]></content:encoded>
    <link>https://www.elastic.co/security-labs/threat-command/nimbuspwn-leveraging-vulnerabilities-to-exploit-linux-via-privilege-escalation</link>
    <guid isPermaLink="false">nimbuspwn-leveraging-vulnerabilities-to-exploit-linux-via-privilege-escalation</guid>
    <category><![CDATA[Platform Internals]]></category>
    <dc:creator><![CDATA[Jake King]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt62552ee9d10cd5f4/6a7c8f61de2315bb9dfd2064/thumb-report-threat-hunting.png" length="0" type="image/png"/>
    <pubDate>Thu, 02 Jun 2022 00:00:00 GMT</pubDate>
  </item>
  </channel>
</rss>