What it is
The threat model is a hijacked package. An npm postinstall, a PyPI wheel, an AUR PKGBUILD, an editor extension — running as you, with your permissions, reading credentials out of $HOME and arranging to run again after a reboot. It does not need an exploit; you invited it.
Moat is not a rootkit hunter and not a server EDR. It watches the handful of things that shape of attack must do, correlates them, and asks you about the sequence rather than the steps.
Two additions since that model was written. Local privilege escalation is now watched at the four points this kind of machine actually presents — writes under /proc/sys, capabilities gained at runtime, uid transitions, and root-executed config nothing else looks at — because the outcomes of an escalation were covered well and the escalation itself was not. And decoy files invert the usual problem: every other file rule watches a real secret and then subtracts the programs allowed to read it, which is where the false positives live, while a decoy has no legitimate reader at all.
How it works
The sensor is upstream Tetragon and is never forked — Moat ships policies for it and makes sense of what comes back. Two parts sit outside that loop: the install-time scanners, which read a signed malicious-package index offline before a package manager runs anything, and the decoy files, which are ordinary paths the kernel watches like any other. The same signed feed carries a second list — about 48,000 malicious domains — which is matched against the hostname behind each outbound connection.
flowchart TB
subgraph K["kernel"]
EBPF["eBPF programs
LSM hooks · kprobes"]
end
subgraph S["sensor — upstream Tetragon"]
TG["tetragon"]
POL["/run/moat/policies
51 rendered policies"]
LOG[("/var/log/moat/tetragon.log
JSON export")]
end
subgraph D["moatd — root daemon"]
RULES["rules + scoring
provenance · context · rarity"]
CHAIN["chain correlation"]
BASE["baseline + noise guard"]
GATE["kill / containment gate"]
end
subgraph U["yours"]
STORE[("/var/lib/moat/alerts.jsonl
append-only")]
CTL["moatctl"]
PANEL["shell panel"]
end
SHIM["sandbox shims
npm · pip · cargo · go · makepkg"]
SCAN["scanners
read, never execute"]
FEED[("/var/lib/moat/feeds
malicious-package index · domain list
signed · refreshed every 15 min")]
CANARY["decoy files
/etc · /root · $HOME · tmp"]
EBPF --> TG
POL --> TG
TG --> LOG
LOG --> RULES
RULES --> CHAIN
CHAIN --> BASE
BASE --> STORE
CHAIN --> GATE
GATE -.->|"writes a narrow deny policy"| POL
STORE --> CTL
STORE --> PANEL
CTL -.->|"control socket 0660 root:moat"| D
PANEL -.-> CTL
SHIM --> SCAN
FEED --> SCAN
SHIM -.->|"runs the real tool"| EBPF
CANARY -.->|"a read is the alert"| EBPF
Solid arrows carry events; dotted arrows carry decisions. Note the loop at the gate: when a correlated sequence is confident enough, moatd writes a new policy naming one binary and one address, and Tetragon enforces it in the kernel — no userspace round trip on the blocking path.
Why the split matters
Anything the kernel can decide alone is instant: a policy that denies an operation returns EPERM at the hook, before the syscall completes. Anything needing correlation is after the fact — moatd learns about an event by tailing an export file, measured at roughly 340 ms from event to action. That is fast enough to cut a second connection and kill a scanner mid-sweep; it is not fast enough to beat a single exfiltration POST, and no userspace agent is.
What needs sudo
One rule: reading never needs root; weakening protection always does. Evidence behind a password prompt does not get read, and a prompt for trivia teaches people to wave through the prompt that matters.
| free | Everything that looks. status, list, explain, chain, decisions, baseline list, allowlist, contain, receipts, incidents. |
| free | Acking. The commonest action there is. It deletes nothing — the log is append-only — so the defence is attribution: every ack records who asked, and clearing more than 64 at once raises a protection-change alert. |
| free | Dismissing a proposal, and restoring a rule or a watched binary. Refusing an offer and putting protection back weaken nothing. |
| sudo | Allowlisting — ignore, unignore, baseline accept. All three write the same kind of entry, and it stops future detection. |
| sudo | The switches — set mode, set contain, set kill, set sandbox. Gated in both directions: arming SIGKILL is as consequential as disarming it. |
| sudo | Forgetting a destination. The cheapest way to make Moat stop mentioning a host, so it is gated and recorded. |
| free | set digest — the one switch that is not. A weekly summary is a preference, not a protection. |
In the panel these are the same gates. A toggle that needs root opens Omarchy's own polkit dialog; cancelling it is a perfectly ordinary answer and the control snaps back with an explanation rather than silently failing.
moat group, because they are running as you. That is why the gates sit at "changes what Moat does next" rather than at "touches Moat at all".The panel · Now
Three tabs and a gear. Now is where ~95% of visits end, and on a quiet day it should read like a sentence, not a console.
The verdict block
A single coloured dot and one line — “Nothing needs you.” — with a sub-line saying what was looked at and what happened to it. The dot is the only colour on a quiet page.
What it watched today
Four or five rows, each a category in plain words, what actually happened, and a state word: expected, explained, contained, needs you. The state word carries the only other colour, and only when it is asking for something — reassurance that shouts is noise.
An incident card
When something does need you, it opens as a card rather than a row: what happened, the process ancestry, the evidence, and — if a credential was readable — what that program could read, phrased as a fact with the rotation advice conditioned on your judgement, not shouted as an order.
Actions on a card:
| This was me | The answer nine times in ten. Offers a scope: this binary, this binary and directory, this parent, or the whole rule. Writes the allowlist entry and closes the incident. sudo |
| Close it | Acks every member of the card, in one request. It does not allowlist anything, and the same thing will ask again. |
| Only warn me | Demote this one rule to the timeline. Scoped to the rule, not the machine. |
| Copy as text | The whole incident as plain text, for pasting into a ticket or an agent. |
| Ask Moat | Bundles the incident and hands it to your default agent for a plain-language verdict. |
The footer strip
The two facts that change what Moat does are sentences — “Watching, not blocking”, “Still learning your machine — 7 days left”. Machine counters sit far right in the dimmest colour. There is deliberately no backlog counter: a number of unread alerts is a to-do list you never asked for.
The panel · History
A history of Now — not of everything the kernel said.
This screen shows what Moat put in front of you. On a working machine roughly 97% of what the sensor reports is filed to the timeline and deliberately never surfaced — a normal desktop generates about one such event a second. Showing those here buried the record of what Moat showed you under the record of what it merely noticed. The complete stream is still written to alerts.jsonl untouched, which is what the log shipper sends to a SIEM; this screen is not that, and no longer pretends to be.
Filter chips across the top — Shown to you (the default), Needed you, Silenced by a rule, Everything Moat saw — then day groups, each headed with a one-line summary (“1 needed you · 3 explained · 41 covered by a rule”, or simply “nothing needed you”). Nothing is hidden: the last chip is the old firehose, one click away.
Severity is a 3px tick and text brightness, not a badge: a full page of history carries at most one red mark. Repeat counts and the covering rule are appended inline and dimmed — “· 68 times”, “· covered by: your SSH tools”.
Opening a row gives the same detail as an incident card, plus what led here — the chain, in order, with times, and which steps were triggers versus context you had already allowed.
The panel · Rules
Everything Moat has been told, and everything it is doing on its own judgement.
| Yours | Deliberately first. Each entry says when you added it, after how many alerts, and — the column that matters — how many it has silenced since. That number is the only way to tell whether a rule you wrote was a good idea. Undo on every one. |
| Waiting for you | Baseline proposals. A proposal carrying a NOTE is one Moat is not vouching for — the noise guard has quietened that pattern repeatedly and is offering to make it permanent. The block looks identical either way, so the note is the difference. sudo to accept, free to dismiss. |
| Refusing now | Live containments: which binary may not reach which address, and until when. Release any of them here. |
| Allowed to stop | Which rules are armed to block rather than report, with a per-rule switch. sudo |
| Holding | Quarantined files, with where each came from and a restore. |
| Came with Moat | The shipped rules, grouped into recognisable names — “Your SSH tools”, “Your package manager”, “Browsers” — rather than 40 near-identical cards. Replaced on upgrade, and the caveat is stated once. |
The panel · Settings
Daemon options rewritten as questions. Everything here except notifications needs root.
| Stop things? | “Should Moat stop things, or just tell you?” — Just tell me / Stop things. The help text says plainly that a wrong guess kills a real program mid-write, and to stay on telling-you until Rules has been quiet for a week. sudo |
| Cut a sequence | “Cut off a sequence Moat is sure about” — the network cut. One binary, one address, ten minutes, auto-released. Nothing is killed. sudo |
| And the programs? | Appears only when the above is on: Nothing / Write down what it would end / End them. “End them” is deliberately the dull chip — it is the option whose worst case you cannot see from this screen. sudo |
| Check and sandbox package installs | Two things, one switch. Installs are checked against the malicious-package feed first — a match stops the install — and then npm, pip, cargo, go and makepkg run under bubblewrap without your credentials in reach. Left off, the feed still refreshes and nothing reads it. Needs a new login shell. sudo |
| Plant decoy files | Fake credentials in /etc, /root, your home and the temp directories, with different names on every machine. Nothing has a reason to open one, so this is the only rule with no allowlist and nothing to tune: a read is the alert. Shows the count, and turns red if decoys have been deleted from disk — the rule still reports armed but cannot fire for those. sudo |
| Refuse the read as well | Arms the decoy rule: the open itself fails with a permission error and the bytes never reach the caller. Denies rather than kills, because the one false positive this rule has is a backup. Greyed out until decoys exist. sudo |
| Interrupt me | Anything odd / Only if it needs me / Never, with the cooldown stated underneath as a fact rather than a second control. |
| Weekly note | The digest. A preference, so no root. |
| Advanced | Collapsed: show rule-covered events, raw severities, policy paths. Implementation details, kept out of the way. |
How learning works
Four mechanisms, deliberately separate, because they answer different questions. None of them grants trust for repetition alone.
1 · Rarity — “has this happened here before?”
Per-tuple counters with a 30-day half-life: first_seen, rare, common. Rarity is evidence, never a severity change on its own. Familiarity also has to be earned across time, not in a burst — sightings must be spread over at least an hour, because a payload that connects four times in ten seconds is not a host you know.
2 · Provenance — “where did this program come from?”
A binary owned by a signed repo (core, extra, multilib, omarchy) is official and earns one step of softening on persist, priv, exec and net. Never on cred, rootkit or shell — an official binary reading your SSH key is still worth a look. AUR is deliberately excluded: “pacman owns it” is not trust.
3 · The noise guard — the circuit breaker
A single (rule, actor, parent, directory) pattern firing more than 20 times in 24 hours is demoted to the timeline. Not the rule — the pattern, so a shape nobody has ever seen stays on the badge. It clears itself after a quiet day, and it forgets on purpose. When the same pattern has been quietened three times, Moat offers it as a proposal rather than repeating the cycle forever.
4 · The baseline — the seven-day window
A pattern that is medium or low, from an official actor, recurring on three distinct days, with rarity common, is written straight into baseline.toml during the first week. After the window it becomes a proposal you approve instead.
Tiers, and what reaches you
Rules are detection or signal. A signal rule keeps its severity and still feeds chains, rarity and the baseline — it simply never asks you a question on its own. “A binary ran from /tmp” is a signal; the same event inside a correlated sequence is a detection. That is why the status line separates needs you from recorded.
Chains
A chain forms when one process tree produces two or more non-allowlisted findings, crossing two or more families, at least one medium or worse, at least one new on this machine. An allowlisted step joins as context — visible in the story, unable to raise the alarm, because your allowlist is consent.
Tuning
The first day is the loudest: rarity knows nothing and the baseline has not learned. Most of it settles without you.
Start by reading the ledger, not the list
needs you 7 (recorded 1115, of which 162 signal; suppressed 3425) — only the first number is asking. A large recorded count is the sensor working; a large needs you count is what to tune.
Then find the shape, not the alerts
moatctl --json list --limit 500 | \ jq -r '.alerts[] | select(.acked | not) | "\(.rule)\t\(.process.exe)"' | \ sort | uniq -c | sort -rn | head
Almost always a handful of tuples account for nearly everything. Tune those; ignore the tail.
Choose the narrowest thing that works
| exe+file | This rule, this binary, this directory. Start here. |
| exe | This rule, this binary, anywhere. The usual answer. |
| parent | Anything launched by this parent — a build tool, a test runner. |
| rule | The whole rule. Rarely right; you are turning a detection off. |
Let the machinery do the boring part
Recurring desktop noise will be demoted within minutes and proposed after the third cycle. Signed-repo tooling is learned in the first week. What is left after that is genuinely yours to decide.
When a rule is wrong rather than noisy
If a rule fires on things that are never interesting on this machine, that is a rule problem, not an allowlist problem. moatctl baseline propose <rule> turns its top tuples into reviewable entries in one go.
/tmp paths, which is exactly what a dropper looks like. Those alerts are covered by a shipped allowlist scoped to the test runner's ancestry — not by trusting /tmp, which is where droppers land.Turning it on
Each step is reversible, root-gated and recorded.
- Watch for a few daysLet the noise guard and the baseline do their work. Read
moatctl statusonce a day; you are looking at needs you, not the totals. - moatctl set contain onThe narrow network cut. One binary, one address, ten minutes, auto-released, visible in
moatctl contain. Nothing is killed, and its worst case is one program failing to reach one host. - Arm one rule at a time
moatctl set mode enforce --rule <name>— for a rule whose false-positive surface you have already measured in History. - Only then consider set kill killAfter a week of
moatctl decisionsin which you agree with every line. Two candidate gates were scored against nine real chains on the author's machine: one would have killed an ordinary system update, the other a running coding agent. This is not a switch to flip on faith.
moatctl · two rules
Every action names an alert id, never a pid or a path. You act on something Moat observed and recorded. The id is a ULID like 01M1S9DPBMBYHX5T7S3M0CGCXM.
Every command takes --json, and the shapes are fixed by the contract doc — the panel and the CLI read the same responses.
sudo usermod -aG moat $USER # then log out and back in
The group is what lets you read the alert log and write to the control socket. A new group only applies to a fresh login session.
moatctl status
Is this working, and does it want anything from me.
moatd 0.1.0 mode monitor enforcing moat-cred-etc-shadow-read, moat-cred-ssh-private-key-read, … tetragon running policies 44 (44 loaded in the kernel) feeds 241852 packages, 0 hashes, updated 2026-09-11T14:51Z domains 47755 from ThreatFox (abuse.ch) (seq 1, published 2026-09-11T14:51:56Z) needs you 7 (recorded 1115, of which 162 signal; suppressed 3425) unacked critical 0 high 5 medium 0 low 2 sandbox off socket group moat uptime 9s 162 events, 0 alerts baseline learning until 2026-09-10 0 proposal(s), 30 learned demoted moat-exec-untrusted-home, … (timeline only)
| policies | The two numbers must match. The first is what was rendered to disk, the second what the kernel has pinned. A gap is a silent sensor outage — one cost 25 minutes of blindness while every other surface read “running”. |
| enforcing | Rules armed to block. *** NOT ARMED IN KERNEL *** means Moat asked the kernel and the kernel disagreed; it re-arms once a minute and says so until it clears. |
| needs you | The only number asking for something. |
| domains | The malicious-domain list, matched against the hostname behind each outbound connection. Counted apart from any entries you added to feeds/domains.txt yourself, because they have different owners and different fixes: “no published list yet” means moat-feeds has not installed one, which is a fault; an empty file of your own is not. |
| INERT | A rule that is enabled and structurally cannot fire — reading a sensor field the sensor is not configured to send, for instance. Silence that reads as coverage is worse than a rule that is off, so it is named with the fix. |
Looking
moatctl list no root
Recent alerts, newest last, so the interesting one is at the bottom of your terminal. --limit N (default 20), --since ID — ids are monotonic, so an id comparison is a time comparison.
moatctl explain <ID>
The full record: what happened, why the rule exists, what a normal cause looks like, the ancestry, the evidence, and what to rotate if a credential was read.
moatctl chain [ID]
The sequence an alert belongs to — every step in order, with times, marked trigger or context. With no id, the chains on record. The headline counts triggers only; allowed steps are reported separately.
moatctl rarity <ID>
How unusual this tuple is here, with counts and dates.
moatctl receipts · incidents · allowlist · quarantine
receipts: what each package install actually did. incidents: snapshots taken before anything is killed. allowlist: every merged rule with the index unignore takes. quarantine --list | --restore: files held at mode 000, nothing ever deleted.
moatctl decisions
Every decision the kill gate has made: spared, would-have-killed, killed — with the chain, its families, the reason and the targets.
set kill kill is safe here. Read it before arming, not after. Deliberately unprivileged, and stored in /var/lib/moat/decisions.jsonl rather than the journal — journald is sized by a share of the disk and evicts oldest-first, which is not a retention guarantee you can plan a week of review around.moatctl contain --release CHAIN
What Moat is refusing right now on its own judgement, and how to stop it.
moatctl exclusions --remove rule:binary
Binaries a rule has been told to stop watching in the kernel. This is what “allow this program” means for an armed rule — a userspace entry cannot help there, because the process dies before Moat sees the event.
moatctl canary no root
Decoy files: fake credentials in /etc, /root, your home and the temp directories. Nothing on the machine references them, so unlike every other file rule this one has no legitimate reader and needs no allowlist — a read is the alert, at critical.
| --on | Plant a set. Names differ on every machine, nothing existing is ever overwritten, and it says which places it could not cover. sudo |
| --off | Remove them. Refuses to delete anything that is no longer one of ours. sudo |
| --enforce on|off | On: the read itself fails with a permission error. Off: it is allowed, and alerts. sudo |
moat group. Without sudo you still get how many, which of etc/root/home/tmp are covered, how many have gone missing, and whether reads are refused. See CANARIES.md.moatctl ack [IDS]… no root
Mark alerts as seen. Several ids are answered in one request.
| <id> <id>… | Several, one round trip — how the panel closes a card. |
| --chain | Every alert in the same chain. One decision about a sequence should not leave its other four steps on the badge. |
| --all | Every unacked alert. |
| --rule <R> | Everything from one rule — after a retune, when the old alerts are about rules that no longer exist. |
| --before <ID> | Everything older than that alert. |
moatctl ignore <ID> sudo
Stop alerting on this pattern; writes a [[rule]] block into allowlist.d/user.toml and acks the alert. --scope exe | exe+file | parent | rule, --comment TEXT.
The block is printed before it is written. An allowlisted finding is still recorded and still appears in chains as context.
moatctl unignore <RULE> sudo
Remove the n-th rule from an allowlist file; the index comes from allowlist. --file baseline.toml drops a learned entry.
moatctl kill <ID>
SIGKILL the process tree the alert recorded. Manual and deliberate, separate from the automatic gate.
moatctl forget <DST> sudo
Forget what Moat learned about one destination, so the next connection there is a first contact again. Rarity stores IPv4 as a /24, so this clears the whole block and says how many counters went.
moatctl set <KEY> <VALUE> sudo
| mode | monitor | enforce |
| contain | on | off — may Moat cut the network for a sequence it is sure about. |
| kill | off | log | kill — what containment does to the processes. Ships as log. |
| sandbox | on | off — the bubblewrap shims. Needs a new login shell. |
| digest | on | off — the one key needing no root. |
| --rule <R> | Arm one rule, leaving the daemon-wide mode alone. status --json lists what can be armed under enforceable. |
moatctl baseline <SUBCOMMAND>
| list | Learning state, proposals, learned entries, demoted rules. No root: this is the evidence. |
| accept <ID> | sudo Writes the same entry ignore does, by another route. |
| dismiss <ID> | Refusing an offer weakens nothing. |
| relearn | sudo Restart the window after a new toolchain or job. |
| export | Dump every tuple for review. |
| propose <RULE> | Turn a noisy rule's top tuples into reviewable entries. |
| undemote [RULE] | Go back to watching a rule the noise guard quietened. |
moatctl bundle · analyze · triage
bundle <ID> writes the incident as one markdown document. analyze <ID> hands it to your default agent. triage --run is the unattended pass the user timer runs.
Every process-derived string in a bundle sits inside a fenced DATA block. Not cosmetic: those strings came out of a file believed hostile, and a string constant in a dropper is itself an attack on whatever reads the bundle.
triage --undo <ID> reverses a demotion. The daemon never launches an agent — it runs as root with no session; moatctl does, from yours.The daemon
| moatd config | Print the effective configuration and exit. |
| render-policies | Expand {{HOME}}, write /run/moat/policies, regenerate the export allowlist. |
| telemetry | Show the selectable telemetry classes and what each costs. |
| telemetry --apply | The correct way to restart after a policy change. Validates, renders, re-runs the checker, restarts tetragon then moatd in that order, and verifies the kernel came back by counting what it pinned. |
| wait-sensor | Block until Tetragon has actually loaded the policies — wired as ExecStartPost= so After=tetragon.service means “after it loaded”, not “after it forked”. |
Files & services
| /etc/moat/moat.toml | Configuration: paths, rules, ai, thresholds, net, baseline, context, learning, analysis, incidents, content, digest, telemetry, contain. |
| allowlist.d/user.toml | Your decisions, written by ignore. |
| allowlist.d/baseline.toml | What the baseline learned or you accepted. |
| tetragon.conf.d/ | One flag per file. enable-process-cred is required for the fileless-execution and privilege-raised detections; without it they are live, configured and permanently silent — which is why status reports them as INERT. |
| alerts.jsonl | The alert log, append-only, under /var/lib/moat. |
| decisions.jsonl | Kill-gate decisions. |
| quarantine/ | Held files at mode 000, with metadata. |
| control.sock | /run/moat, 0660 root:moat. |
sudo systemctl enable --now tetragon moatd moat-feeds.timer systemctl --user enable --now moat-digest.timer moat-triage.timer
The user timers are yours, not root's: desktop notifications belong to your session. moat-ship is optional and forwards alerts to an HTTPS collector or syslog.
Scanners — moat-scan-pkgbuild, -npm, -cargo, -pip, -go — run before an install via the sandbox shims, never by you directly. They read; they never execute what they read.