Extending
Write a correlation rule
A rule turns raw events into a finding. It is a YAML file in correlations/,
embedded at build time.
id: many_open_ports
version: 1
meta:
name: Host exposes many open ports
description: >
A host was found with an unusually large number of open TCP ports, which
widens its attack surface.
risk: MEDIUM # HIGH | MEDIUM | LOW | INFO
collections:
- collect:
- method: exact
field: type
value: TCP_PORT_OPEN
aggregation:
field: entity.data # one finding per host/IP
analysis:
- method: threshold # fire only when a bucket has 8+ matches
field: type
minimum: 8
headline: "Host exposes many open ports: {entity.data}"
How it evaluates
- collect — keep events whose fields match.
methodisexactorregex;fieldistype,data,module, or a walked path (source.*,entity.*,child.*). Prefix a value withnotto negate. A collection can have several matchers (all must pass) and a rule several collections. - aggregation — bucket the surviving events by a field. You get one finding per bucket.
- analysis — optional passes:
threshold(bucket survives if a value occurs betweenminimumandmaximumtimes),outlier(keep buckets belowmaximum_percentof the total),first_collection_only,match_all_to_first_collection. - headline — the finding title.
{field}placeholders are filled from the first event, e.g.{data},{source.data},{entity.data}.
Test it
Add a unit test in crates/spiderfootplus-core/src/correlation.rs that builds a small event
graph and asserts the rule fires (and does not fire below threshold). Then:
cargo test -p spiderfootplus-core correlation
spiderfootplus rules # confirm it loads with the right risk
spiderfootplus correlate <scan-id> # re-run rules against a stored scanEdit this page on GitHub ↗Updated 2026-12-03 · Markdown