Technical Reference

Under the Hood

A complete technical reference for the Guardian detection pipeline — architecture choices, training data, feature vectors, anomaly thresholds, and inference design.

17 PE Features
12 ETW Signals
ONNX On-Device
Cloud Upload
2 Detect Layers
01 — Architecture

Two-Layer Detection Pipeline

Guardian runs two independent anomaly detection models at different levels of abstraction. They catch entirely different attack classes and are deliberately designed not to overlap.

17 Layer 1a input
PE structural features
12 Layer 1b input
ETW event-rate features
ONNX Inference engine
Runtime, on-device
None Cloud upload
All inference is local
Layer 1a

Static PE Autoencoder

Fires the instant a new executable lands on disk. Encodes 17 structural features from the PE header and compares reconstruction error against a global baseline trained on 10,233 legitimate Windows programs. A file whose structure cannot be well-reconstructed is flagged before it ever runs.

Layer 1b

Behavioral Autoencoder

Runs continuously in the background. Aggregates 12 Windows ETW signals over rolling 5-minute windows and compares each window against a personal baseline specific to your machine. Any process driving behavior your machine has never produced before is flagged live.

Design principle

Complementary, Not Redundant

A polymorphic file that rewrites its PE structure to pass Layer 1a still leaves a behavioral fingerprint that Layer 1b detects. A script-based attack with no PE on disk is caught by Layer 1b alone. The two models cover the full attack chain together.

Training approach

No Signatures Required

Both models are trained entirely on benign data. They learn what normal looks like — not what malware looks like. Any structural or behavioral deviation produces high reconstruction error, whether or not it has ever been seen before. Zero-day coverage is inherent.

02 — Layer 1a

Static PE Autoencoder

Every PE file is analyzed structurally before a single line of it executes. Reconstruction error is the anomaly score.

0.163 Anomaly threshold
MSE reconstruction error
5% Target FPR
p95 on 300 System32 PEs
10,233 Training files
Benign Windows PE files
StdScl Preprocessor
Fitted on training set
How It Works

The model encodes the file’s structural fingerprint down to an 8-dimensional bottleneck, then reconstructs all 17 original features. The mean squared error (MSE) between the input and reconstruction is the anomaly score — low means the file looks like normal software, high means its structure is unlike anything in the benign training distribution. The symmetric encoder–decoder forces the network to genuinely learn a compressed representation. All hidden layers use ReLU; the output layer uses linear activation so reconstruction is unconstrained. Loss: MSE.

Network Architecture
Encoder Bottleneck Decoder
17
input
32
ReLU
16
ReLU
8
latent
16
ReLU
32
ReLU
17
linear
Input Feature Vector — 17 Dimensions

All features are extracted from the PE binary before execution. No runtime behavior is involved at this layer.

FeatureDescription
file_sizeRaw byte count of the PE file
overall_entropyShannon entropy of the full file
num_sectionsCount of PE sections in the header
max_section_entropyEntropy of the highest-entropy section
mean_section_entropyMean entropy across all sections
section_entropy_stdStd deviation of section entropies
num_importsCount of imported functions
num_import_dllsDistinct DLLs imported
num_exportsExported symbols (non-zero in DLLs)
FeatureDescription
compile_timestampPE header timestamp — 0 or future = anomaly
is_dll1 if IMAGE_FILE_DLL flag is set
has_debug1 if a debug directory is present
is_signed1 if valid Authenticode signature present
is_packed_heuristic1 if entropy > 7.0 or non-standard sections
file_ext_encEncoded extension (.exe / .dll / .sys / other)
architecture_encTarget machine type (x64 / x86 / ARM64)
subsystemPE subsystem (GUI / console / driver / native)
Design Notes
Why entropy matters Legitimate compilers produce predictable entropy patterns — code sections hover around 5–6 bits/byte. Packers and crypters push entropy above 7.5 with near-uniform distribution (section_entropy_std ≈ 0). A single high-entropy section in an otherwise normal PE is consistent with a packed payload inside a dropper.
Why compile timestamp matters Malware authors commonly zero out or forge compile timestamps to evade heuristics. A timestamp of 0 or a future date is structurally anomalous in the training distribution and pushes reconstruction error upward even when all other features appear normal.
Threshold calibration The threshold of 0.163211 was set at the 95th percentile of reconstruction errors on 300 real System32 PE files not seen during training. False positives are further suppressed by the process knowledge base (1,000+ known-good processes) before any alert is surfaced.
03 — Layer 1b

