Skip to content

Custom Detections

Custom detections let your team change a Hunt Lab query into a scheduled detection. The detection raises observations in SenseOn each time that the query matches. Custom detections run together with the detections that SenseOn builds and maintains for you. They let you codify the threats, behaviours, and hygiene checks that are most important in your environment.

ℹ Availability: SenseOn releases custom detections for each tenant separately, behind a feature flag (senseon.custom_detections.enabled). If you do not see Custom Detections under Settings, the feature is not enabled for your organisation yet. To discuss how to enable it, contact SenseOn support.


How a Custom Detection Works

A custom detection uses a Hunt Lab query. On a schedule that you select, SenseOn runs the query over a recent window of telemetry. SenseOn changes each row that the query returns into an observation. The title of each observation is the name of the detection. The detail comes from the description that you define. These observations show in Experience, and they go into cases like all other observations.

A custom detection has the lifecycle that follows:

  1. Author the query in Hunt Lab. You always create a detection from a query. Thus, the process starts in Hunt Lab.
  2. Create the detection. Set the schedule, the severity, the observation text, and the controls for how frequently and how many observations it raises. You can set these values directly in the form. As an alternative, you can describe the detection to Horus (refer to Creating a Custom Detection from Hunt Lab).
  3. Preview. Before you save, run the query from the form. The form shows the rows that the query returns, and the observations that these rows raise when the detection runs.
  4. Save and monitor. After you save the detection, it runs on its schedule. The edit view shows the result of its most recent run. The edit view also has a direct link to the observations that the detection produced.

Who Can Access Custom Detections

When the feature is enabled for your organisation, all signed-in users can open Settings > Custom Detections and see the list of detections.

To create, edit, enable, disable, or delete detections, you must have the detections write permission (ui/edit/detections). Users without this permission see the list in read-only mode. They can examine the detections, but they cannot change them.


Creating a Custom Detection from Hunt Lab

ℹ Availability: The AI Detection Author feature (senseon.llm.detection_author.enabled) gives the chat that you use to author detections. SenseOn manages this feature for your organisation. For this feature, senseon.custom_detections.enabled must also be on. To turn the feature on or off, contact SenseOn. When it is off, Create detection falls back to the detection form that this section describes.

  1. Open Hunt Lab. Write the query that finds the activity that you want to detect.
  2. Run the query. Create detection shows in the Hunt Lab toolbar immediately when you start to type. But it stays disabled until the current query runs successfully. While it is disabled, a tooltip shows "Run the query successfully first to create a detection". When it is available, the tooltip shows "Create a detection from this query".
  3. Select Create detection. When AI Detection Author is enabled, this action opens the Horus Author a detection chat. The chat uses the query that you ran as its first message. When the feature is off, SenseOn copies the query that you ran into the detection form.
  4. Complete the detection form. Then select Save.

ℹ The button follows your latest run. If you edit the query after you run it, Create detection becomes disabled again. It stays disabled until you run the edited query again. Thus, each detection stays connected to a query whose results you saw immediately before.

💡 Why start in Hunt Lab? The quality of a detection depends on the quality of its query. When you build and run the query in Hunt Lab first, you can make sure that it returns the results that you expect. Then you change it into a scheduled detection.

Starting from the Custom Detections page. Settings > Custom Detections also has a Create detection button. If you have no detections yet, the page also gives the same action from its empty state. Because you always author a detection from a query, this button opens Hunt Lab with an empty query, not the form. Write your query there. Then continue from step 2 of the procedure in this section, where you run the query.

Authoring with Horus

Horus helps you to change a Hunt Lab query into a detection. How Horus helps depends on whether the AI Detection Author feature is enabled.

Chat path (when AI Detection Author is enabled). Create detection opens the Author a detection chat. The title of the chat is "Author a detection". The subtitle is "Describe what you want to detect and Horus will draft a detection rule with you." Horus starts with "I'll ground this against your telemetry, draft a query, check it returns rows, then show you a rule to review. Nothing is saved until you confirm." The Hunt Lab query that you ran is in the first message, as a code block. Then Horus does these steps in sequence:

  • grounds the query against your telemetry
  • drafts a query and makes sure that it returns rows
  • before it drafts a rule, asks you for permission through the "Shape this into a rule?" prompt. This is a confirm-to-proceed prompt with one option, Yes, shape the rule. It only asks for your permission to draft a rule, and it does not show a rule
  • shows the draft as a card that you can edit, with the title "Draft detection rule". The card has the name, query, schedule, severity, deduplication, and the other fields, for you to examine and adjust. When you confirm the card (Confirm and map entities), you go to entity mapping. This action does not save the rule
  • shows a "Suggested entity mapping" card for you to examine. When you accept the card (Accept mapping), this action saves the rule to your Custom Detections. Then a confirmation shows: "Rule saved to your Custom Detections."

If the save is refused, the chat shows "The rule could not be saved.". The chat does not stay silent. When you accept the mapping, this action alone does not prove that the rule was stored. Thus, look for one of these two messages before you consider the detection as created.

