<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Elastic Security Labs - Articles by Sergey Polzunov</title>
        <link>https://www.elastic.co/security-labs</link>
        <description>Trusted security news &amp; research from the team at Elastic.</description>
        <lastBuildDate>Mon, 13 Apr 2026 18:54:47 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>Elastic Security Labs - Articles by Sergey Polzunov</title>
            <url>https://www.elastic.co/security-labs/assets/security-labs-thumbnail.png</url>
            <link>https://www.elastic.co/security-labs</link>
        </image>
        <copyright>© 2026. elasticsearch B.V. All Rights Reserved</copyright>
        <item>
            <title><![CDATA[Into The Weeds: How We Run Detonate]]></title>
            <link>https://www.elastic.co/security-labs/into-the-weeds-how-we-run-detonate</link>
            <guid>into-the-weeds-how-we-run-detonate</guid>
            <pubDate>Tue, 13 Jun 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Explore the technical implementation of the Detonate system, including sandbox creation, the supporting technology, telemetry collection, and how to blow stuff up.]]></description>
            <content:encoded><![CDATA[<h2>Preamble</h2>
<p>In our <a href="https://www.elastic.co/security-labs/click-click-boom-automating-protections-testing-with-detonate">first post</a> in our Detonate series, we introduced the Detonate system and what we use it for at Elastic. We also discussed the benefits it provides our team when assessing the performance of our security artifacts.</p>
<p>In this publication, we will break down how Detonate works &amp; dive deeper into the technical implementation. This includes how we’re able to create this sandboxed environment in practice, the technology that supports the overall pipeline, and how we submit information to and read information from the pipeline.</p>
<blockquote>
<p>Interested in other posts on Detonate? Check out <a href="https://www.elastic.co/security-labs/click-click-boom-automating-protections-testing-with-detonate">Part 1 - Click, Click…Boom!</a> where we introduce Detonate, why we built it, explore how Detonate works, describe case studies, and discuss efficacy testing.</p>
</blockquote>
<h2>Architecture</h2>
<p>Below is a high-level overview of the Detonate end-to-end architecture.</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image8.png" alt="The end-to-end Detonate architecture, including how we send input to the API server, each individual worker &amp; associated queue, cloud infrastructure details, and our Elastic data stores." /></p>
<p>The overall system consists of a series of message queues and Python workers. Detonation tasks are created by an API server upon accepting a request with as little information as the sample file hash. The task then moves from queue to queue, picked up by workers that execute various operations along the way.<br />
The server and workers run in a container on <a href="https://aws.amazon.com/ecs/">Amazon ECS</a>. The pipeline can also be brought up locally using <a href="https://docs.docker.com/compose/">Docker Compose</a> for early development and feature testing.</p>
<h3>API server</h3>
<p>The Detonate API server is a <a href="https://fastapi.tiangolo.com/">FastAPI</a> python application that accepts a variety of execution target requests: hashes of samples, native commands (in bash or Powershell, with or without arguments), and uploaded files. The server also exposes endpoints for fetching alerts and raw agent telemetry from an Elastic cluster.</p>
<p>The API documentation is generated <a href="https://fastapi.tiangolo.com/advanced/extending-openapi/">automatically</a> by FastAPI and incorporated into our global API schema.</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image2.png" alt="The schema includes varies get methods to see information about the running task." /></p>
<h4>Interacting with the API server - CLI</h4>
<p>We built a custom Python CLI (command-line interface) tool for interacting with our Detonate server. The CLI tool is built using the Python library <a href="https://click.palletsprojects.com/en/8.1.x/">click</a> along with <a href="https://github.com/Textualize/rich">rich</a> for a beautiful formatting experience in a terminal window. The tool is particularly useful for debugging the pipeline, as it can also be run against a local pipeline setup. The tool is installed and runs using <a href="https://python-poetry.org/">Poetry</a>, our preferred tool of choice for managing dependencies and running scripts.</p>
<pre><code>❯ DETONATE_CLI_API_ROOT_URL=&quot;${API_ENDPOINT_URL}&quot; \
	DETONATE_CLI_API_AUTH_HEADER=&quot;${API_KEY}&quot; \
	poetry run cli \
	--hash &quot;${MY_FILE_HASH}&quot;
</code></pre>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image5.png" alt="An example of the output from the CLI tool once a hash is submitted. It shows the hash, the task ID, and where along the pipeline the process is as well as the last worker status." /></p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image13.png" alt="The full output of a Hash detonation in the console. The links include references to run logs, task information, events and alerts in our Elastic clusters, and more." /></p>
<h4>Interacting with the API server - Web UI</h4>
<p>Internally, we host a site called Protections Portal (written using <a href="https://elastic.github.io/eui/">Elastic UI</a> components) to assist our team with research. For a more interactive experience with the Detonate API, we built a page in the Portal to interact with it. Along with submitting tasks, the Web UI allows users to see the feed of all detonations and the details of each task.</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image10.png" alt="The Detonate landing page Protections Portal showing the input field for starting a detonation. Below the input is a task that is currently running." /></p>
<p>Each task can be expanded to see its full details. We provide the links to the data and telemetry collected during the detonation.</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image11.png" alt="The UI shows the completed detonation task in the Protections Portal." /></p>
<h4>Interacting with the API server - HTTP client</h4>
<p>If our users want to customize how they interact with the Detonate API, they can also run commands using their HTTP client of choice (such as <strong>curl</strong> , <strong>httpie</strong> , etc.). This allows them to add detonations to scripts or as final steps at the end of their own workflows.</p>
<h3>Queues</h3>
<p>The pipeline is built on a series of queues and workers. Having very basic requirements for the message queues engine, we decided to go with <a href="https://aws.amazon.com/sqs/">Amazon SQS</a>. One of the many benefits of using a popular service like SQS is the availability of open-source resources and libraries we can build upon. For example, we use <a href="https://github.com/softwaremill/elasticmq">softwaremill/elasticmq</a> Docker images as a queue engine when running the pipeline locally.</p>
<p>The queues are configured and deployed with Terraform code that covers all our production and staging infrastructure.</p>
<h3>Workers</h3>
<p>Each worker is a Python script that acts as both a queue consumer and a queue producer. The workers are implemented in our custom mini-framework, with the boilerplate code for error handling, retries, and monitoring built-in. Our base worker is easily extended, allowing us to add new workers and evolve existing ones if additional requirements arise.</p>
<p>For monitoring, we use the <a href="https://www.elastic.co/observability/application-performance-monitoring">Elastic APM</a> observability solution. It is incredibly powerful, giving us a view into the execution flow and making debugging pipeline issues a breeze. Below, we can see a Detonate task move between workers in the APM UI:</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image12.png" alt="The Elastic Observability APM tracing page showing the execution flow of a detonation task. We are able to follow the task between each worker &amp; queue to see where we may have issues or can add improvements." /></p>
<p>These software and infrastructure components give us everything we need to perform the submission, execution, and data collection that make up a detonation.</p>
<h2>Detonations</h2>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image3.jpg" alt="Caption: by Simon Lee, https://unsplash.com/photos/CKuOXoZ21a8" /></p>
<p>The pipeline can execute commands and samples in Windows, Linux, and macOS virtual machines (VMs). For Windows and Linux environments, we use VM instances in <a href="https://cloud.google.com/compute">Google Compute Engine</a>. With the wide selection of public images, it allows us to provision sandboxed environments with different versions of Windows, Debian, Ubuntu, CentOS, and RHEL.</p>
<p>For macOS environments, we use <a href="https://aws.amazon.com/ec2/instance-types/mac/">mac1.metal instances in AWS</a> and an on-demand macOS VM provisioning <a href="https://veertu.com/anka-build/">solution from Veertu called Anka</a>. Anka gives us the ability to quickly rotate multiple macOS VMs running on the same macOS bare metal instance.</p>
<p>Detonate is currently focused on the breadth of our OS coverage, scalability, and the collection of contextually relevant data from the pipeline. Fitting sophisticated anti-analysis countermeasures into Detonate is currently being researched and engineered.</p>
<h3>VM provisioning</h3>
<p>In order to keep our footprint in the VM to a minimum, we use startup scripts for provisioning. Minimizing our footprint is important because our activities within a VM are included in the events we collect, making analysis more complicated after a run. For Windows and Linux VMs, <a href="https://cloud.google.com/compute/docs/instances/startup-scripts">GCP startup scripts</a> written in Powershell and bash are used to configure the system; for macOS VMs, we wrote custom bash and AppleScript scripts.</p>
<p>The startup scripts perform these steps:</p>
<ul>
<li><strong>Configure the system</strong>. For example, disable MS Defender, enable macros execution in MS Office, disable automatic system updates, etc.</li>
<li><strong>Download and install Elastic agent</strong>. The script verifies that the agent is properly <a href="https://www.elastic.co/guide/en/fleet/current/fleet-overview.html">enrolled into the Fleet Server</a> and that the policies are applied.</li>
<li><strong>Download and detonate a sample, or execute a set of commands</strong>. The execution happens in a background process, while the main script collects the STDOUT / STDERR datastreams and sleeps for N seconds.</li>
<li><strong>Collect files from the filesystem (if needed) and upload them into the storage</strong>. This allows us to do any additional verification or debugging once the detonation is complete.</li>
</ul>
<p>The VM lifecycle is managed by the <strong>start_vm</strong> and <strong>stop_vm</strong> workers. Since we expect some detonations to break the startup script execution flow (e.g., in the case of ransomware), every VM has a TTL set, which allows the <strong>stop_vm</strong> worker to delete VMs not in use anymore.</p>
<p>This clean-slate approach, with the startup script used to configure everything needed for a detonation, allows us to use VM images from the vendors from Google Cloud public images catalog without any modifications!</p>
<h3>Network configuration</h3>
<p>Some of the samples we detonate are malicious and might produce malicious traffic, such as network scans, C2 callouts, etc. In order to keep our cloud resources and our vendor’s infrastructure safe, we limit all outgoing traffic from VMs. The instances are placed in a locked-down VPC that allows outgoing connection only to a predefined list of targets. We restrict traffic flows in VPC using Google Cloud’s <a href="https://cloud.google.com/vpc/docs/routes">routes</a> and <a href="https://cloud.google.com/firewall/docs/firewalls">firewall rules</a>, and AWS’s <a href="https://docs.aws.amazon.com/vpc/latest/userguide/security-groups.html">security groups</a>.</p>
<p>We also make use of <a href="https://cloud.google.com/vpc/docs/flow-logs">VPC Flow Logs</a> in GCE. These logs allow us to see private network traffic initiated by sandbox VMs in our VPC.</p>
<h3>Telemetry collection</h3>
<p>To observe detonations, we use the <a href="https://www.elastic.co/elastic-agent">Elastic Agent</a> with the <a href="https://www.elastic.co/guide/en/security/current/install-endpoint.html">Elastic Defend</a> integration installed with all protections in “Detect” (instead of “Protect”) mode. This allows us to collect as much information from a VM as we can, while simultaneously allowing the <a href="https://www.elastic.co/security">Elastic Security</a> solution to produce alerts and detections.</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image6.png" alt="The policy settings in Elastic Defend integration for Detonate." /></p>
<p>We cover two use cases with this architecture: we can validate protections (comparing events and alerts produced for different OS versions, agent versions, security artifacts deployed, etc) and collect telemetry for analysis (for fresh samples or novel malware) at the same time. All data collected is kept in a persistent Elastic cluster and is available for our researchers.</p>
<h2>Running in production</h2>
<p>Recently we completed a full month of running Detonate pipeline in production, under the load of multiple data integrations, serving internal users through UI at the same time. Our record so far is 1034 detonations in a single day, and so far, we haven’t seen any scalability or reliability issues.</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image4.png" alt="Data from our internal Detonate telemetry, visualized in Kibana." /></p>
<p>The bulk of the submissions are Windows-specific samples, for now. We are working on increasing our coverage of Linux and macOS as well – stay tuned for the research blog posts coming soon!</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image7.png" alt="Additional visualization types can help us further break down how Detonate is being used." /></p>
<p>We are constantly improving our support for various file types, making sure the detonation is as close to the intended trigger behavior as possible.</p>
<p>Looking at the detonations from the last month, we see that most of the tasks were completed in under 13 minutes (with a median of 515 seconds). This time includes task data preparation, VM provisioning and cleanup, sample execution, and post-detonation processing.</p>
<p><img src="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/image14.jpg" alt="Data from our internal Detonate telemetry, generated using custom Python code." /></p>
<p>These are still early days of the service, so it is normal to see the outliers. Since most of the time in a task is spent waiting for a VM to provision, we can improve the overall execution time by using custom VM images, pre-starting VM instances, and optimizing the startup scripts.</p>
<h2>What's next?</h2>
<p>Now that you see how Detonate works, our next posts will dive into more detailed use cases of Detonate. We’ll go further into how these detonations turn into protecting more of our users, including right here at Elastic!</p>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/security-labs/assets/images/into-the-weeds-how-we-run-detonate/photo-edited-02@2x.jpg" length="0" type="image/jpg"/>
        </item>
        <item>
            <title><![CDATA[Click, Click… Boom! Automating Protections Testing with Detonate]]></title>
            <link>https://www.elastic.co/security-labs/click-click-boom-automating-protections-testing-with-detonate</link>
            <guid>click-click-boom-automating-protections-testing-with-detonate</guid>
            <pubDate>Thu, 04 May 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[To automate this process and test our protections at scale, we built Detonate, a system that is used by security research engineers to measure the efficacy of our Elastic Security solution in an automated fashion.]]></description>
            <content:encoded><![CDATA[<h2>Preamble</h2>
<p>Imagine you are an Endpoint artifact developer. After you put in the work to ensure protection against conventional shellcode injections or ransomware innovations, how do you know it actually works before you send it out into the world?</p>
<p>First, you set up your end-to-end system, which involves setting up several services, the infrastructure, network configuration, and more. Then, you run some malware; the data you collect answers questions about performance and efficacy, and may be an important research resource in the future. After you spend a day testing and gathering your results, you may want to run several hundred hashes over multiple kinds of operating systems and machine types, a daunting task if done entirely manually.</p>
<p>To automate this process and test our protections at scale, we built Detonate, a system that is used by security research engineers to measure the efficacy of our Elastic Security solution in an automated fashion. Our goal is to have it take security researchers only a couple of clicks to test our protections against malware. (Thus: click, click… boom!)</p>
<p>In this series of posts, we’ll: - Introduce Detonate and why we built it - Explore how Detonate works and the technical implementation details - Describe case studies on how our teams use it at Elastic - Discuss opening our efficacy testing to the community to help the world protect their data from attack</p>
<p>Interested in other posts on Detonate? Check out <a href="https://www.elastic.co/security-labs/into-the-weeds-how-we-run-detonate">Part 2 - Into The Weeds: How We Run Detonate</a> where we break down how Detonate works and dive deeper into the technical implementation.</p>
<h2>What is Detonate?</h2>
<p>At a high level, Detonate runs malware and other potentially malicious software in a controlled (i.e., sandboxed) environment where the full suite of Elastic Security capabilities are enabled. Detonate accepts a file hash (usually a SHA256) and performs the following actions:</p>
<ul>
<li>Prepares all files needed for detonation, including the malicious file</li>
<li>Provisions a virtual machine (VM) instance in a sandboxed environment, with limited connectivity to the outside world</li>
<li>Waits until file execution completes; this happens when, for example, an execution result file is found or the VM instance is stopped or older than a task timeout</li>
<li>Stops the running VM instance (if necessary) and cleans up the sandboxed environment</li>
<li>Generates an event summary based on telemetry and alerts produced during detonation</li>
</ul>
<p>The results of these detonations are made available to the team for research and development purposes. By post-processing the logs, events, and alerts collected during detonation, we can enrich them with third-party intelligence and other sources to evaluate the efficacy of new and existing Elastic Security protection features.</p>
<h2>What does it help us with?</h2>
<h3>Measuring Efficacy</h3>
<p>To build the best EPP on the market, we have to continuously measure the effectiveness of our product against the latest threats. Detonate is used to execute many tens of thousands of samples every month from our data feeds. Gaps in coverage are automatically identified and used to prioritize improvements to our protections.</p>
<h3>Supporting existing protections</h3>
<p>Many of our protections have associated artifacts (such as machine learning models and rule definitions) which receive regular updates. These updates need testing to ensure we identify and remediate regressions before they end up in a user’s environment.</p>
<p>Detonate provides a framework and suite of tools to automate the analysis involved in this testing process. By leveraging a corpus of hashes with known good and bad software, we can validate our protections before they are deployed to users.</p>
<h3>Threat research</h3>
<p>Some of our security researchers scour the internet daily for new and emerging threats. By giving them an easy-to-use platform to test malicious software they find in the wild, we better understand how Elastic Security defends against those threats or if we need to update our protections.</p>
<h3>Evaluating new protections</h3>
<p>In addition to testing existing protections, new protections run the risk of adverse interactions with our existing suite of layered capabilities. A new protection may be easily tested on its own, but tests may hide unintended interactions or conflicts with existing protections. Detonate provides a way for us to customize the configuration of the Elastic Stack and individual protections to more easily find and identify such conflicts earlier in development.</p>
<h2>What’s next?</h2>
<p>In this publication, we introduced Detonate &amp; what we use it for at Elastic. We discussed the benefits it provides our team when assessing the performance of our security artifacts.</p>
<p>Now that you know what it is, we will break down how Detonate works. In our next post, we’ll dive deeper into the technical implementation of Detonate and how we’re able to create this sandboxed environment in practice.</p>
]]></content:encoded>
            <category>security-labs</category>
            <enclosure url="https://www.elastic.co/security-labs/assets/images/click-click-boom-automating-protections-testing-with-detonate/blog-thumb-tools-various.jpg" length="0" type="image/jpg"/>
        </item>
    </channel>
</rss>