Skip to content
Documentation

Security model

This page is published from the agent repository. Edit on GitHub View source

This page covers how the agent protects itself and the host it runs on: which privileges it holds on each OS, what it trusts, where untrusted bytes come in, what an attacker can and cannot do to it, and how the code enforces each of these. It is written for contributors. When a code comment needs to explain why a security control exists, it should link the matching section here.

The adversary we design for has administrator or root on the host, but not kernel execution. Above the kernel, we do not try to make the agent impossible to tamper with, because an adversary with the same privilege can always try. The goal is that nobody can tamper with it silently. Every way of stopping, blinding or cutting off the agent should end in a restart, a local alert, or a gap the server can see. An adversary who already runs code in the kernel defeats every user-mode control described here. That is the limit of this design, stated plainly below in What is not defended.

Contents

Trust boundaries

flowchart LR
  subgraph Host
    K[Kernel telemetry<br/>eBPF / ETW / ES / netlink / audit] -->|trusted source,<br/>bytes still parsed defensively| A[agent]
    L[Log files, network payloads,<br/>process-chosen argv] -->|untrusted| A
    CLI[cli / ui] -->|IPC, root or elevated only| A
    W[watchdog] <-->|spawn, heartbeat file| A
    SM[service manager] -->|restarts| W
    NE[macOS network extension] -->|Unix socket NDJSON| A
  end
  A <-->|mTLS, server CA or public roots| S[control plane]
  S -->|manifests: verified against keys<br/>embedded in the agent| A
  RT[release-tool, offline<br/>PKCS#11 token] -.signs.-> S
BoundaryWhat is trustedWhat is notEnforcement
Agent and control planeThe TLS server certificate (private CA bundle, or public roots)The network; the server's contentmTLS transport; every release, content, snapshot and rotation manifest is verified on the agent against embedded Ed25519 keys, so a compromised server cannot push code or rules
Agent and local callersRoot on Unix, elevated token on WindowsEvery other local userPeer credentials checked on every IPC connection
Agent and installed filesThe signed release manifest persisted at promote timeThe live filesystemPeriodic re-hash of the active release; the watchdog pins the agent binary hash
Agent and watchdogEach other—Two processes plus the OS service manager; neither is a single point of failure
Agent and telemetry bytesKernel as the writerContent of every field (paths, argv, log lines, network payloads)Bounded, never-panic parsers; fuzzing

The server is deliberately not a root of trust for code. It distributes manifests that it did not sign and cannot sign. The signing keys are held offline (see release-tool), and the agent verifies every manifest itself.

Privileges per OS

OSProcess identityHow it is grantedNotes
Linux (packaged)Unprivileged synthaea user plus an explicit ambient capability setsynthaea-agent.service, synthaea.sysusers; OpenRC equivalent in synthaea-agent.initdNoNewPrivileges=true, ProtectSystem=strict, writable paths limited to state, log, runtime and the bpffs pin directory
Linux (watchdog install, dev/manual)rootFallback unit generated by cmd_install when no packaged unit existsNo capability scoping or sandboxing: use the package for real deployments
WindowsLocalSystem (the watchdog service; the agent inherits its token)sc create in cmd_installsc sidtype unrestricted puts the service SID NT SERVICE\SynthaEDR in the token. The minifilter port only accepts clients that hold it (AGENT_SERVICE_SID)
macOSroot (launchd daemon)Plist written by cmd_installEndpoint Security needs the Apple-granted entitlement and Full Disk Access. See packaging/macos

Linux capability set

Each capability is granted for one feature. Everything else is removed from the bounding set, so a bug in a sensor does not become a root bug.

CapabilityWhy
CAP_BPF, CAP_PERFMONLoad eBPF programs and attach tracepoints and kprobes
CAP_SYS_RESOURCERaise RLIMIT_MEMLOCK for BPF maps
CAP_DAC_READ_SEARCHRead /proc/<pid>/* and other users' files (hashing, command lines, YARA)
CAP_NET_ADMINConntrack netlink (network flows)
CAP_KILLSignal other users' processes. Used only by the kill response, which is off by default
CAP_AUDIT_READMulticast-subscribe to NETLINK_AUDIT for SELinux AVC denials

The following capabilities are deliberately not granted: CAP_SYS_PTRACE (so /proc/<pid>/exe of other users is not readable) and CAP_CHOWN/CAP_FOWNER/CAP_DAC_OVERRIDE (so the agent cannot quarantine files it does not own). Each would be added only after a check on a real host shows a feature needs it.

The unit sets PrivateTmp=false and ProtectHome=read-only on purpose. Events carry host paths, and the agent opens them by path to hash or scan them. Hiding /tmp or /home would mean payloads dropped there are never scanned.

The eBPF preflight accepts a capability-scoped process as well as root. has_bpf_capabilities checks the effective set, so agent status does not report a correctly scoped service as failing.

Signing keys and the test-key guard

The updater embeds four Ed25519 public keys. Each key has exactly one job (crates/updater/src/key.rs):

KeyVerifiesStatic
releaseBinary release manifests (ReleaseManifest::verify_signature_with)RELEASE_PUBLIC_KEY
contentContent (rules) manifests (ContentManifest)CONTENT_PUBLIC_KEY
snapshotThe common-set snapshot manifest only (snapshot.rs)SNAPSHOT_PUBLIC_KEY
recoveryKey rotations only (KeyRotationManifest); held offline and never rotated itselfRECOVERY_PUBLIC_KEY

Keeping the roles separate limits the damage a stolen key can do. A content signer cannot sign a release, and a snapshot can never verify as content. The unit test committed_keys_are_distinct_per_role_and_not_all_zero makes sure the four committed key files hold four different keys.

Three build states

flowchart TD
  B{How was the updater built?} -->|cfg test or feature test-key| T[Test set: keys derived<br/>from public seeds in the source]
  B -->|no test-key, a keys/*.pub says unprovisioned| U[No key for that role: static is None]
  B -->|no test-key, keys/*.pub = hex| P[Production keys]
  T --> TA[Commands that act on a manifest refuse<br/>unless --allow-test-key is passed]
  U --> UA[Every verify returns SigningKeyUnprovisioned:<br/>fail closed]
  P --> PA[Normal verification]
  • Test set. The seeds ([0x42; 32], [0x43; 32], [0x44; 32]) are public and committed to the repository. They are compiled in only under cfg(test) or the test-key cargo feature. A build without either cannot ship them by accident. In the test set, release and content share one key, while recovery and snapshot each have their own.
  • Temporary keys (2026-11-12). crates/updater/keys/*.pub hold three temporary keys (release, content, recovery), generated on a developer machine outside the ADR-0027 ceremony. They have no custody and no named holders; the private halves are plain files on that machine, and release-tool --key-file refuses them (it takes only the public test keys), so signing with them needs a PKCS#11 token holding the key. They are replaced when the real keys exist (#43); do not ship a build that embeds them to a customer. snapshot.pub stays unprovisioned on purpose: a snapshot key turns the agent's snapshot fetch loop on (ADR-0033), which waits on tenant binding and on a custody decision.
  • Unprovisioned. A key file that says unprovisioned makes its static None, so a build embeds no key for that role and every verify returns UpdaterError::SigningKeyUnprovisioned. The agent does not fall back to anything. This is how a file is put back to the fail-closed state.
  • Provisioned. Each key file holds 64 hex characters after optional # comments (parse_key_file). A typo or a truncated key parses to None. The test every_committed_key_file_is_unprovisioned_or_a_valid_key catches it at commit time (and a_committed_key_file_is_a_valid_key_and_never_the_public_test_key that no file holds a public test key), so it never shows up later as a confusing "no key" error at run time.

SYNTHAEA_UPDATER_TEST_KEY follows the feature flag (cfg!(any(test, feature = "test-key"))), so nobody can set it by hand.

Runtime refusal

ensure_key_trusted runs before apply-release, apply-content-manifest and key rotations act on a manifest:

  1. If no key is embedded for this kind of manifest, the command refuses and says why.
  2. If the key in force is the public test key, the command refuses unless the operator passes --allow-test-key. That flag exists only in a test-key build. The error message spells out the consequence: whoever can serve the release routes could run code as root.
  3. Once a rotation has replaced the test key, the install is no longer treated as test-keyed. trust::load replays the applied rotations from TrustState. If that record is corrupt, the command refuses. It does not fall back to the embedded keys, because those may already have been rotated away.

The self-integrity monitor treats SigningKeyUnprovisioned differently from a bad signature (signature_failure_is_tamper). A build with no key would otherwise raise a false tamper alert on every pass.

Keeping the test key out of packages

Cargo feature unification is the main way the test key could leak into a package: if any crate in the build enables updater/test-key, every crate gets it. The guards are:

GuardWhat it proves
tools/check-no-test-key.sh (CI)cargo tree for the packaged set (agent, watchdog, cli, --no-default-features) on Linux, Windows and macOS targets does not enable test-key, and the default build still does (positive control). The packaging scripts still build without default features and still scan their output. The updater rlib built without the feature lacks the marker, and with the feature has it
tools/assert-no-test-key.shScans a built binary for the marker SYNTHAEA-PUBLIC-TEST-KEY-SET-V1, which the test-key build links in deliberately (TEST_KEY_MARKER in key.rs). Run by the deb/rpm build scripts, the Windows build.ps1, and the static-agent workflows
tests/unprovisioned_build.rs (cargo test -p updater --no-default-features)What a packaged build really embeds (exactly the committed keys; the public test seed is refused). Unit tests cannot show this because they always compile with cfg(test), which turns the test set on
tests/test_key_build.rsThe lab variant embeds the test set and reports it

Each check also proves it can fail: it confirms the marker is found in a test-key build. Without that, a check that silently looked at nothing would also pass.

Offline signing

Signing happens only in release-tool. It never runs on an endpoint or on the control plane. Production keys sign from a PKCS#11 token (pkcs11.rs), so the private key never leaves the device. --key-file and --test-key exist for lab use only. If a key can be read from a file, it is not a production key.

What a valid signature does not prove

A signature proves who signed a manifest, not that its contents are safe. The updater also checks:

Secret handling

SecretWhere it livesRule
mTLS client keyPEM file at server.mtls_key (absolute path, checked by config::load)Read once when the transport is built. It is never logged and never sent anywhere
Key passphraseserver.mtls_passphrase, a SecretRefThe config file holds a reference only: envvar:NAME or file:/path. A bare literal is rejected at load with ConfigError::SecretInvalid, and so is an unknown provider such as vault:
Release signing keysOffline PKCS#11 tokenNever on a host or on the server
Credentials inside telemetryCommand lines, URLs, script textRedacted at output boundaries. See below

Current gap. server.mtls_passphrase is parsed and validated, but the transport does not use it yet. build_tls_config refuses an encrypted PEM key with an explicit error and asks for an unencrypted one. So today the key file's protection comes from file permissions only.

Credentials in telemetry. Detection needs raw command text, but every copy that leaves the process should be scrubbed. RedactingSink applies that split. Live detection pipelines see Exec, ReadlineInput, ScriptBlock, AmsiContent and WmiActivity raw, while capture and output sinks get them redacted. URL secrets in download provenance, BITS jobs and HTTP evidence are always redacted. The pure functions (redact_command_line, redact_command_text, redact_url_secrets) keep the line's formatting, are idempotent, and are property-tested. Positional and encoded credential forms are not recognized.

Logging. Event payloads are never logged at info level (a workspace convention).

Attack surface

Local IPC (cli and ui to agent)

Implemented in crates/ipc, served by ipc_handler.

  • Transport. A Unix domain socket at ipc.endpoint (default /var/run/synthaea/agent.sock), or a named pipe \\.\pipe\... on Windows. The config loader checks the endpoint's shape for each OS. The Windows listener uses first_pipe_instance(true), so the agent fails to bind if another process already owns the pipe name. It does not silently share it.
  • Authorization. PeerCreds::check_authorized allows uid == 0 (read with SO_PEERCRED or LOCAL_PEERCRED) or TokenIsElevated on Windows. Any other caller gets one Unauthorized reply and the connection closes (server.rs). If no credential is available, access is denied. On Unix the check is the peer's uid, not the socket file's mode.
  • Bounds. One message is one JSON line, capped at MAX_MESSAGE_BYTES (1 MiB). The server closes the connection when a line reaches the cap. RecentDetections.limit is clamped to RECENT_DETECTIONS_HARD_LIMIT (256). Every request and payload type uses deny_unknown_fields.
  • Mutations. Almost every request is read-only. There are three exceptions: ReloadContent re-reads content that was already verified and written to disk; SuppressVerdict and UnsuppressVerdict change only the agent's own fused-verdict view, are reversible, and write an audit line for every real change. Kill, quarantine and isolation are not available over IPC. They wait for a per-capability authorization model.
  • Known gaps. There is no cap on concurrent connections and no idle timeout. The client does not authenticate the server endpoint, so a process that binds the socket or pipe first could answer the CLI. Both matter only to a caller that already holds the required privilege.

macOS network-extension socket

The NE system extension connects to a Unix socket in the shared app-group container and writes NDJSON records (receiver.rs). Unknown wire versions and lines that fail to parse are counted (skew_skipped) and skipped, never treated as fatal. The receiver does not check the peer's identity and reads lines without a length cap. Access depends only on the app-group container's filesystem permissions. Follow-ups for this sensor are tracked in #35 and #21.

Windows minifilter port

The driver's communication port accepts only a client whose token holds the agent service SID (crates/sensors/windows/minifilter). Messages are decoded by wire.rs. Property tests check that arbitrary bytes, and headers with consistent lengths, never cause a panic.

Network

  • Outbound only. The agent opens no network listener. Its only network traffic is outbound HTTPS to the control plane through TransportClient, which uses ureq over rustls with a 30 s global timeout by default (TransportConfig). control_plane_url must be https://.
  • Server verification. If server.ca_cert is set, only that bundle is trusted, not the public roots. An unreadable bundle, or one with no certificates, is an error, never a silent fallback (load_ca_roots). Tests: tests/private_ca.rs.
  • Identity. The client certificate is the agent's identity, and the server derives the agent from that certificate. The agent_id field in request bodies is informational.
  • Enrollment is not built. No code issues, stores or renews the client certificate. An operator places the cert and key on the host by hand. See #56 (operator guide) and #79 (install-to-enroll acceptance run).
  • Peer-to-peer mesh. The mesh crate is a design stub with no code (#29).

Parsers of untrusted bytes

Kernel sockets carry bytes the kernel writes, but many fields describe things an attacker controls: argv and its lengths, file paths, log lines, TLS ClientHellos, event-log XML. Every such parser has to treat its input as hostile. See the next section.

Never-panic parsers and fuzzing

Contract. A byte parser may return an error on any input and must never panic. A panic on a sensor's drain path kills that sensor or the whole agent. A malformed input an attacker can reproduce becomes a way to switch the agent off. The watchdog restarts it, with backoff, but a reliable crash loop is still a gap in protection.

How it is enforced:

  • Convention, reviewed but not linted. No unwrap or expect outside tests and provably infallible cases. The workspace lints deny todo, unimplemented and dbg_macro, and require a // SAFETY: comment on every unsafe block (Cargo.toml [workspace.lints.clippy]). unwrap_used is not linted.
  • Deterministic robustness suites in each parser crate's tests/ directory. They use a seeded PRNG corpus plus splices of valid records, so failures reproduce:
ParserSuite
Audit netlinkaudit/tests/robustness.rs
sock_diag, proc connector, conntracknetlink/tests/robustness.rs
eBPF exec record (variable-length argv)wire/tests/exec_record.rs
TLS ClientHellotls_client_hello.rs tests in userspace
ETW (BITS, Zone.Identifier)etw/tests/robustness.rs
Event-log XML and per-event decoderseventlog/tests/xml_parser_robustness.rs and siblings
Minifilter wireproptests in wire.rs
Intel feedsintel/tests/robustness.rs
  • Coverage-guided fuzzing in tests/fuzz/. It needs libFuzzer and a nightly toolchain, so it is excluded from the workspace:
TargetExercisesIn scheduled CI
audit_parsesensor_linux_audit::parse_audit_messageyes
netlink_parseDiagMsg, ProcEvent, ConntrackFlowyes
exec_record_parseparse_exec_record. It also checks that an accepted record stays within ARGV_WINDOW_BYTES and within the inputno (manual only)
logs_parseAccess-log (common and combined) and MySQL error-log parsersno (manual only)

The scheduled workflow (.github/workflows/fuzz.yml) runs Monday and Thursday for 10 minutes per target. Each run resumes from the corpus cached by the previous run, so coverage accumulates. It is not a PR gate. When it finds a crash: minimize the input with cargo +nightly fuzz tmin --fuzz-dir tests/fuzz, pin it as a named regression test in the owning crate's robustness suite, then fix the parser. The corpus is not tracked in the repository.

A new parser of kernel-socket or attacker-influenced bytes must come with a robustness suite. If it is high-value, it also gets a fuzz target.

Self-protection

The mechanisms behind each row are explained in Self-protection.

These controls make tampering loud. They do not hide the agent. The agent never uses concealment techniques: no unlinking from process lists, no hidden files, no API hooking. A defensive agent has to stay visible to the person who installed it, and other security products rightly flag hiding behavior whatever the intent.

Attack on the agentDefenseCode
Kill the agentThe watchdog respawns it, with exponential backoff for fast crash loopssupervise.rs
Kill the watchdogThe service manager restarts it: systemd Restart=always, SCM sc failure, launchd KeepAliveapps/watchdog/src/service
Catchable signal (SIGTERM, SIGHUP, SIGQUIT)Records who sent it with sigwaitinfo before exiting, after a bounded flushkill_loudness.rs
SIGKILLCannot be attributed by the dying process. The eBPF sensor records the sender in a map pinned under /sys/fs/bpf/synthaea, and the restarted agent reports itebpf.rs
Freeze or wedge the agentThe agent writes a progress-backed heartbeat file. The watchdog kills the agent after repeated checks see no progressheartbeat.rs, supervise.rs
Detach a sensor and leave the process runningPer-sensor heartbeat: the silence becomes an alertsilence.rs, tamper::heartbeat
Swap the agent binary on diskThe watchdog pins its hash at startup and refuses to launch a mismatch. Every 300 s the agent re-hashes the active release against its signed manifesttamper.rs, integrity.rs
Write, delete or rename the agent's own filesAny process other than the agent doing so raises a high-severity detectionprotected.rs
Edit the service definitionLinux: drift against an install-time snapshot is reportedservice/linux.rs
sc stop / sc delete as a non-SYSTEM adminA hardened service DACL removes stop, pause and delete from Administrators. Admins keep WRITE_DAC, so this is friction, not a boundaryservice/windows.rs
Install into a world-writable directoryRefused on Unix, and installed binaries are set to root-owned 0755tamper.rs, service/mod.rs
Firewall the agent off the serverThe agent sends a periodic health beacon. The server treats an agent that stops sending it as suspicious. The spool keeps events until the link returnshealth.rs, TransportClient::send_heartbeat
Unhook userland APIs, direct syscalls, patch ETW in a processNothing to unhook: telemetry comes from the kernel (eBPF, kernel ETW, ES), not inline hooks—

Response actions: fail-closed guards

Response actions run with the agent's privilege, and their targets come from telemetry. They must fail closed when the target is wrong.

  • Kill. kill_process refuses pid 0, pids that do not fit pid_t (they would wrap to a process group, or to every process), pid 1, and the agent's own pid. It refuses even when policy enables kill. When policy disables kill, the outcome is ObserveOnly. Separately, the correlator refuses to kill a system service's main process. That refusal currently misses services started before the agent (#52).
  • Quarantine. quarantine_file opens the source once with O_NOFOLLOW, checks it with fstat, and hashes and moves it through that descriptor, so a swap to a symlink is not followed. The copy is bounded by the file's size at open time. The module documents its limits: a symlinked parent directory is still followed, and the check and the unlink are not atomic. Windows does not wire automated quarantine yet.
  • Isolation. The host firewall plan always keeps the control-plane endpoints reachable and caps their number (isolation.rs).

What is not defended

  • A kernel-mode adversary (a loaded malicious or vulnerable signed driver, a rootkit) defeats every user-mode control on this page. Closing that gap needs a kernel component per OS: Windows driver and PPL (#27), and the macOS Endpoint Security system extension for tamper resistance (#42). Until then, the defense is making the move into the kernel loud, plus the server's check for silent agents.
  • The kill-both-fast race. An adversary at the same privilege level who kills the agent and the watchdog in a tight loop gets a short window, bounded by the restart interval. User-mode restarts cannot close it.
  • Admin or root uninstall. A legitimate uninstall and a malicious one look the same. What tells them apart is the recorded actor and the timing, not the act.
  • A kernel stop through resource limits (prlimit CPU limit, memory.max OOM kill, cgroup.freeze) aimed at a security tool is only partly covered on Linux (#49). The rules read the command that sets the limit: systemctl set-property (a memory or task limit, or a CPUQuota below 10 %), systemctl freeze, and prlimit --pid on a listed tool, and a write to a limit file (memory.max, memory.high, pids.max, cpu.max, cgroup.freeze, and the cgroup v1 equivalents) in the cgroup of a listed unit. The OOM kill that follows raises no alert on its own: the kernel sends SIGKILL as SEND_SIG_PRIV, so there is no sending process to attribute, and the signal probes drop it by design. Reporting it would take a new probe on the OOM victim, which is not built. Not verified: whether such a probe is usable on every supported kernel. A command line the rules cannot read (an option cluster such as prlimit -tp, an empty argv) and a limit set by a means no rule reads (a process that writes the file through a path the rule cannot map to a unit, or a binary that calls prlimit64(2) / setrlimit directly: there is no prlimit64 tracepoint) are not seen either. The path case includes a bare file name after a cd into the unit's cgroup (cd <cgroup> && echo 1 > cgroup.freeze): the open reaches the event stream but carries no unit, and the event has no working directory (lab-run on kernels 5.14 and 7.2). These limits stay documented rather than built away: closing the path case means capturing the working directory or the resolved path in the probe, a wire-format and verifier change (a field in sensor-linux-wire's FileOpenEvent, so a WIRE_VERSION bump) for a tripwire that reads how a limit is set, not a barrier. A userspace fallback that reads /proc/<pid>/cwd on the drain task, as resolve_dirfd_path does for relative rename paths, was rejected: the open event has no dfd, so an openat relative to a directory fd would resolve against the cwd into a wrong absolute path, which is worse than a relative one by that function's own rule, and a short-lived sh exits before the readlink. The kernel's own kill (OOM or CPU rlimit) has no sender to attribute, and a probe on its victim is unverified across the supported kernels. A lab capture that shows either is usable on all supported kernels is the reason to reopen them.
  • Local-only deployments have no server-side silence detection, and their evidence never leaves the host.
  • Unsigned updates on Windows and macOS. Self-update is Linux-only today (#60). Packaged binaries are not yet Authenticode-signed (#55) or notarized (#26).
  • Windows install-directory check. The Unix world-writable-directory refusal has no Windows equivalent (a DACL audit). The MSI's Program Files default is the only mitigation.

Supply chain hygiene

  • deny.toml: RUSTSEC advisories and yanked crates fail the build. Ignored advisories must still match something in the dependency tree, or CI fails, so an ignore cannot go stale. Licenses come from an allow-list, and wildcard version requirements are denied.
  • Dependency direction is enforced by tools/check-deps.py. Sensor crates depend only on schema and their platform's shared crates, so a sensor cannot reach the transport or the updater.
  • Platform-specific code is confined to sensors, the updater, and the narrow quarantine descriptor helpers.
  • GitHub Actions are pinned by commit SHA, and checkout does not persist credentials.

How it is tested

PropertyTest
Packaged build has no test keytools/check-no-test-key.sh (CI), unprovisioned_build.rs
Unprovisioned key fails closed for every manifest kindunprovisioned_build.rs
Key roles distinct, key files well-formedunit tests in key.rs
Test-key refusal and its messagesunit tests in trust.rs and release.rs
Cleartext secret rejectedcleartext_secret_is_rejected_as_secret_invalid in load.rs; secret.rs tests
Private CA pinningtransport/tests/private_ca.rs
IPC authorization and framing capunit tests in stream.rs and frame.rs. tests/e2e.rs skips when it runs unprivileged
Never-panic parsersrobustness suites and fuzz targets above
Kill guardunit tests in kill.rs
Hardened Windows service DACLunit tests in service/windows.rs
Kill-loudness end to endNot unit-tested (the flow terminates the process). Validated by hand on a lab VM