RMAgent for Windows
You operate a pull-based witness habit on a two-box Windows estate (Windows Server 1 44.197.31.152, Windows Server 2 52.3.242.251), tracking the Administrator and SYSTEM accounts. You do not build a log lake. You do not retire Defender or CrowdStrike. You ask each box a small named question over WinRM, write a one-page case, and write a hole when a box is silent or a hop is stripped.
RMAgent is the knock from the jump host. On the Windows side it is just WinRM with an allowlist; on the jump host it is scripts/lib.py (ask()) plus four tiny .ps1 payloads. There is no agent installed on the targets. There is no actuate.
Canonical architecture: Hyperspace_Security_Observatory.pdf (HT-ARCH-SEC-2026-01). This skill is the estate-specific, Administrator/SYSTEM-scoped child of the security-observatory skill.
Needle tier 0 — offline extraction and drift
Alongside the Laya matrices, every skill in this family can call
needle — a 121M on-device model (Cactus Compute Needle, ~35 MB, no
network, no keys, ~100 MB RAM) installed once on the jump host, never on
the witnesses. It is the free tier of the judgment stack: needle extracts
and compares offline, Laya judges, the LLM reasons.
Two scripts ship in scripts/:
needle_extract.py — typed field extraction from a witness fragment
(count, source_ip, …). Rigid tokens (numbers, IPs) are reliable;
semantic fields are not, so the wrapper validates what it can (:ip,
:int) and blanks anything it cannot trust — never a guess.echo "<attest answer>" | scripts/needle_extract.py user count:int source_ip:ip --json
needle_drift.py — baseline-drift detection via needle's 3072-dim
embeddings: record what an answer normally looks like, score today's
answer against it (similar / drifted / changed, thresholds calibrated
empirically). Separates shape and topic, not field values — value drift
stays the job of the field rules and correlate joins.echo "<routine answer>" | scripts/needle_drift.py record <host>-<question>
echo "<today's answer>" | scripts/needle_drift.py score <host>-<question>
The engine runs in-process on the jump host (the wrapper finds a Python
with cactus-needle — set NEEDLE_PYTHON if it lives elsewhere). No port
is opened, nothing is installed on any witness, and the baselines are
kilobyte holes under ~/.rmagent/needle-drift/, not a lake. On an
air-gapped estate this tier keeps working — and the judgment tier with it: Laya is offline too (pre-seed its HF-cache checkpoint on air-gapped hosts), so no matrix judgment waits for a connected session.
Non-negotiables
- Keep the EDR. Defender / CrowdStrike stays on. Commodity malware is out of this watch. Say so if anyone asks to switch it off.
- Named questions only.
attest, sketch, edges, explain. ask() refuses anything else, and refuses actuate outright. Watch is not actuate. Isolate / disable / revoke is later, dual-controlled, after Phase 0 is proven. Never arbitrary remote script.
- Track Administrator and SYSTEM. Every payload filters to the
track: principals in the inventory (default [Administrator, SYSTEM]). You follow the person/account, not the IP. NAT lies; a hashed LogonId does not.
- Credentials never live in the skill, the inventory, or the case. Read from env (
RMAgent_<ID>_USER / RMAgent_<ID>_PASS) or ~/.rmagent/creds.json (mode 600). Never print them. Never paste them onto a case.
- Do not become a lake. Every answer is capped at 32 KB. Oversized pulls become holes. Do not copy
Security.evtx, Get-WinEvent dumps, or tenant exports home. The case is a one-page blackboard.
- A hole is an answer. Silent box, stripped ticket, missing field, liar —
{asked, empty, why}, same shape as a hop. Do not tight-retry a silent host (lockout). Two missed attests = Critical.
- Cap the walk. depth ≤ 8, fan-out ≤ 3, 2 concurrent hunts, 15 min explain, 50 edges, 5 min cooldown on the same identity. Census may knock 3 boxes at once (all-windows budget); Hunter is serial.
- Authorised estate only. Only WS1 and WS2 (or boxes the user is authorised to administer). A partner box, SaaS you do not tenant, an unmanaged phone, NIBSS — those are holes, not witnesses.
Setup (one time)
1. Jump host (macOS, Linux, or Windows)
The jump host is the trusted desk that knocks. It runs on macOS, Linux, or Windows. pywinrm connects over WinRM from any of them; PowerShell 7 (pwsh) is only needed if you use the optional winrm_pool.ps1 RunspacePool path.
python3 --version # 3.11+
pip3 install pywinrm pyyaml
export SKILL_DIR=~/.agents/skills/rmagent-windows
ls "$SKILL_DIR/scripts"/{census,hunt,case,lib}.py
ls "$SKILL_DIR/scripts/questions/windows/" # attest sketch edges explain netedges
The secrets scrt store unlocks with a master password resolved cross-platform: SCRT_PASS env var (everywhere) → macOS Keychain (macOS only) → ~/.scrt_pass file (first line, restricted — the Linux/Windows fallback). On a Linux/Windows jump host, either export SCRT_PASS=... or create ~/.scrt_pass.
2. Open the door on each Windows witness
NTLM (default, zero-config on AWS): WinRM is already listening on 5985 on
EC2 Windows instances. Just confirm the firewall allows the jump host:
Enable-PSRemoting -Force
Set-Service WinRM -StartupType Automatic; Start-Service WinRM
New-NetFirewallRule -Name "WinRM-5985-JumpHost" -DisplayName "WinRM HTTP from jump host" `
-Enabled True -Direction Inbound -Protocol TCP -LocalPort 5985 -Action Allow
Basic (alternative — only if you set transport: basic in the inventory):
also enable Basic auth and allow unencrypted (workgroup, HTTP 5985):
Set-Item WSMan:\localhost\Service\Auth\Basic -Value $true
Set-Item WSMan:\localhost\Service\AllowUnencrypted -Value $true
The live validation on WS1/WS2 used NTLM and worked with no server-side
changes. For production, prefer HTTPS 5986 or Kerberos in a real domain.
The habit — allowlisted named questions — is unchanged either way.
3. Credentials (env, recommended)
export RMAgent_WS1_USER=Administrator
export RMAgent_WS1_PASS='...' # from your vault / the secrets skill — never commit
export RMAgent_WS2_USER=Administrator
export RMAgent_WS2_PASS='...'
Or store in ~/.rmagent/creds.json (mode 600):
{ "ws1": { "user": "Administrator", "password": "..." },
"ws2": { "user": "Administrator", "password": "..." } }
4. Inventory
cp "$SKILL_DIR/assets/inventory.example.yaml" ./estate.yaml
# edit only if you add a box you administer. Never add passwords here.
The four questions (what each returns, Administrator/SYSTEM-scoped)
| Question |
Payload |
What you get |
What you must NOT get |
| Alive? (attest) |
attest.ps1 |
host, utc, last boot, admin failed logons 60s, admin ok logons 5min, local admin count, SYSTEM remote conns |
a full Security log dump |
| Anything odd? (sketch) |
sketch.ps1 |
admin failed in window, new local admins 24h, running privileged services, new services/tasks |
raw event lists |
| Who did they touch? (edges) |
edges.ps1 |
recent Administrator/SYSTEM logons (time, type, src IP, LogonId, auth package) + explicit-credential uses (4648: who→became→dest) + special-privilege grants (4672: privilege set) + outbound conns owned by them, capped |
the whole connection table |
| What changed? (explain) |
explain.ps1 |
group/service/task/account changes + 4648/4672 (explicit creds, special privs) + WMI event subscriptions (5861 — fileless persistence, ATT&CK T1546.003) + audit-log-cleared (1102 — anti-forensics) + LOLBin spawns with command line (4688) + process spawns by Administrator/SYSTEM in the window, capped |
the whole tenant/ring export |
| What connected? (netedges) |
netedges.ps1 |
SYSTEM/Administrator-owned outbound connections (Sysmon EID3) + DNS queries (EID22). Requires Sysmon with <NetworkConnect>. Does not return LSASS access, thread injection, file creates, or registry sets — that was a false claim; mutation of known persistence keys is regedges |
the full netflow / packet capture |
| What persistence already exists? (attackmap) |
attackmap.ps1 |
ATT&CK-mapped persistence STATE — ~16 registry locations (Run/RunOnce, IFEO, SilentProcessExit, cmd AutoRun, AppCert/AppInit, SSP, Winlogon, Netsh, port monitors, logon scripts). Every finding carries its technique ID |
the whole hive |
| Who turned a latch? (regedges) |
regedges.ps1 |
path-allowlisted Sysmon 13 (Registry value set) on those same latches, tracked principals only, plus sysmon_reg (ok/blind/absent). Watch-only — never writes |
a hive dump or unbounded EID13 |
| What code ran? (pslogs) |
pslogs.ps1 |
PowerShell script blocks (4104) — the actual code being executed, decompiled. An -enc payload appears here as readable text. Requires script-block logging (was already ON on both boxes). NOTE: 4104's UserId field is often empty; blocks are returned unfiltered (capped) because every block is worth reading |
the whole PowerShell operational log |
| What if Sysmon is gone? (kernring) |
kernring.ps1 |
Process + network events from the built-in kernel analytic channels (Kernel-Process/Analytic, Kernel-Network/Analytic) — the no-Sysmon fallback. Also reports sysmon_status (the tripwire). Requires setup step D3. Degraded mode: no process names on net events, no command lines, short ring (minutes not days) |
the whole ETW stream |
edges reads currently-Established connections — a point-in-time snapshot that misses sub-second connections. netedges reads the Sysmon ring (EID3 + EID22 only). Use netedges for transient outbound; use regedges for who SetValue'd a known persistence latch. Both stay pull-only, both capped — no lake. Registry writes are actuate/redteam, never so.
Engine injects $Track, $SinceHours, $Limit as a preamble; payloads read them. No payload is a god-shell.
Operating loop
every 1 min ± jitter → census (attest only; alive + Admin/SYSTEM smoke digest)
every 5–15 min → scout (sketch: new admins, priv services, new tasks/services)
on smell/silence → hunter (edges → explain on hosts with smoke), serial, capped
on High case → human (Judge) pins, closes, or escalates. No isolate from Phase 0.
never → copy Security.evtx, dump rings, tight-retry silent hosts, actuate
Agents are not a SOC. After hours, a human is still on call for Hunter and any explain that touches a person.
Laya-assisted triage and hunt routing
Recurring judgment calls can be made by a fast, typed decision model (Laya, via
the use-laya skill) so they are consistent across sessions and honest about
uncertainty. Two matrices live in decisions/ — review and edit them like any
other allowlist:
triage.json — score a witnessed finding (suspicious / severity / next).
hunt_route.json — pick the next witness question from this skill's
allowlisted set (or hand the hunt to the LLM when unsure). It can never
introduce a question outside the allowlist, and it changes nothing about
watch-only.
echo "<finding fragment>" | scripts/laya_decide.py triage
scripts/laya_decide.py hunt_route --state-file hunt.json
Policy (in each matrix): confidence below 0.5 is flagged ESCALATE — route those
to the LLM or the operator instead of acting on them. Verdicts are advisory;
the standing rules (blind check, capped answers, watch-only) are unchanged.
Scripts
Resolve $SKILL_DIR as the folder containing this SKILL.md.
| Job |
Script |
Notes |
| Minute watch |
scripts/census.py |
pywinrm, max-3 knock budget, 2 misses = Critical |
| Administrator/SYSTEM walk |
scripts/hunt.py |
serial, depth-capped; writes path.json + holes.jsonl |
| Write / list / close a case |
scripts/case.py |
one-page blackboard |
| Allowlisted payloads |
scripts/questions/windows/*.ps1 |
attest / sketch / edges / explain |
| Optional all-pwsh path |
scripts/winrm_pool.ps1 |
Invoke-Command + RunspacePool (max 3), creds from env |
# Census — are WS1/WS2 alive?
python3 "$SKILL_DIR/scripts/census.py" --inventory ./estate.yaml
# Open a case, then walk Administrator/SYSTEM across both boxes
CASE=$(python3 "$SKILL_DIR/scripts/case.py" open --title "admin walk" --principal Administrator)
python3 "$SKILL_DIR/scripts/hunt.py" --inventory ./estate.yaml --since 2h --case-dir "$CASE"
# All-pwsh alternate (only if every door is winrm)
pwsh -NoProfile -File "$SKILL_DIR/scripts/winrm_pool.ps1" -Skill attest `
-ComputerName '44.197.31.152','52.3.242.251' -Ids ws1,ws2 -MaxRunspaces 3
Identifier, pin, hole
| Object |
Contract |
| Hop id |
LogonId (hex) or a work/request id for app hops. Same id across hosts = same session. |
| Ticket / session |
Never store Kerberos/NTLM. The LogonId from a 4624 event is the join, not a secret. |
| If stripped |
Idempotency key, then producer child, then hole. Never join on public IP. |
| Pin |
Auto on 2 missed attests, Hunter walk, human incident. Days (default 14). |
| Hole |
{asked, empty, why} — same shape as a hop. |
What success looks like (Phase 0)
You can read the case aloud in two minutes: hops for ws1 and ws2, any holes written, Security.evtx still on the boxes, EDR still drawing. Fail: you exported Security.evtx, isolated a host, invented a hop, or called a timeout "nothing happened."
Examples
examples/lab-a-live.md — Lab A: attest both, silence one, write the hole.
examples/walk-administrator.md — a full Administrator/SYSTEM hunt across WS1+WS2.
What this skill will NOT do
- No
actuate. ask() returns a hole for it. Isolate/disable/revoke stays with the EDR/IAM and a human.
- No log lake. No
Security.evtx copy. No tenant/ring dump.
- No inventing a witness for a box you do not administer (NIBSS, a partner, a phone).
- No tight retry on a silent host.
- No replacement for the EDR. Commodity malware stays with Defender/CrowdStrike.
Hardening changelog (2026-08-19)
Live-verified bug fixes from a purple-team drill on WS1/WS2:
creds_for() now falls back to the scrt store (env → ~/.rmagent/creds.json → scrt). Previously census.py/hunt.py failed with "no credential" unless env vars were manually exported.
- Census miss-state is now stable at
~/.rmagent/.census_miss.json (was CWD/case-dir — "2 misses = Critical" could never trigger across runs).
attest/sketch match only TargetUserName on 4624/4625 — matching any event field counted SYSTEM-subject events as admin failures (false positives).
sketch.new_local_admins only reports members still in the group — deleted users' 4732 events linger 24h as stale SIDs.
netedges is advertised in the example inventory — fresh installs previously scored max 5/6 on drills.
- Payloads compacted under the WinRM UTF-16LE base64 command-line budget (~8191 chars).
Lateral-movement & persistence additions (2026-08-19, rev 2)
New event coverage in edges and explain, live-verified on WS1:
edges.explicit_creds (4648) — the lateral-movement signal: runas, Invoke-Command -Credential, any explicit-credential logon. Each record shows who → became → dest in one line. Live test found 2 uses on WS1 in a 2h window (EC2AMAZ-8NK9FUP$ → Administrator @ localhost).
edges.special_privs (4672) — the privilege set granted at each admin logon. SeDebugPrivilege = process injection; SeTcbPrivilege = act-as-OS. Anomalous grants are now visible.
edges logons now carry the auth package (NTLM vs Kerberos) — NTLM on a Kerberos-capable box is itself a signal.
explain.wmi_subscriptions (5861) — WMI event subscriptions, the classic fileless persistence (ATT&CK T1546.003), read from Microsoft-Windows-WMI-Activity/Operational. Zero is the healthy steady state; any non-zero is an immediate finding.
explain.identity_changes now include 4648/4672, and hunt.py fires a Telegram smoke alert naming them.
hunt.py output and the case path.json record explicit_creds, special_privs, wmi_subscriptions as first-class hop fields.
Audit prerequisite: 4648/4672 need "Audit Logon" (success) — same subcategory as the 4625 failure auditing. 5861 needs no audit policy; the WMI-Activity operational log writes it when a subscription is created.
Rev 3 — 4688 upgrade, anti-forensics, DNS, and PowerShell code (2026-08-19)
Driven by a live probe of what sources actually exist on WS1/WS2:
- 4688 split into two collections.
proc_spawns (all, capped) stays for volume; new lolbin_spawns filters to LOLBins — powershell, cmd, wscript, cscript, mshta, rundll32, regsvr32, certutil, bitsadmin, msiexec, schtasks, wmic, psexec, curl, tar — and carries CommandLine when command-line auditing is on. "PowerShell ran" becomes "PowerShell ran -enc SQBFAFgA...". Probe showed 3,464 raw 4688s/day on WS1 — the LOLBin cut is what makes it signal instead of noise.
audit_cleared (1102) — the audit log was cleared. The classic anti-forensics move; on a healthy box this is always zero, so any hit is an immediate Critical-grade finding. Telegram alert names it explicitly.
task_events now includes 4699 (task deleted) alongside 4698/4702 — an attacker deleting the task they used is as interesting as creating it.
netedges.dns_queries (Sysmon 22) — DNS queries by tracked principals: the domain a beacon resolves before the connection. Pair a DNS query with the matching netedges connection and you have the full C2 story. Requires <DnsQuery> in the Sysmon config (WS2 had 10 in 24h at probe time; WS1 had none — the config differs per box).
- New question
pslogs (4104) — PowerShell script-block logging: the actual code being executed, decompiled from the script block. This is the highest-fidelity signal in the skill. Probe found it already enabled on both boxes (348/342 events in 24h). Live-tested: returns the real script text. Caveat discovered live: 4104's UserId/Path Data fields are often empty (the user lives in the event's Security descriptor), so blocks are returned unfiltered and capped — every block is worth reading, unlike a process count. Each block's text is truncated to 500 chars to respect the 32 KB answer cap.
hunt.py prints and records all of it; Telegram smoke alerts name the new signals (audit-cleared gets an explicit "anti-forensics!" flag).
Prerequisites for the new signals: 4688 command lines need auditpol /set /subcategory:"Process Creation" /success:enable plus the registry key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit\ProcessCreationIncludeCmdLine_Enabled = 1. 4104 needs script-block logging (Group Policy: Administrative Templates → Windows Components → Windows PowerShell → PowerShell Script Block Logging; or the registry equivalent under HKLM\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging). Sysmon 22 needs the DnsQuery rule in the config.
Rev 4 — kernring: the no-Sysmon fallback (2026-08-20)
Why: sophisticated attackers target Sysmon specifically — Stop-Service Sysmon64; sc.exe delete Sysmon64 — and if Sysmon is your only process/network ring, that one command blinds you. The kernel analytic channels are built into Windows, have no obvious service to stop, and give you a degraded but functional ring when Sysmon is gone.
What was added:
- New seventh question
kernring — reads Microsoft-Windows-Kernel-Process/Analytic (process start/stop with PID, image, parent PID, and command line where available) and Microsoft-Windows-Kernel-Network/Analytic (TCP/UDP connect with PID, dest IP, dest port). Also reports sysmon_status in every response.
sysmon_status tripwire in attest — every census now reports whether Sysmon is Running, Stopped, or not-installed. A change from Running to anything else is a finding: either the sensor died or someone stripped it. This is the signal that tells you when to fall back to kernring.
hunt.py fires a Telegram smoke alert when Sysmon is not running — "the primary ring is down; kernring is the fallback."
- Setup step D3 —
wevtutil sl Microsoft-Windows-Kernel-Process/Analytic /e:true and the Network equivalent, wired into the setup docs alongside D1 (auditpol) and D2 (Sysmon ring).
The honest fidelity gap (documented, not hidden):
|
netedges (Sysmon) |
kernring (kernel channels) |
| Process name on network events |
✅ |
❌ PID only — must join |
| Command lines |
✅ |
⚠️ version-dependent |
| Process hashes |
✅ |
❌ |
| Stable GUIDs / parent chains |
✅ |
❌ PID-based, PIDs recycle |
| Ring depth |
Days (configurable) |
Minutes (small fixed buffer) |
| Survives Sysmon deletion |
❌ |
✅ |
Design decision: kernring is a separate question, not a silent fallback inside netedges. If netedges silently degraded, the operator would think they're getting Sysmon-quality data when they're not — a lie by omission that violates the "a hole is an answer" principle. The operator asks the question that matches the fidelity they need.
Status: LIVE-VALIDATED 2026-08-25. Ran against both WS1 and WS2 (estate reachable): kernring returns process events from the kernel analytic channels with the expected fields, and reports sysmon_status on every call (Sysmon64=Running on ws1, Sysmon=Running on ws2). Reality check discovered in live testing: on this estate the kernel channels are NOT enabled as a persistent ring — the payload works as a 10-second burst capture (burst_seconds: 10, note: "burst capture - 10s window, not a ring. Sysmon is the ring."), not the minutes-deep ring the design assumed. To get a persistent ring, setup step D3 (wevtutil sl Microsoft-Windows-Kernel-Process/Analytic /e:true) must be run on each box first; until then kernring is a spot-check, not a fallback ring.
Rev 5 — attackmap + ATT&CK tagging + expanded LOLBins (2026-08-21)
Source: BLUESPAWN's ATT&CK-mapped hunt registry (github.com/ION28/BLUESPAWN, MIT license). We took the knowledge — the registry locations, the technique mappings, the LOLBin list — and reimplemented it pull-only. We did not take the agent, the YARA scanning, the process-memory scanning, or the mitigation system. Those violate the architecture.
What was added:
- New eighth question
attackmap — an ATT&CK-mapped persistence STATE check. Reads 13 registry locations BLUESPAWN enumerated: Run keys (T1547.001), IFEO debuggers (T1546.010), AppCert DLLs (T1546.009), AppInit DLLs (T1546.010), Security Support Providers (T1547.005), Notification packages (T1547.002), Winlogon hijack (T1547.004), Netsh helpers (T1546.007), port monitors (T1547.010), logon scripts (T1037.001), recent accounts (T1136.001), disabled firewall profiles (T1562.004). Every finding carries its technique ID.
- Why state, not events:
explain catches when persistence is CREATED (4698, 7045, 4720). attackmap catches persistence that ALREADY EXISTS — including anything that predates our monitoring window or was staged before rmagent was installed. This is the "what was already on the box when we started" check.
- ATT&CK tags on existing findings.
sketch now returns admin_failed_attack='T1110', new_local_admins_attack='T1136.001', new_services_attack='T1543.003', new_tasks_attack='T1053.005'. The operator sees not just "a task was created" but "T1053.005: Scheduled Task persistence."
- LOLBin list expanded 18 → 80 (from BLUESPAWN's curated list). Adds
msxsl, installutil, msbuild, forfiles, diskshadow, dnscmd, cmstp, msdt, odbcconf, pcalua, rasautou, regasm, regsvcs, runscripthelper, scriptrunner, syncappvpublishing, tttracer, verclsid, wab, xwizard, appvlp, bginfo, cdb, csi, devtoolslauncher, dnx, dotnet, dxcap, mftrace, msdeploy, rcsi, sqlps, sqltoolsps, squirrel, te, tracker, update, vsjitdebugger, wsl, and more.
hunt.py integration: attackmap prints N/13 ATT&CK techniques with findings, lists each technique found, records checked/found as hop fields, and fires a Telegram smoke alert for high-severity techniques (IFEO hijack, SSP, Winlogon hijack, AppCert, firewall disabled).
What we deliberately did NOT take from BLUESPAWN:
| Left out |
Why |
| The agent |
Installs a service on every box. We are agentless by design. |
| YARA file scanning |
Requires reading file contents off the box. Violates the no-lake rule. |
| Process memory scanning |
Needs kernel access or an agent. Out of scope. |
| Their mitigation system |
20+ hardcoded registry changes with no dry-run, no journal, no undo. The Actuator does this properly. |
| Real-time ETW monitoring |
Requires a persistent consumer process = an agent. kernring is our answer. |
| The C++ implementation |
~16 hunt files, thousands of lines. We took the knowledge, not the code. |
Status: LIVE-VALIDATED 2026-08-25. Ran against both WS1 and WS2: attackmap returns findings with ATT&CK tags on both boxes (ws1: T1547.001 run_keys ×1, T1546.007 netsh ×17; ws2: T1547.001 ×2, T1546.007 ×17). The full 8-signal redteam drill confirmed attackmap catches the staged drill artifacts: run_key drill: True, ifeo drill: True on both boxes (the two new Rev 5 signals). Drill artifacts cleaned up cleanly afterwards (0 remaining).
Rev 6 — RTerm observability integration notes (2026-08-25)
No skill changes required. Documented so operators know what's already available.
RTerm (v3.2.14+) now ships OpenLLMetry-style LLM tracing: every model call the
agent makes while running an rmagent hunt (the explain/sketch analysis
passes, the completion audits) is recorded as an APM span in RTerm's trace
store, grouped per agent run. That means:
- Hunt latency is already observable.
rterm call observability:apmSummary
shows llm.chat / llm.thinking / llm.audit.* spans with p50/p95 latency —
how long the LLM analysis of each hunt took, per run, with zero config.
- No new question needed. The skill's job is asking the boxes questions;
RTerm's tracing covers the agent's own work automatically. Adding a
trace question would duplicate what the platform already does.
- The skill stays dependency-free. It deliberately has no RTerm/OTel
imports — it runs standalone with just pywinrm. Tracing happens around it,
not inside it.
- If you want hunt results in an external APM (Jaeger/Tempo/Datadog), set
OTEL_EXPORTER_OTLP_ENDPOINT on the RTerm backend — LLM spans forward with
standard gen_ai.* attributes. Host metrics push on the same endpoint.
This is RTerm configuration, not a skill change.
What is NOT traced: the WinRM knocks themselves (they're pywinrm calls
made by the skill's scripts, outside RTerm's agent loop). Their timing lives
in the case hops (asked/answered timestamps) — by design, the case file is
the record.
Rev 7 — external half: netexec-bridge closes the purple-team loop (2026-08-25)
RTerm v3.2.15 ships netexec-bridge, the outside view that rmagent lacked.
The drill previously staged artifacts on the boxes; now you can also
simulate the external attack (credential spray from outside) and verify
attest catches the resulting 4625s.
How the two halves fit:
|
rmagent (inside) |
netexec-bridge (outside) |
| Direction |
pull from the boxes |
push at the boxes |
| Sees |
4625s, 4720s, new services/tasks, registry state |
auth success/failure per host |
| Governance |
allowlisted questions, authorized estate |
target allowlist required per call (CIDRs ok) |
| Credential handling |
env / creds.json / scrt |
env:<vaultRef> — never the secret |
Recommended drill extension: use netexec_spray_plan (rate-limited,
jittered, SLOW — does not execute) to review the schedule first, then
netexec_check against the SAME authorized estate. Immediately after, run
attest on each box and confirm admin_fail_60s rose. That is the full
outside→inside detection loop, scored end to end.
Same rule as always: authorized estate only. netexec denies by default —
empty or missing allowlists are refused, and every comma-separated target is
validated individually (no batch bypass).
Rev 12 — correlation, drift, FP allowlist, score history, Linux sibling (2026-08-29)
Eight improvements, live-validated against WS1/WS2:
Cross-witness correlation (scripts/correlate.py) — the biggest gap.
Every question ran per-box, but the drill's thesis is lateral movement.
correlate.py joins edges/netedges answers across witnesses and surfaces:
- cross-host-account — same account logged on to both boxes in the window
- lateral-hop (critical) — WS1 connecting to WS2's address or vice versa
- explicit-cred-to-peer — 4648 on one box naming the other
- shared-logonid (critical) — same LogonId on two boxes (stolen session/PTH)
hunt.py now runs correlation automatically at the end of a walk and writes
correlation.json into the case. record_ask persists full answers to
case/answers/*.json so correlation is pure post-processing (no re-pull).
Baseline + drift (scripts/drift.py) — attest is point-in-time; the
sharper question is who became admin since last week. First run records a
baseline (~/.rmagent/baselines/<id>.json, mode 600); later runs diff:
new/removed admins, Sysmon status change, attackmap techniques that grew or
shrank. --reset re-baselines.
Time-windowing — --since now accepts 30m / 2h / 24h / 7d on
hunt/correlate/drift (was h-only). Drill comparisons and drift checks are
meaningful instead of "recent".
attackmap FP allowlist — live validation showed T1546.007 netsh ×17
on both boxes: OS-default netsh helper DLLs, not persistence. The payload
now suppresses known-good values for T1546.007 (netsh helpers), T1547.005
(default SSPs), T1547.002 (default auth notification packages). A real
netsh helper with a non-default name still fires.
Score history + regression alert (redteam.py) — every drill appends
to ~/.rmagent/drill_history.jsonl. If the score drops vs the previous
run, it prints AND Telegram-alerts the lost signals — catching the failure
mode where a Windows update or GPO silently disables 4688.
Auto-scheduled attest — RTerm scheduled task (cron */30 * * * *):
python3 ~/.agents/skills/rmagent-windows/scripts/drift.py --inventory <estate>
→ findings into the trigger pipeline → Telegram. Turns the witness from
"ask me" into "watch and page". Create via manage_scheduled_task.
ETW AutoLogger for kernring — documented as an estate change (MOP,
not Phase 0): wevtutil sl Microsoft-Windows-Kernel-Process/Analytic /e:true
as a standing session catches between-poll events. Not enabled by default.
Linux sibling (~/.agents/skills/rmagent-linux/) — same engine, SSH
door, five questions (attest/sketch/edges/explain/attackmap) reading
journald/auth.log/ss/systemd/cron. Makes the observatory multi-plane.
macOS paths documented as experimental.
Status: LIVE-VALIDATED 2026-08-29 — correlate + drift + attackmap allowlist
run against WS1/WS2 (see Rev 8 validation notes in the case dir).
Rev 13 — the audit-blindness lesson: verify the witness can see (2026-08-29)
Two live findings from re-validating Rev 8, both silent false negatives:
correlate.py joined on the wrong field names. The unit tests used a
synthetic logon_id shape, but the LIVE edges.ps1 payload emits
lid / user / src / who / became / dest. Every join key was
wrong, so shared-logonid and lateral-hop could never fire — and the
suite still printed "ALL UNIT TESTS PASSED". Fixed to read the live shapes
(verbose TargetUserName/LogonId kept as fallbacks). The tests now use
the live payload shapes. Lesson (again): a unit test with a synthetic
shape proves nothing about the wire. Always join against a real answer
file from cases/*/answers/.
WS2 was audit-blind on 12 subcategories — Logon was Failure-only,
Logoff/Special Logon/Other Logon/Logoff/Group Membership/
Account Lockout were No Auditing, while WS1 had Success+Failure on all.
Result: edges on WS2 returned zero logons while an Administrator
WinRM session was actively connected — and correlate reported a "clean"
estate. That is the worst failure mode: not an error, an empty answer
that looks like good news.
Fixed: aligned WS2 to WS1 for the 6 subcategories the questions depend
on (auditpol /set /subcategory:"Logon" /success:enable /failure:enable
…), verified all six show Success and Failure. Baseline saved before the
change (/tmp/audit-baseline.json pattern — record before you touch).
Proof: immediately after, correlate fired
cross-host-account: 'Administrator' logged on to 2 witnesses (ws1, ws2)
— a finding that was structurally impossible 10 minutes earlier.
New standing rule: before trusting any "no findings" result, check the
witness can actually see. A quick blind-check (read-only, one ask per box):
# raw 4624 count in 24h with NO track filter — if this is 0 while you are
# connected, the box is not auditing success logons.
(Get-WinEvent -FilterHashtable @{LogName='Security';Id=4624;
StartTime=(Get-Date).AddHours(-24)} | Measure-Object).Count
auditpol /get /subcategory:"Logon" # must say "Success and Failure"
attest now does this automatically (Rev 13.1). Every attest payload
carries:
raw_4624_24h — unfiltered 4624 count (the number that was 0 on WS2 while
an Administrator session was connected)
blind_check — per-subcategory ok / BLIND / unknown for the six
subcategories the questions depend on (Logon, Logoff, Special Logon,
Other Logon/Logoff, Group Membership, Account Lockout)
blind_count — how many are blind; 0 is the only healthy value
drift.py treats a growing blind_count as a critical finding
(witness_blind) and raw_4624_24h dropping to 0 as a warning
(logon_visibility_lost). A witness going blind is the worst regression
because every other question silently returns empty.
Two implementation notes, both learned the hard way:
- WinRM command budget. attest.ps1 grew past the ~8191-char encoded
budget (preamble+payload × ~2.7 for UTF-16LE base64) and every ask
returned "The command line is too long." — on both boxes, instantly.
The blind_check block is deliberately terse. If you extend attest,
re-check:
len(preamble) + len(_strip_payload(payload)) × 2.67 < 8191.
- auditpol /r CSV columns are MachineName, PolicyTarget, Subcategory,
Subcategory GUID, Inclusion Setting — the policy is field [4], not
[3]. Reading [3] reports every box as blind with GUID strings (a
false positive that looks authoritative).
Status: LIVE-VALIDATED 2026-08-29 — both WS1 and WS2 return
blind_count: 0, all six ok; WS2 raw_4624_24h = 19 (was 0 before the
audit-policy fix).
Rev 15 — the enterprise layer + the skill split (2026-08-30)
The skill is now split. The question half lives in its own skill so it can
be loaded and reasoned about on its own:
| Skill |
Half |
rmagent-windows |
this skill — both halves, fully runnable |
rmagent-so |
the witness-question (Security Observatory) half |
rmagent-fr |
the Flight Recorder (tracing) half |
rmagent-actuate |
Phase 1 response — named, reversible actions |
rmagent-redteam |
the drill — stages artifacts, scores detection |
rmagent-linux |
the Linux/macOS sibling |
All six share one constitution. rmagent-so is the one to load when you only
want to ask questions of the estate.
What rev 15 added (implemented in rmagent-so + rmagent-actuate):
canary — a new question, and a new kind of question. A decoy
identity that exists only to be touched. Any 4624/4625/4740 against it is
critical by definition — there is no business reason to authenticate as
honeyadmin. Decoys are declared in the inventory (canaries: [name,...])
or auto-detected by decoy-name heuristics. This turns patient-zero
detection from a graph walk into a tripwire.
canary_watch.py — the standing tripwire. Polls the canary question
every 60s, alerts once per NEW hit (dedup by timestamp, not cooldown — a
cooldown can hide a second hit), reports unreachable witnesses as holes,
exits non-zero when tripped so cron can chain response. This is what
shrinks the detection window from "whenever a hunt runs" to ~60 seconds.
Run it from cron, not as a daemon:
* * * * * python3 ~/.agents/skills/rmagent-so/scripts/canary_watch.py \
--inventory ~/estate.yaml --once --quiet >> ~/.rmagent/canary_watch.log 2>&1
plant_canary (actuate) — arm the tripwire. Creates a disabled
decoy account: it can never log on, so it cannot be used as a foothold,
but Windows still records every attempt against it. Complexity-safe
random password (GUID hex fails password policy on some boxes).
patient_zero.py — the backward walk with honest termination. Labels
how the walk stopped — origin / retention-boundary / blind-witness /
no-signal / cycle / hop-limit — and refuses to name a patient zero it
cannot prove. Uses the new attest.oldest_security_event to tell "reached
the origin" from "ran out of log". Those two look identical without it,
and reporting the second as the first is a confident wrong answer.
Signal-aware cap. An over-budget answer is now TRIAGED, not dropped:
low-signal rows shed first, rows carrying critical event IDs (4648, 4672,
5861, 1102, 4104, 4698, 7045, 4732, 4688) always survive. The 32 KB cap
is never raised — we only choose what survives it. Closes the evasion
surface where a noisy host could push the signal past the window.
Triage ranking. Every correlate finding carries triage_rank,
triage_why, and recommended_actions drawn only from the actuator
allowlist. Response order is derived, not improvised.
rotate_credential + isolate_host (actuate). Containment becomes
remediation: rotation breaks the attacker's copy of a credential without
breaking the account's owner. Isolation stops lateral movement without
powering the box off, keeping WinRM open so undo works.
Tests: test_enterprise.py (57 assertions, pure-logic) and
test_budget.py (every payload under WinRM's ~8191-char budget — this
caught attest going 108% over when oldest_security_event was added).
Known limitation, stated honestly: a canary hit cannot be staged from the
jump host. Windows writes 4625 only for real logon-session attempts;
LogonUser/DirectoryEntry API validation does not create one. Proving the
tripwire end-to-end requires a genuine network logon from a second host.
The detection query itself is proven — it reads live 4625s correctly.
Status: LIVE-VALIDATED 2026-08-30 — canaries planted on WS1+WS2 (journal
13, 15), both verified disabled; canary_watch.py runs a clean pass against
both witnesses and sees the armed canaries.
Enterprise scope, sizing & the no-Python (PowerShell-native) kit
Estate scope & sizing (Windows plane)
- Per-witness footprint: zero install. The questions ride WinRM/PSRP;
resident state is only the ETW rings (
C:\etw, default 512/256/128 M
…(truncated)
1---2name: rmagent-windows3description: >4 Pull-based remote-witness habit for a Windows estate — the "RMAgent" knock.5 Ask two workgroup Windows servers (WS1/WS2) eight allowlisted named questions6 (attest, sketch, edges, explain, netedges, pslogs, kernring, attackmap) over pywinrm/WinRM :5985, tracking the7 Administrator and SYSTEM accounts. Use for identity-led compromise, lateral8 movement, living-off-the-land, silent hosts, and honest root-cause on Windows9 boxes you administer — without building a log lake and without switching off10 the EDR. Phase 0 is watch only; there is no actuate. Does NOT replace11 CrowdStrike/Defender. Prefer this skill for the two-box estate and12 Administrator/SYSTEM tracking; use the parent `security-observatory` skill13 for multi-plane (identity, cloud, network) hunts.14metadata:15 source: https://skillmd.com/skills/drolu/rmagent-windows16---1718# RMAgent for Windows1920You operate a **pull-based witness habit** on a two-box Windows estate (Windows Server 1 `44.197.31.152`, Windows Server 2 `52.3.242.251`), tracking the **Administrator** and **SYSTEM** accounts. You do not build a log lake. You do not retire Defender or CrowdStrike. You ask each box a small named question over WinRM, write a one-page case, and write a **hole** when a box is silent or a hop is stripped.2122RMAgent is the **knock from the jump host**. On the Windows side it is just WinRM with an allowlist; on the jump host it is `scripts/lib.py` (`ask()`) plus four tiny `.ps1` payloads. There is no agent installed on the targets. There is no `actuate`.2324Canonical architecture: `Hyperspace_Security_Observatory.pdf` (HT-ARCH-SEC-2026-01). This skill is the estate-specific, Administrator/SYSTEM-scoped child of the `security-observatory` skill.2526## Needle tier 0 — offline extraction and drift2728Alongside the Laya matrices, every skill in this family can call29**needle** — a 121M on-device model (Cactus Compute Needle, ~35 MB, no30network, no keys, ~100 MB RAM) installed once on the jump host, never on31the witnesses. It is the free tier of the judgment stack: needle extracts32and compares offline, Laya judges, the LLM reasons.3334Two scripts ship in `scripts/`:3536- `needle_extract.py` — typed field extraction from a witness fragment37 (`count`, `source_ip`, …). Rigid tokens (numbers, IPs) are reliable;38 semantic fields are not, so the wrapper validates what it can (`:ip`,39 `:int`) and blanks anything it cannot trust — never a guess.40 ```bash41 echo "<attest answer>" | scripts/needle_extract.py user count:int source_ip:ip --json42 ```43- `needle_drift.py` — baseline-drift detection via needle's 3072-dim44 embeddings: record what an answer normally looks like, score today's45 answer against it (similar / drifted / changed, thresholds calibrated46 empirically). Separates shape and topic, not field values — value drift47 stays the job of the field rules and correlate joins.48 ```bash49 echo "<routine answer>" | scripts/needle_drift.py record <host>-<question>50 echo "<today's answer>" | scripts/needle_drift.py score <host>-<question>51 ```5253The engine runs in-process on the jump host (the wrapper finds a Python54with `cactus-needle` — set `NEEDLE_PYTHON` if it lives elsewhere). No port55is opened, nothing is installed on any witness, and the baselines are56kilobyte holes under `~/.rmagent/needle-drift/`, not a lake. On an57air-gapped estate this tier keeps working — and the judgment tier with it: Laya is offline too (pre-seed its HF-cache checkpoint on air-gapped hosts), so no matrix judgment waits for a connected session.5859## Non-negotiables6061- **Keep the EDR.** Defender / CrowdStrike stays on. Commodity malware is out of this watch. Say so if anyone asks to switch it off.62- **Named questions only.** `attest`, `sketch`, `edges`, `explain`. `ask()` refuses anything else, and refuses `actuate` outright. Watch is not actuate. Isolate / disable / revoke is later, dual-controlled, after Phase 0 is proven. Never arbitrary remote script.63- **Track Administrator and SYSTEM.** Every payload filters to the `track:` principals in the inventory (default `[Administrator, SYSTEM]`). You follow the person/account, not the IP. NAT lies; a hashed LogonId does not.64- **Credentials never live in the skill, the inventory, or the case.** Read from env (`RMAgent_<ID>_USER` / `RMAgent_<ID>_PASS`) or `~/.rmagent/creds.json` (mode 600). Never print them. Never paste them onto a case.65- **Do not become a lake.** Every answer is capped at 32 KB. Oversized pulls become holes. Do not copy `Security.evtx`, `Get-WinEvent` dumps, or tenant exports home. The case is a one-page blackboard.66- **A hole is an answer.** Silent box, stripped ticket, missing field, liar — `{asked, empty, why}`, same shape as a hop. Do not tight-retry a silent host (lockout). Two missed attests = Critical.67- **Cap the walk.** depth ≤ 8, fan-out ≤ 3, 2 concurrent hunts, 15 min explain, 50 edges, 5 min cooldown on the same identity. Census may knock 3 boxes at once (all-windows budget); Hunter is serial.68- **Authorised estate only.** Only WS1 and WS2 (or boxes the user is authorised to administer). A partner box, SaaS you do not tenant, an unmanaged phone, NIBSS — those are holes, not witnesses.6970## Setup (one time)7172### 1. Jump host (macOS, Linux, or Windows)7374The jump host is the trusted desk that knocks. It runs on macOS, Linux, or Windows. pywinrm connects over WinRM from any of them; PowerShell 7 (`pwsh`) is only needed if you use the optional `winrm_pool.ps1` RunspacePool path.7576```bash77python3 --version # 3.11+78pip3 install pywinrm pyyaml79export SKILL_DIR=~/.agents/skills/rmagent-windows80ls "$SKILL_DIR/scripts"/{census,hunt,case,lib}.py81ls "$SKILL_DIR/scripts/questions/windows/" # attest sketch edges explain netedges82```8384> The `secrets` scrt store unlocks with a master password resolved cross-platform: **`SCRT_PASS` env var** (everywhere) → macOS Keychain (macOS only) → **`~/.scrt_pass`** file (first line, restricted — the Linux/Windows fallback). On a Linux/Windows jump host, either `export SCRT_PASS=...` or create `~/.scrt_pass`.8586### 2. Open the door on each Windows witness8788**NTLM (default, zero-config on AWS):** WinRM is already listening on 5985 on89EC2 Windows instances. Just confirm the firewall allows the jump host:9091```powershell92Enable-PSRemoting -Force93Set-Service WinRM -StartupType Automatic; Start-Service WinRM94New-NetFirewallRule -Name "WinRM-5985-JumpHost" -DisplayName "WinRM HTTP from jump host" `95 -Enabled True -Direction Inbound -Protocol TCP -LocalPort 5985 -Action Allow96```9798**Basic (alternative — only if you set `transport: basic` in the inventory):**99also enable Basic auth and allow unencrypted (workgroup, HTTP 5985):100101```powershell102Set-Item WSMan:\localhost\Service\Auth\Basic -Value $true103Set-Item WSMan:\localhost\Service\AllowUnencrypted -Value $true104```105106> The live validation on WS1/WS2 used NTLM and worked with no server-side107> changes. For production, prefer HTTPS 5986 or Kerberos in a real domain.108> The habit — allowlisted named questions — is unchanged either way.109110### 3. Credentials (env, recommended)111112```bash113export RMAgent_WS1_USER=Administrator114export RMAgent_WS1_PASS='...' # from your vault / the secrets skill — never commit115export RMAgent_WS2_USER=Administrator116export RMAgent_WS2_PASS='...'117```118119Or store in `~/.rmagent/creds.json` (mode 600):120121```json122{ "ws1": { "user": "Administrator", "password": "..." },123 "ws2": { "user": "Administrator", "password": "..." } }124```125126### 4. Inventory127128```bash129cp "$SKILL_DIR/assets/inventory.example.yaml" ./estate.yaml130# edit only if you add a box you administer. Never add passwords here.131```132133## The four questions (what each returns, Administrator/SYSTEM-scoped)134135| Question | Payload | What you get | What you must NOT get |136|---|---|---|---|137| **Alive?** (attest) | `attest.ps1` | host, utc, last boot, admin failed logons 60s, admin ok logons 5min, local admin count, SYSTEM remote conns | a full Security log dump |138| **Anything odd?** (sketch) | `sketch.ps1` | admin failed in window, new local admins 24h, running privileged services, new services/tasks | raw event lists |139| **Who did they touch?** (edges) | `edges.ps1` | recent Administrator/SYSTEM logons (time, type, src IP, LogonId, auth package) + **explicit-credential uses (4648: who→became→dest)** + **special-privilege grants (4672: privilege set)** + outbound conns owned by them, capped | the whole connection table |140| **What changed?** (explain) | `explain.ps1` | group/service/task/account changes + **4648/4672** (explicit creds, special privs) + **WMI event subscriptions (5861 — fileless persistence, ATT&CK T1546.003)** + **audit-log-cleared (1102 — anti-forensics)** + **LOLBin spawns with command line (4688)** + process spawns by Administrator/SYSTEM in the window, capped | the whole tenant/ring export |141| **What connected?** (netedges) | `netedges.ps1` | SYSTEM/Administrator-owned outbound connections (**Sysmon EID3**) + DNS queries (**EID22**). Requires Sysmon with `<NetworkConnect onmatch="exclude">`. **Does not** return LSASS access, thread injection, file creates, or registry sets — that was a false claim; mutation of known persistence keys is `regedges` | the full netflow / packet capture |142| **What persistence already exists?** (attackmap) | `attackmap.ps1` | ATT&CK-mapped persistence **STATE** — ~16 registry locations (Run/RunOnce, IFEO, SilentProcessExit, cmd AutoRun, AppCert/AppInit, SSP, Winlogon, Netsh, port monitors, logon scripts). Every finding carries its technique ID | the whole hive |143| **Who turned a latch?** (regedges) | `regedges.ps1` | path-allowlisted **Sysmon 13** (Registry value set) on those same latches, tracked principals only, plus `sysmon_reg` (`ok`/`blind`/`absent`). Watch-only — never writes | a hive dump or unbounded EID13 |144| **What code ran?** (pslogs) | `pslogs.ps1` | **PowerShell script blocks (4104) — the actual code being executed**, decompiled. An `-enc` payload appears here as readable text. Requires script-block logging (was already ON on both boxes). NOTE: 4104's UserId field is often empty; blocks are returned unfiltered (capped) because every block is worth reading | the whole PowerShell operational log |145| **What if Sysmon is gone?** (kernring) | `kernring.ps1` | Process + network events from the **built-in kernel analytic channels** (`Kernel-Process/Analytic`, `Kernel-Network/Analytic`) — the no-Sysmon fallback. Also reports `sysmon_status` (the tripwire). Requires setup step D3. **Degraded mode**: no process names on net events, no command lines, short ring (minutes not days) | the whole ETW stream |146147> `edges` reads *currently-Established* connections — a point-in-time snapshot that misses sub-second connections. `netedges` reads the **Sysmon ring** (EID3 + EID22 only). Use `netedges` for transient outbound; use `regedges` for who SetValue'd a known persistence latch. Both stay pull-only, both capped — no lake. Registry **writes** are actuate/redteam, never so.148149Engine injects `$Track`, `$SinceHours`, `$Limit` as a preamble; payloads read them. No payload is a god-shell.150151## Operating loop152153```154every 1 min ± jitter → census (attest only; alive + Admin/SYSTEM smoke digest)155every 5–15 min → scout (sketch: new admins, priv services, new tasks/services)156on smell/silence → hunter (edges → explain on hosts with smoke), serial, capped157on High case → human (Judge) pins, closes, or escalates. No isolate from Phase 0.158never → copy Security.evtx, dump rings, tight-retry silent hosts, actuate159```160161Agents are not a SOC. After hours, a human is still on call for Hunter and any explain that touches a person.162163## Laya-assisted triage and hunt routing164165Recurring judgment calls can be made by a fast, typed decision model (Laya, via166the `use-laya` skill) so they are consistent across sessions and honest about167uncertainty. Two matrices live in `decisions/` — review and edit them like any168other allowlist:169170- `triage.json` — score a witnessed finding (suspicious / severity / next).171- `hunt_route.json` — pick the next witness question from this skill's172 allowlisted set (or hand the hunt to the LLM when unsure). It can never173 introduce a question outside the allowlist, and it changes nothing about174 watch-only.175176```bash177echo "<finding fragment>" | scripts/laya_decide.py triage178scripts/laya_decide.py hunt_route --state-file hunt.json179```180181Policy (in each matrix): confidence below 0.5 is flagged ESCALATE — route those182to the LLM or the operator instead of acting on them. Verdicts are advisory;183the standing rules (blind check, capped answers, watch-only) are unchanged.184185## Scripts186187Resolve `$SKILL_DIR` as the folder containing this `SKILL.md`.188189| Job | Script | Notes |190|---|---|---|191| Minute watch | `scripts/census.py` | pywinrm, max-3 knock budget, 2 misses = Critical |192| Administrator/SYSTEM walk | `scripts/hunt.py` | serial, depth-capped; writes path.json + holes.jsonl |193| Write / list / close a case | `scripts/case.py` | one-page blackboard |194| Allowlisted payloads | `scripts/questions/windows/*.ps1` | attest / sketch / edges / explain |195| Optional all-pwsh path | `scripts/winrm_pool.ps1` | Invoke-Command + RunspacePool (max 3), creds from env |196197```bash198# Census — are WS1/WS2 alive?199python3 "$SKILL_DIR/scripts/census.py" --inventory ./estate.yaml200201# Open a case, then walk Administrator/SYSTEM across both boxes202CASE=$(python3 "$SKILL_DIR/scripts/case.py" open --title "admin walk" --principal Administrator)203python3 "$SKILL_DIR/scripts/hunt.py" --inventory ./estate.yaml --since 2h --case-dir "$CASE"204205# All-pwsh alternate (only if every door is winrm)206pwsh -NoProfile -File "$SKILL_DIR/scripts/winrm_pool.ps1" -Skill attest `207 -ComputerName '44.197.31.152','52.3.242.251' -Ids ws1,ws2 -MaxRunspaces 3208```209210## Identifier, pin, hole211212| Object | Contract |213|---|---|214| Hop id | LogonId (hex) or a work/request id for app hops. Same id across hosts = same session. |215| Ticket / session | Never store Kerberos/NTLM. The LogonId from a 4624 event is the join, not a secret. |216| If stripped | Idempotency key, then producer child, then **hole**. Never join on public IP. |217| Pin | Auto on 2 missed attests, Hunter walk, human incident. Days (default 14). |218| Hole | `{asked, empty, why}` — same shape as a hop. |219220## What success looks like (Phase 0)221222You can read the case aloud in two minutes: hops for `ws1` and `ws2`, any holes written, `Security.evtx` still on the boxes, EDR still drawing. **Fail:** you exported `Security.evtx`, isolated a host, invented a hop, or called a timeout "nothing happened."223224## Examples225226- `examples/lab-a-live.md` — Lab A: attest both, silence one, write the hole.227- `examples/walk-administrator.md` — a full Administrator/SYSTEM hunt across WS1+WS2.228229## What this skill will NOT do230231- No `actuate`. `ask()` returns a hole for it. Isolate/disable/revoke stays with the EDR/IAM and a human.232- No log lake. No `Security.evtx` copy. No tenant/ring dump.233- No inventing a witness for a box you do not administer (NIBSS, a partner, a phone).234- No tight retry on a silent host.235- No replacement for the EDR. Commodity malware stays with Defender/CrowdStrike.236237## Hardening changelog (2026-08-19)238239Live-verified bug fixes from a purple-team drill on WS1/WS2:240241- **`creds_for()` now falls back to the scrt store** (env → `~/.rmagent/creds.json` → scrt). Previously `census.py`/`hunt.py` failed with "no credential" unless env vars were manually exported.242- **Census miss-state is now stable** at `~/.rmagent/.census_miss.json` (was CWD/case-dir — "2 misses = Critical" could never trigger across runs).243- **`attest`/`sketch` match only `TargetUserName`** on 4624/4625 — matching any event field counted SYSTEM-subject events as admin failures (false positives).244- **`sketch.new_local_admins` only reports members still in the group** — deleted users' 4732 events linger 24h as stale SIDs.245- **`netedges` is advertised in the example inventory** — fresh installs previously scored max 5/6 on drills.246- Payloads compacted under the WinRM UTF-16LE base64 command-line budget (~8191 chars).247248## Lateral-movement & persistence additions (2026-08-19, rev 2)249250New event coverage in `edges` and `explain`, live-verified on WS1:251252- **`edges.explicit_creds` (4648)** — *the* lateral-movement signal: `runas`, `Invoke-Command -Credential`, any explicit-credential logon. Each record shows `who → became → dest` in one line. Live test found 2 uses on WS1 in a 2h window (`EC2AMAZ-8NK9FUP$ → Administrator @ localhost`).253- **`edges.special_privs` (4672)** — the privilege set granted at each admin logon. `SeDebugPrivilege` = process injection; `SeTcbPrivilege` = act-as-OS. Anomalous grants are now visible.254- **`edges` logons now carry the auth package** (`NTLM` vs `Kerberos`) — NTLM on a Kerberos-capable box is itself a signal.255- **`explain.wmi_subscriptions` (5861)** — WMI event subscriptions, the classic fileless persistence (ATT&CK T1546.003), read from `Microsoft-Windows-WMI-Activity/Operational`. Zero is the healthy steady state; any non-zero is an immediate finding.256- **`explain.identity_changes` now include 4648/4672**, and `hunt.py` fires a Telegram smoke alert naming them.257- `hunt.py` output and the case `path.json` record `explicit_creds`, `special_privs`, `wmi_subscriptions` as first-class hop fields.258259**Audit prerequisite:** 4648/4672 need "Audit Logon" (success) — same subcategory as the 4625 failure auditing. 5861 needs no audit policy; the WMI-Activity operational log writes it when a subscription is created.260261## Rev 3 — 4688 upgrade, anti-forensics, DNS, and PowerShell code (2026-08-19)262263Driven by a live probe of what sources actually exist on WS1/WS2:264265- **4688 split into two collections.** `proc_spawns` (all, capped) stays for volume; new **`lolbin_spawns`** filters to LOLBins — `powershell`, `cmd`, `wscript`, `cscript`, `mshta`, `rundll32`, `regsvr32`, `certutil`, `bitsadmin`, `msiexec`, `schtasks`, `wmic`, `psexec`, `curl`, `tar` — **and carries `CommandLine`** when command-line auditing is on. "PowerShell ran" becomes "PowerShell ran `-enc SQBFAFgA...`". Probe showed 3,464 raw 4688s/day on WS1 — the LOLBin cut is what makes it signal instead of noise.266- **`audit_cleared` (1102)** — the audit log was cleared. The classic anti-forensics move; on a healthy box this is *always* zero, so any hit is an immediate Critical-grade finding. Telegram alert names it explicitly.267- **`task_events` now includes 4699** (task *deleted*) alongside 4698/4702 — an attacker deleting the task they used is as interesting as creating it.268- **`netedges.dns_queries` (Sysmon 22)** — DNS queries by tracked principals: the domain a beacon resolves *before* the connection. Pair a DNS query with the matching netedges connection and you have the full C2 story. Requires `<DnsQuery onmatch="exclude">` in the Sysmon config (WS2 had 10 in 24h at probe time; WS1 had none — the config differs per box).269- **New question `pslogs` (4104)** — PowerShell script-block logging: **the actual code being executed**, decompiled from the script block. This is the highest-fidelity signal in the skill. Probe found it already enabled on both boxes (348/342 events in 24h). Live-tested: returns the real script text. Caveat discovered live: 4104's `UserId`/`Path` Data fields are often *empty* (the user lives in the event's Security descriptor), so blocks are returned unfiltered and capped — every block is worth reading, unlike a process count. Each block's text is truncated to 500 chars to respect the 32 KB answer cap.270- `hunt.py` prints and records all of it; Telegram smoke alerts name the new signals (audit-cleared gets an explicit "anti-forensics!" flag).271272**Prerequisites for the new signals:** 4688 command lines need `auditpol /set /subcategory:"Process Creation" /success:enable` **plus** the registry key `HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\Audit\ProcessCreationIncludeCmdLine_Enabled = 1`. 4104 needs script-block logging (Group Policy: Administrative Templates → Windows Components → Windows PowerShell → PowerShell Script Block Logging; or the registry equivalent under `HKLM\SOFTWARE\Wow6432Node\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging`). Sysmon 22 needs the DnsQuery rule in the config.273274## Rev 4 — kernring: the no-Sysmon fallback (2026-08-20)275276**Why:** sophisticated attackers target Sysmon specifically — `Stop-Service Sysmon64; sc.exe delete Sysmon64` — and if Sysmon is your only process/network ring, that one command blinds you. The kernel analytic channels are built into Windows, have no obvious service to stop, and give you a degraded but functional ring when Sysmon is gone.277278**What was added:**279280- **New seventh question `kernring`** — reads `Microsoft-Windows-Kernel-Process/Analytic` (process start/stop with PID, image, parent PID, and command line where available) and `Microsoft-Windows-Kernel-Network/Analytic` (TCP/UDP connect with PID, dest IP, dest port). Also reports `sysmon_status` in every response.281- **`sysmon_status` tripwire in `attest`** — every census now reports whether Sysmon is Running, Stopped, or not-installed. A change from Running to anything else is a finding: either the sensor died or someone stripped it. This is the signal that tells you when to fall back to kernring.282- **`hunt.py` fires a Telegram smoke alert when Sysmon is not running** — "the primary ring is down; kernring is the fallback."283- **Setup step D3** — `wevtutil sl Microsoft-Windows-Kernel-Process/Analytic /e:true` and the Network equivalent, wired into the setup docs alongside D1 (auditpol) and D2 (Sysmon ring).284285**The honest fidelity gap** (documented, not hidden):286287| | netedges (Sysmon) | kernring (kernel channels) |288|---|---|---|289| Process name on network events | ✅ | ❌ PID only — must join |290| Command lines | ✅ | ⚠️ version-dependent |291| Process hashes | ✅ | ❌ |292| Stable GUIDs / parent chains | ✅ | ❌ PID-based, PIDs recycle |293| Ring depth | Days (configurable) | **Minutes** (small fixed buffer) |294| Survives Sysmon deletion | ❌ | ✅ |295296**Design decision:** kernring is a *separate question*, not a silent fallback inside `netedges`. If `netedges` silently degraded, the operator would think they're getting Sysmon-quality data when they're not — a lie by omission that violates the "a hole is an answer" principle. The operator asks the question that matches the fidelity they need.297298**Status: LIVE-VALIDATED 2026-08-25.** Ran against both WS1 and WS2 (estate reachable): `kernring` returns process events from the kernel analytic channels with the expected fields, and reports `sysmon_status` on every call (Sysmon64=Running on ws1, Sysmon=Running on ws2). **Reality check discovered in live testing:** on this estate the kernel channels are NOT enabled as a persistent ring — the payload works as a **10-second burst capture** (`burst_seconds: 10`, note: "burst capture - 10s window, not a ring. Sysmon is the ring."), not the minutes-deep ring the design assumed. To get a persistent ring, setup step D3 (`wevtutil sl Microsoft-Windows-Kernel-Process/Analytic /e:true`) must be run on each box first; until then kernring is a spot-check, not a fallback ring.299300## Rev 5 — attackmap + ATT&CK tagging + expanded LOLBins (2026-08-21)301302**Source:** BLUESPAWN's ATT&CK-mapped hunt registry (github.com/ION28/BLUESPAWN, MIT license). We took the *knowledge* — the registry locations, the technique mappings, the LOLBin list — and reimplemented it pull-only. We did not take the agent, the YARA scanning, the process-memory scanning, or the mitigation system. Those violate the architecture.303304**What was added:**305306- **New eighth question `attackmap`** — an ATT&CK-mapped persistence STATE check. Reads 13 registry locations BLUESPAWN enumerated: Run keys (T1547.001), IFEO debuggers (T1546.010), AppCert DLLs (T1546.009), AppInit DLLs (T1546.010), Security Support Providers (T1547.005), Notification packages (T1547.002), Winlogon hijack (T1547.004), Netsh helpers (T1546.007), port monitors (T1547.010), logon scripts (T1037.001), recent accounts (T1136.001), disabled firewall profiles (T1562.004). Every finding carries its technique ID.307- **Why state, not events:** `explain` catches when persistence is CREATED (4698, 7045, 4720). `attackmap` catches persistence that ALREADY EXISTS — including anything that predates our monitoring window or was staged before rmagent was installed. This is the "what was already on the box when we started" check.308- **ATT&CK tags on existing findings.** `sketch` now returns `admin_failed_attack='T1110'`, `new_local_admins_attack='T1136.001'`, `new_services_attack='T1543.003'`, `new_tasks_attack='T1053.005'`. The operator sees not just "a task was created" but "T1053.005: Scheduled Task persistence."309- **LOLBin list expanded 18 → 80** (from BLUESPAWN's curated list). Adds `msxsl`, `installutil`, `msbuild`, `forfiles`, `diskshadow`, `dnscmd`, `cmstp`, `msdt`, `odbcconf`, `pcalua`, `rasautou`, `regasm`, `regsvcs`, `runscripthelper`, `scriptrunner`, `syncappvpublishing`, `tttracer`, `verclsid`, `wab`, `xwizard`, `appvlp`, `bginfo`, `cdb`, `csi`, `devtoolslauncher`, `dnx`, `dotnet`, `dxcap`, `mftrace`, `msdeploy`, `rcsi`, `sqlps`, `sqltoolsps`, `squirrel`, `te`, `tracker`, `update`, `vsjitdebugger`, `wsl`, and more.310- **`hunt.py` integration:** attackmap prints `N/13 ATT&CK techniques with findings`, lists each technique found, records `checked`/`found` as hop fields, and fires a Telegram smoke alert for high-severity techniques (IFEO hijack, SSP, Winlogon hijack, AppCert, firewall disabled).311312**What we deliberately did NOT take from BLUESPAWN:**313314| Left out | Why |315|---|---|316| The agent | Installs a service on every box. We are agentless by design. |317| YARA file scanning | Requires reading file contents off the box. Violates the no-lake rule. |318| Process memory scanning | Needs kernel access or an agent. Out of scope. |319| Their mitigation system | 20+ hardcoded registry changes with no dry-run, no journal, no undo. The Actuator does this properly. |320| Real-time ETW monitoring | Requires a persistent consumer process = an agent. kernring is our answer. |321| The C++ implementation | ~16 hunt files, thousands of lines. We took the knowledge, not the code. |322323**Status: LIVE-VALIDATED 2026-08-25.** Ran against both WS1 and WS2: `attackmap` returns findings with ATT&CK tags on both boxes (ws1: T1547.001 run_keys ×1, T1546.007 netsh ×17; ws2: T1547.001 ×2, T1546.007 ×17). The full 8-signal redteam drill confirmed attackmap catches the staged drill artifacts: `run_key drill: True, ifeo drill: True` on both boxes (the two new Rev 5 signals). Drill artifacts cleaned up cleanly afterwards (0 remaining).324325## Rev 6 — RTerm observability integration notes (2026-08-25)326327**No skill changes required.** Documented so operators know what's already available.328329RTerm (v3.2.14+) now ships OpenLLMetry-style LLM tracing: every model call the330agent makes while running an rmagent hunt (the `explain`/`sketch` analysis331passes, the completion audits) is recorded as an APM span in RTerm's trace332store, grouped per agent run. That means:333334- **Hunt latency is already observable.** `rterm call observability:apmSummary`335 shows `llm.chat` / `llm.thinking` / `llm.audit.*` spans with p50/p95 latency —336 how long the LLM analysis of each hunt took, per run, with zero config.337- **No new question needed.** The skill's job is asking the *boxes* questions;338 RTerm's tracing covers the *agent's own* work automatically. Adding a339 `trace` question would duplicate what the platform already does.340- **The skill stays dependency-free.** It deliberately has no RTerm/OTel341 imports — it runs standalone with just pywinrm. Tracing happens around it,342 not inside it.343- **If you want hunt results in an external APM** (Jaeger/Tempo/Datadog), set344 `OTEL_EXPORTER_OTLP_ENDPOINT` on the RTerm backend — LLM spans forward with345 standard `gen_ai.*` attributes. Host metrics push on the same endpoint.346 This is RTerm configuration, not a skill change.347348**What is NOT traced:** the WinRM knocks themselves (they're pywinrm calls349made by the skill's scripts, outside RTerm's agent loop). Their timing lives350in the case hops (`asked`/`answered` timestamps) — by design, the case file is351the record.352353## Rev 7 — external half: netexec-bridge closes the purple-team loop (2026-08-25)354355RTerm v3.2.15 ships **netexec-bridge**, the outside view that rmagent lacked.356The drill previously staged artifacts *on* the boxes; now you can also357simulate the *external* attack (credential spray from outside) and verify358`attest` catches the resulting 4625s.359360**How the two halves fit:**361362| | rmagent (inside) | netexec-bridge (outside) |363|---|---|---|364| Direction | pull from the boxes | push at the boxes |365| Sees | 4625s, 4720s, new services/tasks, registry state | auth success/failure per host |366| Governance | allowlisted questions, authorized estate | target allowlist required per call (CIDRs ok) |367| Credential handling | env / creds.json / scrt | `env:<vaultRef>` — never the secret |368369**Recommended drill extension:** use `netexec_spray_plan` (rate-limited,370jittered, SLOW — does not execute) to review the schedule first, then371`netexec_check` against the SAME authorized estate. Immediately after, run372`attest` on each box and confirm `admin_fail_60s` rose. That is the full373outside→inside detection loop, scored end to end.374375**Same rule as always:** authorized estate only. netexec denies by default —376empty or missing allowlists are refused, and every comma-separated target is377validated individually (no batch bypass).378379## Rev 12 — correlation, drift, FP allowlist, score history, Linux sibling (2026-08-29)380381Eight improvements, live-validated against WS1/WS2:3823831. **Cross-witness correlation (`scripts/correlate.py`)** — the biggest gap.384 Every question ran per-box, but the drill's thesis is *lateral movement*.385 `correlate.py` joins edges/netedges answers across witnesses and surfaces:386 - **cross-host-account** — same account logged on to both boxes in the window387 - **lateral-hop** (critical) — WS1 connecting to WS2's address or vice versa388 - **explicit-cred-to-peer** — 4648 on one box naming the other389 - **shared-logonid** (critical) — same LogonId on two boxes (stolen session/PTH)390 `hunt.py` now runs correlation automatically at the end of a walk and writes391 `correlation.json` into the case. `record_ask` persists full answers to392 `case/answers/*.json` so correlation is pure post-processing (no re-pull).3933942. **Baseline + drift (`scripts/drift.py`)** — `attest` is point-in-time; the395 sharper question is *who became admin since last week*. First run records a396 baseline (`~/.rmagent/baselines/<id>.json`, mode 600); later runs diff:397 new/removed admins, Sysmon status change, attackmap techniques that grew or398 shrank. `--reset` re-baselines.3994003. **Time-windowing** — `--since` now accepts `30m` / `2h` / `24h` / `7d` on401 hunt/correlate/drift (was h-only). Drill comparisons and drift checks are402 meaningful instead of "recent".4034044. **attackmap FP allowlist** — live validation showed `T1546.007 netsh ×17`405 on both boxes: OS-default netsh helper DLLs, not persistence. The payload406 now suppresses known-good values for T1546.007 (netsh helpers), T1547.005407 (default SSPs), T1547.002 (default auth notification packages). A real408 `netsh` helper with a non-default name still fires.4094105. **Score history + regression alert (`redteam.py`)** — every drill appends411 to `~/.rmagent/drill_history.jsonl`. If the score drops vs the previous412 run, it prints AND Telegram-alerts the lost signals — catching the failure413 mode where a Windows update or GPO silently disables 4688.4144156. **Auto-scheduled attest** — RTerm scheduled task (cron `*/30 * * * *`):416 `python3 ~/.agents/skills/rmagent-windows/scripts/drift.py --inventory <estate>`417 → findings into the trigger pipeline → Telegram. Turns the witness from418 "ask me" into "watch and page". Create via `manage_scheduled_task`.4194207. **ETW AutoLogger for kernring** — documented as an *estate change* (MOP,421 not Phase 0): `wevtutil sl Microsoft-Windows-Kernel-Process/Analytic /e:true`422 as a standing session catches between-poll events. Not enabled by default.4234248. **Linux sibling (`~/.agents/skills/rmagent-linux/`)** — same engine, SSH425 door, five questions (attest/sketch/edges/explain/attackmap) reading426 journald/auth.log/ss/systemd/cron. Makes the observatory multi-plane.427 macOS paths documented as experimental.428429**Status: LIVE-VALIDATED 2026-08-29** — correlate + drift + attackmap allowlist430run against WS1/WS2 (see Rev 8 validation notes in the case dir).431432## Rev 13 — the audit-blindness lesson: verify the witness can see (2026-08-29)433434Two live findings from re-validating Rev 8, both silent false negatives:4354361. **correlate.py joined on the wrong field names.** The unit tests used a437 synthetic `logon_id` shape, but the LIVE `edges.ps1` payload emits438 `lid` / `user` / `src` / `who` / `became` / `dest`. Every join key was439 wrong, so **shared-logonid and lateral-hop could never fire** — and the440 suite still printed "ALL UNIT TESTS PASSED". Fixed to read the live shapes441 (verbose `TargetUserName`/`LogonId` kept as fallbacks). The tests now use442 the live payload shapes. **Lesson (again): a unit test with a synthetic443 shape proves nothing about the wire. Always join against a real answer444 file from `cases/*/answers/`.**4454462. **WS2 was audit-blind on 12 subcategories** — `Logon` was *Failure-only*,447 `Logoff`/`Special Logon`/`Other Logon/Logoff`/`Group Membership`/448 `Account Lockout` were *No Auditing*, while WS1 had Success+Failure on all.449 Result: `edges` on WS2 returned **zero logons while an Administrator450 WinRM session was actively connected** — and correlate reported a "clean"451 estate. That is the worst failure mode: not an error, an *empty answer452 that looks like good news*.453 **Fixed:** aligned WS2 to WS1 for the 6 subcategories the questions depend454 on (`auditpol /set /subcategory:"Logon" /success:enable /failure:enable`455 …), verified all six show Success and Failure. Baseline saved before the456 change (`/tmp/audit-baseline.json` pattern — record before you touch).457 **Proof:** immediately after, correlate fired458 `cross-host-account: 'Administrator' logged on to 2 witnesses (ws1, ws2)`459 — a finding that was structurally impossible 10 minutes earlier.460461**New standing rule:** before trusting any "no findings" result, check the462witness can actually see. A quick blind-check (read-only, one ask per box):463464```powershell465# raw 4624 count in 24h with NO track filter — if this is 0 while you are466# connected, the box is not auditing success logons.467(Get-WinEvent -FilterHashtable @{LogName='Security';Id=4624;468 StartTime=(Get-Date).AddHours(-24)} | Measure-Object).Count469auditpol /get /subcategory:"Logon" # must say "Success and Failure"470```471472**`attest` now does this automatically (Rev 13.1).** Every attest payload473carries:474475- `raw_4624_24h` — unfiltered 4624 count (the number that was 0 on WS2 while476 an Administrator session was connected)477- `blind_check` — per-subcategory `ok` / `BLIND` / `unknown` for the six478 subcategories the questions depend on (Logon, Logoff, Special Logon,479 Other Logon/Logoff, Group Membership, Account Lockout)480- `blind_count` — how many are blind; **0 is the only healthy value**481482`drift.py` treats a growing `blind_count` as a **critical** finding483(`witness_blind`) and `raw_4624_24h` dropping to 0 as a warning484(`logon_visibility_lost`). A witness going blind is the worst regression485because every other question silently returns empty.486487**Two implementation notes, both learned the hard way:**4884891. **WinRM command budget.** attest.ps1 grew past the ~8191-char *encoded*490 budget (preamble+payload × ~2.7 for UTF-16LE base64) and every ask491 returned "The command line is too long." — on both boxes, instantly.492 The blind_check block is deliberately terse. If you extend attest,493 re-check: `len(preamble) + len(_strip_payload(payload))` × 2.67 < 8191.4942. **auditpol /r CSV columns** are MachineName, PolicyTarget, Subcategory,495 Subcategory GUID, Inclusion Setting — the policy is field **[4]**, not496 [3]. Reading [3] reports every box as blind with GUID strings (a497 false positive that looks authoritative).498499**Status: LIVE-VALIDATED 2026-08-29** — both WS1 and WS2 return500`blind_count: 0`, all six `ok`; WS2 `raw_4624_24h` = 19 (was 0 before the501audit-policy fix).502503## Rev 15 — the enterprise layer + the skill split (2026-08-30)504505**The skill is now split.** The question half lives in its own skill so it can506be loaded and reasoned about on its own:507508| Skill | Half |509|---|---|510| `rmagent-windows` | **this skill** — both halves, fully runnable |511| `rmagent-so` | the witness-question (Security Observatory) half |512| `rmagent-fr` | the Flight Recorder (tracing) half |513| `rmagent-actuate` | Phase 1 response — named, reversible actions |514| `rmagent-redteam` | the drill — stages artifacts, scores detection |515| `rmagent-linux` | the Linux/macOS sibling |516517All six share one constitution. `rmagent-so` is the one to load when you only518want to *ask questions* of the estate.519520**What rev 15 added (implemented in `rmagent-so` + `rmagent-actuate`):**5215221. **`canary` — a new question, and a new kind of question.** A decoy523 identity that exists only to be touched. Any 4624/4625/4740 against it is524 critical by definition — there is no business reason to authenticate as525 `honeyadmin`. Decoys are declared in the inventory (`canaries: [name,...]`)526 or auto-detected by decoy-name heuristics. This turns patient-zero527 detection from a graph walk into a tripwire.5285292. **`canary_watch.py` — the standing tripwire.** Polls the canary question530 every 60s, alerts once per NEW hit (dedup by timestamp, not cooldown — a531 cooldown can hide a second hit), reports unreachable witnesses as holes,532 exits non-zero when tripped so cron can chain response. This is what533 shrinks the detection window from "whenever a hunt runs" to ~60 seconds.534 Run it from cron, not as a daemon:535 ```536 * * * * * python3 ~/.agents/skills/rmagent-so/scripts/canary_watch.py \537 --inventory ~/estate.yaml --once --quiet >> ~/.rmagent/canary_watch.log 2>&1538 ```5395403. **`plant_canary` (actuate) — arm the tripwire.** Creates a **disabled**541 decoy account: it can never log on, so it cannot be used as a foothold,542 but Windows still records every attempt against it. Complexity-safe543 random password (GUID hex fails password policy on some boxes).5445454. **`patient_zero.py` — the backward walk with honest termination.** Labels546 how the walk stopped — origin / retention-boundary / blind-witness /547 no-signal / cycle / hop-limit — and refuses to name a patient zero it548 cannot prove. Uses the new `attest.oldest_security_event` to tell "reached549 the origin" from "ran out of log". Those two look identical without it,550 and reporting the second as the first is a confident wrong answer.5515525. **Signal-aware cap.** An over-budget answer is now TRIAGED, not dropped:553 low-signal rows shed first, rows carrying critical event IDs (4648, 4672,554 5861, 1102, 4104, 4698, 7045, 4732, 4688) always survive. The 32 KB cap555 is never raised — we only choose what survives it. Closes the evasion556 surface where a noisy host could push the signal past the window.5575586. **Triage ranking.** Every correlate finding carries `triage_rank`,559 `triage_why`, and `recommended_actions` drawn only from the actuator560 allowlist. Response order is derived, not improvised.5615627. **`rotate_credential` + `isolate_host` (actuate).** Containment becomes563 remediation: rotation breaks the attacker's copy of a credential without564 breaking the account's owner. Isolation stops lateral movement without565 powering the box off, keeping WinRM open so undo works.566567**Tests:** `test_enterprise.py` (57 assertions, pure-logic) and568`test_budget.py` (every payload under WinRM's ~8191-char budget — this569caught attest going 108% over when `oldest_security_event` was added).570571**Known limitation, stated honestly:** a canary hit cannot be staged from the572jump host. Windows writes 4625 only for real *logon-session* attempts;573`LogonUser`/`DirectoryEntry` API validation does not create one. Proving the574tripwire end-to-end requires a genuine network logon from a **second host**.575The detection query itself is proven — it reads live 4625s correctly.576577**Status: LIVE-VALIDATED 2026-08-30** — canaries planted on WS1+WS2 (journal57813, 15), both verified disabled; `canary_watch.py` runs a clean pass against579both witnesses and sees the armed canaries.580581---582583## Enterprise scope, sizing & the no-Python (PowerShell-native) kit584585### Estate scope & sizing (Windows plane)586587- **Per-witness footprint:** zero install. The questions ride WinRM/PSRP;588 resident state is only the ETW rings (`C:\etw`, default 512/256/128 M589590…(truncated)