Sign inDemoInstall


Package Overview
File Explorer

Install Socket

Protect your apps from supply chain attacks



Kestrel Threat Hunting Language




.. image::
   :width: 432
   :alt: Kestrel Threat Hunting Language

.. image::
        :alt: Python 3

.. image::
        :alt: Code Style: Black

.. image::
        :alt: Code Coverage

.. image::
        :alt: Latest Version

.. image::
        :alt: PyPI Downloads

.. image::
        :alt: Documentation Status


**[News]** Kestrel session at `Black Hat USA 2023`_


Kestrel is a threat hunting language aiming to make cyber threat hunting *fast*
by providing a layer of abstraction to build reusable, composable, and
shareable hunt-flow. Starting with:

#. `Black Hat USA 2022 session recording`_
#. `Black Hat USA 2022 Kestrel hunting lab`_
#. `Kestrel live tutorial in a cloud sandbox`_

The Goal

Software developers write Python or Swift than machine code to quickly turn
business logic into applications. Threat hunters write Kestrel to quickly turn
threat hypotheses into hunt-flow. We see threat hunting as an interactive
procedure to create customized intrusion detection systems on the fly, and
hunt-flow is to hunts as control-flow is to ordinary programs.

What does it mean by *hunt fast*?

- Do NOT write the same TTP pattern in different data source queries.
- Do NOT write one-time-use adapaters to connect hunt steps.
- Do NOT waste your existing analytic scripts/programs in future hunts.
- Do construct your hunt-flow from smaller reuseable hunt-flow.
- Do share your huntbook with your future self and your colleagues.
- Do get interactive feedback and revise hunt-flow on the fly.


.. image::
   :width: 90%
   :alt: Kestrel Hunting Demo

Kestrel in a Nutshell

.. image::
   :width: 100%
   :alt: Kestrel overview.

- **Kestrel language**: a threat hunting language for a human to express *what to

  - expressing the knowledge of *what* in patterns, analytics, and hunt flows.
  - composing reusable hunting flows from individual hunting steps.
  - reasoning with human-friendly entity-based data representation abstraction.
  - thinking across heterogeneous data and threat intelligence sources.
  - applying existing public and proprietary detection logic as analytic hunt steps.
  - reusing and sharing individual hunting steps, hunt-flow, and entire huntbooks.

- **Kestrel runtime**: a machine interpreter that deals with *how to hunt*.

  - compiling the *what* against specific hunting platform instructions.
  - executing the compiled code locally and remotely.
  - assembling raw logs and records into entities for entity-based reasoning.
  - caching intermediate data and related records for fast response.
  - prefetching related logs and records for link construction between entities.
  - defining extensible interfaces for data sources and analytics execution.

Basic Concepts and Howto

Visit `Kestrel documentation`_ to learn Kestrel:

- Learn concepts and syntax:

  - `A comprehensive introduction to Kestrel`_
  - `The two key concepts of Kestrel`_
  - `Interactive tutorial with quiz`_
  - `Language reference book`_

- Hunt in your environment:

  - `Kestrel runtime installation`_
  - `How to connect to your data sources`_
  - `How to execute an analytic hunt step in Python/Docker`_
  - `How to use Kestrel via API`_
  - `How to launch Kestrel as a Docker container`_

Kestrel Huntbooks And Analytics

- `Kestrel huntbook`_: community-contributed Kestrel huntbooks
- `Kestrel analytics`_: community-contributed Kestrel analytics

Kestrel Hunting Blogs

#. `Building a Huntbook to Discover Persistent Threats from Scheduled Windows Tasks`_
#. `Practicing Backward And Forward Tracking Hunts on A Windows Host`_
#. `Building Your Own Kestrel Analytics and Sharing With the Community`_
#. `Setting Up The Open Hunting Stack in Hybrid Cloud With Kestrel and SysFlow`_
#. `Try Kestrel in a Cloud Sandbox`_
#. `Fun with and the Kestrel PowerShell Deobfuscator`_
#. `Kestrel Data Retrieval Explained`_