A rule that Horus drafts follows the same query requirements and observation title and description conventions as a rule that you build on the form.

Form fallback path (when the feature is off). Create detection opens the create form. In this form, Horus examines your query and drafts a version of it that is ready for a detection. A raw exploratory query usually does not run as a detection without changes. The query must have the correct time bounds, an explicit timestamp column, and named columns, not SELECT *. Horus changes the query to meet these query requirements. Horus also suggests a name, observation text, and deduplication columns.

While Horus works, a banner shows "Horus is drafting the query and observation fields — you can fill in the rest while it works.". The drafted fields are locked for a short time, but all other fields stay editable. If Horus cannot help, the form keeps your original query. The form also shows a quiet notice with a Try again option: "Horus couldn't prepare the query, so your original Hunt Lab query is shown. Review the fields and run the preview before saving." Horus never saves the detection for you. Thus, you always examine the result and run a preview before you save.

This form is the create fallback when the AI Detection Author feature is off. It is also the edit surface for all detections, independent of the flag. Thus, when you edit a detection, it always opens in the form, independent of how it was created.


The Detection Form

This section describes the form that you use on the create fallback path, and each time that you edit a detection. The same query requirements and observation conventions also apply to the rule that Horus drafts in the chat. You must complete the mandatory fields before you can save.

Field What it controls
Name A short, descriptive name for the detection. This name is also the observation title on each observation that the detection raises. Refer to Observation title and description.
Description (optional) What the detection looks for and why it matters.
Detection query The CHSQL query that defines the detection. Refer to Query requirements.
Frequency How often the detection runs, for example from every 15 minutes to every 24 hours.
Lookback How far back in the telemetry each run scans, for example from the last hour to the last 7 days.
Severity The severity of the observations that the detection raises: Info, Low, Medium, High, or Critical.
Category (optional) A free-text grouping for the detection, for example Execution.
MITRE ATT&CK techniques (optional) One or more MITRE ATT&CK techniques as tags for the detection, from the curated catalogue of SenseOn. Refer to Tagging MITRE ATT&CK techniques.
Observation description (optional) The detail on each observation. It supports {{Column}} tokens. SenseOn fills in these tokens for each row.
Deduplication columns The columns that define a unique result. SenseOn uses them to group repeats. Refer to deduplication, suppression, and limits.
Suppression window (hours) How long a repeat of the same result is suppressed before it raises another observation.
Max observations per run The maximum number of observations that a single run can record.
Enabled Whether the detection is active. When it is on, the field shows "Enabled — this detection is scheduled to run". To pause the detection but keep it, disable it.

Query requirements

Detection queries have some rules in addition to the rules for usual Hunt Lab queries. These rules make sure that each run produces well-formed, time-bounded observations:

  • Bound the time predicate with the window_start and window_end identifiers. Do not use the {since} and {until} placeholders that ad-hoc Hunt Lab queries use. SenseOn supplies the window for each run from the lookback of the detection.
  • Project an AS TIMESTAMP column so that each result contains the time when the activity occurred.
  • Avoid SELECT *. Explicitly list the columns that are necessary.
  • The deduplication columns and all {{Column}} tokens that you reference in the observation text must be in the projection of the query.

SenseOn does a check of these rules when you save. If a query does not meet them, the form shows the validation errors under "This detection could not be saved:". Then you can correct the query before you save.

Observation title and description

The observation title is the Name that you give the detection. It is a stable title. Thus, each observation that the detection raises has the same title, and the detection shows consistently across Experience and its filters. Because the title does not change, do not put the detail of each row in the name. Do not use {{Column}} tokens in the name.

Put the detail of each row in the observation description, not in the name. The description supports {{Column}} tokens. Put a column name in double braces (for example, Process {{process_name}} contacted {{url}}.). SenseOn then fills in the value from each row that matches. Each column that you reference in this way must be in the projection of the query.

deduplication, suppression, and limits

These controls make sure that a busy query does not send you too many observations that are almost identical:

  • Deduplication columns define what makes a result unique. SenseOn treats rows that have the same values in these columns as the same finding. To merge more findings together, remove a column. To merge only exact matches, keep more columns.
  • The suppression window sets how long SenseOn holds back a repeat of the same finding before the repeat raises a new observation.
  • Max observations per run sets the maximum number of observations that a single run can record. This limit gives protection against a query that is too broad.

Tagging MITRE ATT&CK techniques

Tag the detection with one or more MITRE ATT&CK techniques. Select the techniques from the curated catalogue of SenseOn. You do not type them as free text.

To open a menu with a search box and a checkbox list of techniques, select Add techniques. To filter the catalogue by technique ID or name, use the search box. The techniques that you select show under the field as chips that you can remove, for example T1059.001 — PowerShell. When you remove a chip, SenseOn deselects that technique. You cannot remove chips while the form saves.

The menu has some states when it loads the catalogue:

  • While the catalogue loads, the menu shows a spinner.
  • If the catalogue does not load, the menu shows an error, with a Try again option.
  • If the catalogue is empty, the menu shows a "No techniques available" message.
  • If your search matches nothing, the menu shows a no-match message.

Previewing a Detection

The form opens from Hunt Lab on the fallback path, when the AI Detection Author feature is off. When you open the form in this way, SenseOn automatically runs an initial preview for you. Thus, the Query results table and the deduplication options contain data without a manual run. If Horus then rewrites your query into a draft that is ready for a detection, the preview runs again on that draft. Thus, the results that you see are for the query that Horus prepared, not for your original Hunt Lab query. After that, each time that you change the query, lookback, or observation description, select Run query to refresh the preview.

Before you save, select Run query on the form to do a dry run of the current query and observation templates. The preview scans the same window that the scheduled detection uses. This window is the value in the Lookback field. Thus, when you change the lookback, the rows that the preview returns also change. The preview has two tabs:

  • Query results shows a table of the columns and rows that the query returns. If nothing matches, it shows "No rows matched".
  • Observations raised shows each returned row as the observation that the row raises when the detection runs. The title of each observation is the detection name. SenseOn fills in the description from that row. Because the title is the detection name, it is the same on each row. Only the description changes. The preview shows all unsaved edits to the description.

If more rows match than the preview shows, the preview tells you that it shows the first rows and that more rows matched. If the query does not work, the preview shows the database error inline. The results from your last successful run stay visible. Thus, you can correct the query and run it again.

The preview also fills the deduplication columns options with the columns that your query returns. Thus, you can select from the available columns, and you do not have to type them. On the create form, SenseOn loads these options automatically when your query is in place. After you change the projection, you can run the query again at any time to refresh the options. On a detection that already exists, you can select its saved deduplication columns even before you run a preview.


Managing Detections

To see all the detections for your organisation, go to Settings > Custom Detections. For each detection, the list shows these items:

  • The status
  • The name, with its analytic id
  • The severity
  • The user who created it
  • The result of its last run

From the list you can:

  • Enable or disable a detection with its status toggle. When you disable a detection, SenseOn pauses it but does not remove it.
  • Edit a detection to open the form.
  • Delete a detection. Before SenseOn removes the detection, it asks you to confirm.

To enable, disable, edit, or delete a detection, you must have the detections write permission.

The list shows a maximum of 25 detections on each page. If your organisation has more than one page of detections, a pager shows under the list. You can use the pager to move between the pages. If there is only one page, the pager is hidden.

When you delete a detection, the current page refreshes. If you removed the last detection on the page, the list goes back one page. Thus, the page that you see always shows the detections that the server holds.

If the list does not load, the page shows "Detection rules could not be retrieved" with a Reload option.

Filtering the detections list

A filter bar is above the list. You can use it to filter the list, so that you do not have to look through each page of detections. The filters apply to all your detections, not only to the page that you see. Each change to a filter takes you back to the first page of results.

The bar has four filters:

  • Status: show only Enabled or Disabled detections.
  • Name: search by the name of the detection. The menu shows the note "Matches the detection name exactly. Wildcards (*) supported.". Thus, a plain term matches only a detection whose name is exactly that term. To match more names, use the * wildcard (for example, RDP* matches each name that starts with "RDP"). Type your term. Then select Apply.
  • Severity: show only detections at the severity levels that you select: Critical, High, Medium, Low, or Info.
  • Created by: show only the detections that the selected people created.

Status, Severity, and Created by each have a list of options with checkboxes. Select one or more values. Then select Apply. To discard the change, select Cancel.

If you select several values in one filter, the filter becomes wider. A detection that matches one of these values stays in the list. If you set more than one filter, the list becomes narrower, because a detection must match all the filters. Each option shows the number of detections that it matches.

When a filter is set, a Clear filters button shows. This button resets all the filters at the same time. If your filters match nothing, the list shows a No results message with a Clear filters action. This message is different from the "no custom detections yet" empty state. The list shows that empty state only when your organisation really has no custom detections.

Last run and observations

When you open a detection to edit it, a Last run summary shows the result of its most recent run:

  • The run status, which is Success, Failed, or Running.
  • When it last ran.
  • How many observations it raised and how many rows it matched.
  • For a failed run, the error message from that run.
  • A "This detection hasn't run yet." state, if the detection did not run after its creation.

To open the observations from this detection in Experience, select View in Experience. Experience shows only the observations of this detection, with a filter on its analytic id. By default, Experience shows the last 28 days. To see older observations, make the date range in Experience wider.

Editing a detection from an observation

You can also go in the opposite direction, from an observation back to the detection that raised it. Open an observation from a custom detection in Investigate or Experience. Open the menu on its Analytic ID. Select Edit in Custom Detections. The detection opens in the form, and you can edit it. You do not have to find it in the list.

The option shows only for observations that a custom detection raised. It also shows only when custom detections are enabled for your organisation. To open the detection and edit it, you must have the detections write permission. Thus, only users with that permission see the option.