Measuring noise and tuning without going blind

Unit 4 of 5 in Detection engineering.

You will be able to calculate a rule's precision, tune it narrowly and re-test that it still catches what it should.

Lesson

Two ways to be wrong, and they trade against each other

NIST's guide says detection systems cannot be completely accurate. When benign activity is flagged as malicious, a false positive has occurred. When malicious activity is missed, a false negative has occurred. It is not possible to eliminate all of either, and in most cases reducing one increases the other. Many organizations choose to decrease false negatives at the cost of more false positives, which means more events are detected but more analyst time is needed to tell them apart. Changing the configuration to improve accuracy is called tuning.

That trade is a business decision, not just a technical one. A rule for a rare, severe behaviour can tolerate a lower precision than a rule that fires hundreds of times a day.

Count them: precision and recall

Google's machine learning course defines the measures you need. Precision is the share of positive classifications that were actually positive: true positives divided by true positives plus false positives. For an alert, it answers 'of the alerts I received, how many were real?' Recall, also called the true positive rate, is the share of real positives that were caught: it answers 'of the real attacks, how many did the rule see?'

The course also warns about accuracy. With a rare class that appears 1 percent of the time, a model that always says negative scores 99 percent accuracy and is useless. Real attacks are usually a tiny share of all events, so never judge a rule by how many events it correctly ignored. A small made-up example: a rule fires 40 times in a week and analysts confirm 10 as real, so its precision is 10 out of 40, or 25 percent. If the testers also planted 12 real cases and the rule caught 10 of them, its recall on that set is 10 out of 12. Measure both, and say what sample you measured on.

Tune narrowly

NIST lists the usual tuning tools: thresholds, lists of known-benign entities (it calls them whitelists) and known-malicious ones, alert settings, and editing the detection code. Whitelists are used on a granular basis to ignore false positives from known benign activity. Palantir's template adds three ways to reduce false positives: add another component to the rule to increase true positives, remove common false positives through patterns, and filter in the back end using stored examples of expected false positives. It also says known false positives should be suppressed in the SIEM, and that if a low false positive rate cannot be reached, the alert may need to be broken down, refactored or discarded.

Make each change as small as possible, and say why. Excluding one named management account from one rule is a narrow change. Excluding a whole folder or a whole class of users is a wide one and can silently remove the very activity you wanted to see. The Sigma habit helps: record the false positive in the rule's falsepositives list and keep the exception in a filter.

Raise the signal by combining weak events

A single event may be too common to alert on but a few of them together may be rare. Sigma correlation rules support this: single rule hits can stay low or informational, and the correlation can set a higher level when the combination appears within a timespan. The level definitions say low events are relevant in high numbers or in combination with others. This is often a better answer than loosening or tightening a single threshold.

Anomaly-based rules need a separate warning. NIST notes they can be very effective at detecting previously unknown threats, but produce many false positives because benign activity deviates from profiles, and that analysts may find it hard to work out why an alert fired. If you use a baseline, plan to rebuild it.

Re-test, review and retire

After every tuning change, run the true-positive test again. Tuning away a false positive can also tune away a real detection, and only the re-test tells you. NIST adds that administrators should review tuning and customizations periodically to be sure they are still accurate: check whitelist entries, adjust thresholds as the environment and threats change, and rebuild baselines for anomaly-based detection.

Treat the portfolio as a whole. Measure each rule's precision and the analyst hours it burns, and retire or rewrite the noisiest ones. A rule that nobody trusts is worse than no rule, because its alerts train people to ignore the queue.

Key points

Sources

Lecture

Alert triage like a SOC analyst: A talk on how an analyst works one alert, which shows what a noisy rule costs the person who receives it.

Practice in the labs

Measure noise, tune thresholds, and separate attack-like from normal admin work, using Linux audit events and synthetic alert data.

Also try, in the simulators

Knowledge check

  1. A rule fired 50 times this month. Analysts confirmed 5 were real. What is its precision? Answer: 10 percent. Precision is true positives divided by everything the rule flagged: 5 out of 50 is 10 percent. Recall would need a separate count of real attacks the rule missed.
  2. A rule is correct on 99 percent of all events, but real attacks are 0.1 percent of events. What does this tell you? Answer: Nothing useful: with rare events, accuracy can be high even if the rule catches no attacks. The machine learning course's example shows that with a rare class a model that always says negative scores very high accuracy while being useless, so measure precision and recall instead.
  3. You tune a rule to remove a false positive. What must you do next? Answer: Re-run the true-positive test to prove the rule still catches the attack. Tuning can remove real detections along with the false alarm. The validation step in the ADS template exists for exactly this, and NIST also recommends reviewing tuning periodically.
  4. A single event is too common to alert on, but three different events in ten minutes are rare. What is a good approach? Answer: A correlation rule that raises the level when the events combine within a timespan. Sigma correlation rules let single hits stay low and raise the level when a combination appears in a timespan, and the level definitions say low events matter in combination with others.

Back to the syllabus or see all classes.

Related