Talks And Demos

Talk summary (visit `Kestrel documentation on talks`_ to learn details):

- 2023/08 `Black Hat USA 2023`_
- 2022/12 `Infosec Jupyterthon 2022`_ [`IJ'22 live hunt recording`_]
- 2022/08 `Black Hat USA 2022`_ [`BH'22 recording`_ | `BH'22 hunting lab`_]
- 2022/06 `Cybersecurity Automation Workshop`_
- 2022/04 `SC eSummit on Threat Hunting & Offense Security`_ (free to register/playback)
- 2021/12 `Infosec Jupyterthon 2021`_ [`IJ'21 live hunt recording`_]
- 2021/11 `BlackHat Europe 2021`_
- 2021/10 `SANS Threat Hunting Summit 2021`_: [`SANS'21 session recording`_]
- 2021/05 `RSA Conference 2021`_: [`RSA'21 session recording`_]

Connecting With The Community

- Join Kestrel slack channel:
  - Get a `slack invitation`_ to join `Open Cybersecurity Alliance workspace`_
    .. image::
       :width: 20%
       :alt: OCA logo
  - Join the *kestrel* channel to ask questions and connect with other hunters
- Contribute to the language development (`Apache License 2.0`_):

  - Create a `GitHub Issue`_ to report bugs and suggest new features
  - Follow the `contributing guideline`_ to submit your pull request
  - Refer to the `governance documentation`_ regarding PR merge, release, and vulnerability disclosure

- Share your huntbook and analytics:

  - `Kestrel huntbook`_
  - `Kestrel analytics`_

.. _Kestrel live tutorial in a cloud sandbox:
.. _Kestrel documentation:

.. _A comprehensive introduction to Kestrel:
.. _The two key concepts of Kestrel:
.. _Interactive tutorial with quiz:
.. _Kestrel runtime installation:
.. _How to connect to your data sources:
.. _How to execute an analytic hunt step in Python/Docker:
.. _Language reference book:
.. _How to use Kestrel via API:
.. _How to launch Kestrel as a Docker container:
.. _Kestrel documentation on talks:

.. _Kestrel huntbook:
.. _Kestrel analytics:

.. _Building a Huntbook to Discover Persistent Threats from Scheduled Windows Tasks:
.. _Practicing Backward And Forward Tracking Hunts on A Windows Host:
.. _Building Your Own Kestrel Analytics and Sharing With the Community:
.. _Setting Up The Open Hunting Stack in Hybrid Cloud With Kestrel and SysFlow:
.. _Try Kestrel in a Cloud Sandbox:
.. _Fun with and the Kestrel PowerShell Deobfuscator:
.. _Kestrel Data Retrieval Explained:

.. _RSA Conference 2021:
.. _RSA'21 session recording:
.. _SANS Threat Hunting Summit 2021:
.. _SANS'21 session recording:
.. _BlackHat Europe 2021:
.. _Infosec Jupyterthon 2021:
.. _IJ'21 live hunt recording:
.. _Infosec Jupyterthon 2022:
.. _IJ'22 live hunt recording:
.. _SC eSummit on Threat Hunting & Offense Security:
.. _Cybersecurity Automation Workshop:
.. _Black Hat USA 2023:
.. _Black Hat USA 2022:
.. _BH'22 recording:
.. _Black Hat USA 2022 session recording:
.. _BH'22 hunting lab:
.. _Black Hat USA 2022 Kestrel hunting lab:

.. _slack invitation:
.. _Open Cybersecurity Alliance workspace:
.. _GitHub Issue:
.. _contributing guideline: CONTRIBUTING.rst
.. _governance documentation: GOVERNANCE.rst
.. _Apache License 2.0:



Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.


Related posts

SocketSocket SOC 2 Logo


  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc