The 32 built-in invariants

Every rule Kefal ships with, grouped by category. Severity is the baseline — it can be tuned per tenant later.

Real vs. stub invariants 12 of these are real — they fully evaluate against the current agent telemetry. 20 are stubs — the rule is defined and the evaluator is wired, but the agent does not yet ship the extended telemetry needed to actually fire it (file scans, auth logs, outbound connections, boot sequence, crontab). Stubs sit ready to activate as the agent's data collection expands; no schema or routing changes needed. Both types are listed here with their intent.

Core (kept across versions)

Novel transition detectedmedium

A transition between two graph nodes is observed for the first time. Catches new attack steps that don't match any historical baseline.

Service running as root with external listening porthigh

A service runs with root privilege and listens on a non-localhost port. Classic privilege-escalation exposure SMBs routinely miss.

Identity appears on multiple hosts simultaneouslyhigh

An identity is logged in on 2+ hosts within 5 minutes. Signature of lateral movement — one credential touching many machines.

Category 1 — Privilege escalation (5)

Process running as root in non-system pathhigh

A root-owned process running from /tmp, /dev/shm, /var/tmp, or /home. Common malware execution pattern.

User gained root access without prior sudo observationhigh

A non-root identity transitions to root activity with no observed sudo or su, suggesting credential compromise or exploit.

New SUID binary detectedcritical

A binary with SUID permissions appears for the first time. Potential privilege-escalation vector.

Service process spawns shellhigh

A known service process spawns sh, bash, zsh, dash, fish, or csh. Typical of reverse shell or command injection.

Multiple failed auth attempts followed by successhigh

Five or more auth failures within 5 minutes followed by a successful login from the same source. Classic brute-force signature.

Category 2 — Lateral movement (4)

SSH connection between internal hostsmedium

An SSH connection is detected between two internal hosts in the same organization. Potential lateral movement if unexpected.

New host-to-host relationship observedmedium

Two hosts that have never communicated before are now linked via a shared identity or service. New lateral path.

Admin tool used on non-admin hosthigh

An administrative tool (psexec, wmic, winrm, ansible, puppet, chef-client, salt-minion) runs on a host not classified as an admin or management server.

Credential reuse across trust boundarieshigh

The same credential appears on hosts in different network segments. Suggests credential theft and lateral movement across trust boundaries.

Category 3 — Persistence (4)

New process at system boot sequencemedium

A process consistently appears at boot that was not in previous boot sequences. Potential persistence mechanism.

Crontab or scheduled task modificationmedium

A change in cron, at, systemd-timer, or schtasks. Common persistence technique.

Binary written to system pathhigh

A previously unseen binary appears in /usr/bin, /usr/sbin, /usr/local/bin, or /usr/local/sbin. Potential backdoor installation.

Hidden process or dot-file servicehigh

A process running from a hidden (dot-prefixed) directory or with a dot-prefixed name. Common malware concealment.

Category 4 — Data exfiltration signals (4)

Outbound connection to previously unseen external IPmedium

A host initiates an outbound connection to an IP never observed before in your graph. Flags novel egress paths.

DNS query tool launched by service processhigh

A service process launches dig, nslookup, host, or drill. Potential DNS tunneling or C2 prep.

Data archiving tool in unusual contextmedium

tar, zip, 7z, rar, gzip, or bzip2 running outside known backup windows or from an unexpected user. Classic pre-exfiltration pattern.

Netcat or socat listening on non-standard portcritical

nc, ncat, socat, or nmap listening on a port outside 22/80/443/8080/8443. Strong indicator of backdoor or reverse shell.

Category 5 — AI-specific threats (4)

API key or token visible in process argumentscritical

A running process exposes what looks like an API key or secret token (sk-, api_key=, token=, OPENAI_API_KEY, etc.) in its command-line arguments — visible to any user on the host via ps.

LLM endpoint contacted by unauthorized processhigh

A process not on the authorized list contacts api.openai.com, api.anthropic.com, api.cohere.ai, or generativelanguage.googleapis.com. Potential data exfiltration via AI.

Model file modified or replacedcritical

An ML model file (.bin, .pt, .safetensors, .onnx, .gguf, .pkl) has been modified or replaced. Potential model poisoning or supply-chain attack.

AI agent process with excessive system accesshigh

A process identified as an AI agent (langchain, autogpt, crewai, generic agent/copilot) has access to sensitive resources (sudo, /etc/shadow, /etc/passwd) beyond its expected scope.

Category 6 — Misconfigurations (4)

SSH root login enabledhigh

The SSH daemon is configured to allow direct root login. Expands the attack surface for brute force and credential theft.

World-readable sensitive file detectedcritical

A sensitive file (/etc/shadow, /etc/gshadow, .env, SSH private keys) has world-readable permissions.

Database service exposed without localhost bindingcritical

postgres, mysql, mongod, redis-server, or memcached listening on a non-localhost interface. Network-level exposure.

Firewall disabled or permissive default policyhigh

No firewall rules detected or default policy is ACCEPT. Host is network-unprotected.

Category 7 — System health indicators (4)

Host unreachable after prolonged uptimemedium

A host that has been consistently reporting stops sending snapshots for 5+ minutes. Potential compromise, crash, or network isolation.

Unusual process count spikemedium

Running process count jumps to 3× historical baseline. Suggests fork bomb, resource exhaustion, or malware spawning.

Agent binary integrity checkcritical

The Kefal agent binary on the host does not match the expected hash. Potential tampering or supply-chain compromise.

Time drift detected on hostmedium

Host clock differs from server clock by more than 60 seconds. Breaks TLS, log correlation, and certificate validation.

Contributing your own invariant

You can submit a new invariant via POST /api/v1/invariants/contribute. Submissions go through adversarial verification (two LLM prompts — constructive and red-team) before being activated for all tenants. If it passes, every Kefal customer gains the detection. See the API reference for the contribution schema.