Behavioral Autoencoder

Watches what your computer does in aggregate every 5 minutes. Flags any window that deviates from your personal behavioral normal.

0.000507 Anomaly threshold
MSE reconstruction error
5 min Window size
Rolling ETW aggregation
13,880 Training windows
Benign behavioral data
MinMax Preprocessor
Clip + per-feature scale
How It Works

Every 5 minutes, Guardian collapses all system event activity into 12 normalized rate features from Windows Event Tracing (ETW). The behavioral autoencoder tries to reconstruct each new window from what it learned on thousands of benign windows. A high reconstruction error means the window looks like nothing in the benign distribution — it is behaviorally anomalous.

Unlike Layer 1a, Layer 1b is personal. Before monitoring activates, Guardian collects hundreds of 5-minute windows from your own normal usage and fine-tunes the effective threshold for your specific machine. An engineer running WMI-heavy build tooling will see those patterns learned as normal, eliminating false positives that a generic model would generate.

Network Architecture
Encoder Bottleneck Decoder
12
input
32
ReLU
16
ReLU
8
latent
16
ReLU
32
ReLU
12
linear
ETW Feature Vector — 12 Dimensions

Each feature is an event count divided by window duration (events/sec). All 12 are clipped at the 99th percentile then scaled to [0, 1] per feature using MinMax normalization to prevent rare bursts from dominating the anomaly score.

Feature ETW Source What It Captures
wmi_query_rateWMI-Activity / 5857, 5858Rate of WMI queries. Malware heavily abuses WMI for reconnaissance, lateral movement, and execution.
task_register_rateTaskScheduler / 106, 107Rate of scheduled task registrations. Attackers register persistence tasks; high rates outside maintenance windows are suspicious.
task_run_rateTaskScheduler / 200, 201, 202Rate of task executions. A spike after a registration event strongly suggests a newly placed persistence mechanism firing.
bits_event_rateBits-Client / any EventIDBITS is commonly abused for stealthy C2 downloads via system-trusted network channels.
fw_rule_change_rateFirewall / 2097, 2052, 2002Malware modifies firewall rules to open inbound ports or allow C2 traffic to pass through.
rdp_session_rateTermSvc-LocalSessionMgrExpected near-zero on single-user workstations. Non-zero on machines without RDP enabled is always anomalous.
smb_access_rateSMBClient / any EventIDNear-zero on isolated workstations. Elevated rates suggest lateral movement scanning or unexpected share access.
error_event_rateEventLog / Level = Error, CriticalRate of error and critical events system-wide. Malware causes cascading errors through injection failures or service crashes.
total_event_rateAll ETW channelsOverall system event rate. Captures gross activity spikes that do not fit any specific category.
unique_channel_countDistinct provider channelsNumber of distinct event channels fired in the window. Unusual proliferation suggests broad system manipulation.
group_policy_rateGroupPolicy / any EventIDLegitimate GP activity is periodic and predictable. Manipulation attempts generate irregular bursts.
shell_core_rateShell-Core / any EventIDShell lifecycle events. Naturally sparse; spikes correlate with software installation activity.
Design Notes
Why an autoencoder, not a classifier? A classifier requires labeled attack samples. An autoencoder trained only on benign data has no concept of what attacks look like — it just learns what normal is. Anything outside normal produces high reconstruction error, whether or not it has ever been documented. This is what makes anomaly detection effective against zero-days.
Why 5-minute windows? Most attack sequences involving system manipulation leave traces over minutes, not milliseconds. A 5-minute window is long enough to capture a full attack phase but short enough to alert before the next phase begins. Windows shorter than 2 minutes produce noisy rates; longer than 10 minutes delay alerts.
Preprocessor design Raw counts are clipped at the 99th percentile and scaled to [0, 1] per feature. Clipping values are stored in preprocessor_config.json alongside scaler parameters so the on-device ONNX runtime applies identical preprocessing without needing a scikit-learn object.
04 — Inference

ONNX Runtime Pipeline

Both models are exported to ONNX and run entirely on your machine via the ONNX Runtime library. No internet connection required — no data ever leaves the device.

Layer 1a flow

Static File Inference

A PE file identified by the monitor thread is parsed in Rust to extract 17 structural features. The vector is StandardScaler-normalized, then fed forward through the autoencoder. If the MSE between input and reconstruction exceeds the stored threshold (0.163211), the file is handed to the alert pipeline.

Layer 1b flow

Behavioral Window Inference

The ETW recorder accumulates event counts in a rolling in-memory buffer. At each 5-minute boundary, counts are converted to 12 rate features, preprocessing is applied (clip → MinMax), and the vector is passed through the behavioral autoencoder. An MSE above 0.000507 generates a behavioral window alert.

Runtime choice

Single Native Library, No Python

PyTorch and TensorFlow models require a full Python runtime to embed. ONNX Runtime ships as a single native library with Rust bindings (ort crate), adding roughly 30 MB to the binary. Inference latency on both models is sub-millisecond on modern hardware.

Model versioning

Atomic Over-the-Air Updates

Each model ships alongside a model_meta.json recording the model name, layer, threshold value, preprocessing parameters, and training date. Updates are applied atomically: the new ONNX file is written to a staging path, validated, and renamed into place — the monitor thread never reads a half-written model.

05 — Alert Logic

Alert Tier Classification

Not all anomalies are equally urgent. Alert generation is deferred until the process knowledge base (1,000+ known-good processes) has been consulted — a high-MSE score on a process with a known-benign signature is suppressed or downgraded before it reaches the UI.

Action Required
Quarantine eligible
Both Layer 1a and Layer 1b exceed their respective thresholds simultaneously — or Layer 1a MSE is significantly above threshold (≥ 2× the calibration percentile) with no known-good process match. Guardian surfaces the file path, parent process, import hash, and the specific feature values that drove the score so you can make an informed decision.
Under Review
Review queue
One model exceeds its threshold but not the other, or a known-benign process is scoring anomalously on a single feature dimension (suggesting a behavioral change rather than malware). The process is added to the review queue with a human-readable summary of which signals are elevated. High-sensitivity mode promotes more detections into this tier.
Monitoring
Logged silently
Scores are marginally above threshold, the process is known-good, or the anomaly is a single-window behavioral spike consistent with a legitimate background task (e.g., Windows Update). Guardian logs the event with full detail but does not surface a UI notification unless the pattern persists across multiple windows or the score climbs.
06 — Baseline & Sensitivity

Personal Baseline Methodology

The behavioral model learns what normal looks like specifically on your machine before monitoring begins.

The model shipped with Guardian was pre-trained on thousands of benign 5-minute ETW windows from real machines. On installation, Guardian begins recording your machine’s own behavioral windows in the same 12-dimensional feature space. As your personal baseline accumulates — Guardian targets several hundred windows across varied sessions — these windows are used to fine-tune the anomaly threshold for your specific machine.

A developer running WMI-heavy build tooling will naturally generate wmi_query_rate values the global model scores as unusual. Once enough of those windows are in the personal baseline, the effective threshold for that feature is recalibrated upward, eliminating false positives from legitimate tools without any action required from the user.

Baseline recording is passive The ETW recorder runs as a scheduled task at logon. It writes only the 12 aggregate rate figures per 5-minute window to a local CSV. No process names, no file paths, no user content. The baseline file never leaves the machine.
Boot-window handling The first window after a cold boot predictably shows elevated shell_core_rate, task_run_rate, and total_event_rate while Windows initializes startup tasks. Guardian detects post-boot windows (gap > 15 min from previous) and excludes them from false-positive rate calculations.
Sensitivity controls The sensitivity slider in Settings scales the effective threshold multiplicatively at score time: minimum applies 1.5× multiplier (fewer alerts), maximum applies 0.7× (more alerts). The calibrated threshold on disk is never permanently modified — no retraining needed to change sensitivity.

Questions about the implementation?

Open an issue or reach out through the support page.

← Back to home Get Protected