Skip to content

Indicator of Compromise Detection and Behavioral Anomaly Analysis for AI Platforms ​

Document Information

FieldValue
Version1.0
DateApril 2026
ClassificationPublic

Executive Summary ​

Enterprise AI platforms process sensitive data at scale — regulated PII, trade secrets, financial records, and privileged communications flow through chat sessions, file uploads, tool invocations, and memory recall. Traditional perimeter security does not address the threat model unique to AI: a compromised account can exfiltrate vast amounts of data through seemingly normal conversation, a malicious insider can bulk-download sanitized reports at 2 AM, and an attacker pivoting through stolen credentials can query from unfamiliar geographies without triggering conventional IDS rules.

GhostAI addresses this gap with a dual-layer detection architecture:

  1. IOC Rule Evaluation Engine — six purpose-built indicator types evaluate every audit event in real time, matching against organization-defined rules for volume spikes, off-hours access, geographic anomalies, data exfiltration, unusual access patterns, and custom regex signatures.

  2. Behavioral Anomaly Detection — a statistical baseline system computes rolling 30-day per-user activity profiles across six metric dimensions, then applies z-score analysis to flag deviations that exceed configurable warning and critical thresholds.

Both layers persist match history, support acknowledgment workflows, emit structured events to enterprise SIEMs, and dispatch alerts through webhooks and email. This whitepaper describes the architecture, detection logic, data model, operational integration, and compliance alignment.


1. The Threat Landscape for Enterprise AI ​

1.1 AI-Specific Attack Vectors ​

AI platforms introduce unique indicators of compromise that traditional endpoint detection and network IDS were not designed to identify:

ThreatDescriptionTraditional Detection Gap
Conversational exfiltrationAn attacker uses AI chat to extract sensitive data through natural-language queries rather than database dumpsNo file transfer or network anomaly to trigger
Bulk PII harvestingA compromised service account makes thousands of PII-laden queries to build a dossierAppears as normal API traffic
Off-hours data stagingAn insider exports reports and audit logs during low-activity periods to avoid peer observationVPN connection is legitimate; no lateral movement
Credential-stuffing via AI endpointsStolen API keys are used from multiple geographies simultaneouslyStandard rate limiting catches volume, not origin diversity
Tool chain abuseMalicious tool invocations exfiltrate data through MCP tool outputsTool calls look identical to legitimate usage
Memory system extractionAn attacker queries the memory system to retrieve historical context containing sensitive dataMemory recall is a core feature, not an anomaly by signature alone

1.2 Why Both IOC Rules and Behavioral Baselines Are Required ​

IOC rules provide deterministic, low-latency detection — if a pre-defined pattern matches, an alert fires immediately. However, IOC rules require explicit definition and cannot adapt to emerging patterns.

Behavioral baselines provide adaptive, statistical detection — they learn what is normal for each user and flag deviations without requiring explicit rule authoring. However, they require a warm-up period and produce probabilistic rather than deterministic alerts.

Together, the two layers form a defense-in-depth model: IOC rules catch known-bad patterns in real time, while behavioral baselines catch unknown-bad patterns through statistical deviation.


2. Architecture Overview ​

                    ┌─────────────────────────────────┐
                    │      Audit Event Pipeline        │
                    │  (AuditLogger.log() on every     │
                    │   state-changing action)          │
                    └──────────┬──────────────────────┘
                               │
                    ┌──────────▼──────────────────────┐
                    │     SIEM Event Emitter            │
                    │  (structured event to SIEM queue) │
                    └──────────┬──────────────────────┘
                               │
              ┌────────────────▼────────────────────┐
              │      Real-Time IOC Evaluation        │
              │  (IOCEvaluator.evaluate() inline)    │
              │                                      │
              │  Skip prefixes: pii.*, memory.recall,│
              │  system.rate_limit                   │
              └────────┬───────────────┬────────────┘
                       │               │
              IOC Match Found    No Match
                       │               │
              ┌────────▼────────┐      │
              │ Persist to      │      │
              │ ioc_matches     │      │
              │ table           │      │
              └────────┬────────┘      │
                       │               │
              ┌────────▼────────┐      │
              │ Dispatch Alerts │      │
              │ (webhook, email)│      │
              └─────────────────┘      │
                                       │
              ┌────────────────────────▼────────────┐
              │    Scheduled Layers (APScheduler)    │
              │                                      │
              │  Hourly (:45): IOC batch evaluation   │
              │    Re-scans last hour of audit logs   │
              │    for all active organizations       │
              │                                      │
              │  Nightly (2:30 AM UTC):               │
              │    1. Compute 30-day rolling baselines│
              │    2. Run z-score anomaly detection   │
              │    3. Emit anomalies to SIEM          │
              └──────────────────────────────────────┘

2.1 Real-Time Path ​

Every call to AuditLogger.log() — triggered on authentication events, data access, file downloads, tool executions, memory operations, settings changes, and more — automatically invokes the IOC evaluation engine inline. The evaluator loads the organization's enabled IOC definitions from a TTL-cached store (60-second cache, invalidated on CRUD operations), evaluates the event against each rule, and if matches are found, persists them and dispatches alerts. High-volume event types that are unlikely to be relevant to IOC rules (pii.*, memory.recall, system.rate_limit) are skipped to minimize overhead.

2.2 Scheduled Batch Path ​

Two scheduled jobs supplement the real-time path:

  • Hourly IOC batch evaluation (every hour at :45) re-evaluates the last hour of audit logs for all active organizations, catching events that may have been skipped or that require cross-event correlation (e.g., geographic anomaly detection that counts distinct IPs across the day).

  • Nightly baseline and anomaly scan (2:30 AM UTC) computes rolling 30-day behavioral baselines for every active user, then runs z-score anomaly detection and emits detected anomalies as SIEM events.


3. IOC Rule Evaluation Engine ​

3.1 IOC Type Taxonomy ​

The engine supports six IOC types, each with a JSON-based pattern schema that administrators configure through the API or UI:

IOC TypePurposePattern Parameters
volume_spikeDetect when a user's activity count exceeds their historical baseline by N standard deviationsmetric (event_count, pii_volume), threshold_sigma (default 3.0), min_count (default 20)
off_hoursFlag activity outside defined business hoursstart_hour (default 22), end_hour (default 6), timezone, min_events
geo_anomalyDetect suspicious geographic diversity — too many distinct IP addresses in a single daymax_countries_per_day (default 2), blocked_countries (list)
data_exfilIdentify bulk data download or export bursts that exceed baselinemetric (file_downloads), threshold_sigma (default 3.0), min_count (default 10)
access_patternFlag unusual resource access frequency for specified resource typesresource_types (list), max_per_hour (default 5)
customArbitrary regex-based matching on event type and JSON detail fieldsevent_type_regex, detail_match (key-value dict)

3.2 Detection Logic by Type ​

Volume Spike ​

The volume spike detector compares current activity against historical baselines stored in the user_activity_baseline table. When an event arrives:

  1. Load the user's most recent baseline for the configured metric type
  2. Count the user's events for the current day
  3. If the count exceeds the minimum threshold and the z-score (current - baseline) / stddev meets or exceeds threshold_sigma, the rule fires

This prevents false positives on low-activity days (the min_count floor) and on users without sufficient historical data (no baseline row means no fire).

Off-Hours Access ​

The off-hours detector evaluates the event's timestamp against a configurable business-hours window. The default configuration flags activity between 10 PM and 6 AM. The hour comparison handles wrap-around correctly: when start_hour > end_hour, the detector matches events where hour >= start_hour OR hour < end_hour.

Geographic Anomaly ​

The geographic anomaly detector counts distinct IP addresses for a user within the current day. If the distinct count exceeds max_countries_per_day, the rule fires. The pattern also supports a blocked_countries list for geo-fencing, though the current implementation focuses on IP diversity as a proxy for geographic dispersion.

Data Exfiltration ​

The data exfiltration detector is specifically scoped to data export events: data.file_download, data.report_export, data.audit_export, and data.consensus_export. When one of these events occurs:

  1. Count all data.* events for the user in the last hour
  2. If below min_count, do not fire (insufficient signal)
  3. Load the user's file_downloads baseline
  4. If baseline exists with positive stddev, apply sigma threshold
  5. If no baseline exists, fall back to a 2x multiplier of min_count as the absolute cap

This layered approach ensures the detector works both for users with established baselines and for new users or first-time exporters.

Access Pattern ​

The access pattern detector counts events matching a configured set of resource types within a one-hour sliding window. If the count exceeds max_per_hour, the rule fires. This catches scenarios like rapid-fire API key rotation, exhaustive memory recall queries, or repetitive file access that would not individually trigger other rules.

Custom ​

The custom IOC type provides maximum flexibility. Administrators define a regular expression for event_type matching and an optional detail_match dictionary of exact key-value matches against the event's details JSON. This enables rules like "flag any authz.role_change event where role equals admin" without requiring a code deployment.

3.3 Evaluation Pipeline ​

Event arrives in AuditLogger.log()
    │
    ▼
Skip check: action starts with pii.*, memory.recall, system.rate_limit?
    │ No
    ▼
Load enabled IOC definitions for org (cached, 60s TTL)
    │
    ▼
For each IOC definition:
    │
    ├─ Dispatch to type-specific check method
    │     volume_spike → _check_volume_spike()
    │     off_hours    → _check_off_hours()
    │     geo_anomaly  → _check_geo_anomaly()
    │     data_exfil   → _check_data_exfil()
    │     access_pattern → _check_access_pattern()
    │     custom       → _check_custom()
    │
    ├─ Match? → Build match record (ioc_definition_id, org, user, session,
    │           event_type, event_data JSON, timestamp)
    │
    └─ Error? → Log at debug level, continue to next IOC (fault isolation)

Persist all matches to ioc_matches table
Dispatch alerts for each match via configured channels

Each IOC definition can fail independently without affecting evaluation of other rules. This fault isolation ensures that a malformed pattern or transient database issue does not silence the entire detection layer.

3.4 Caching Strategy ​

IOC definitions are cached per-organization with a 60-second TTL to avoid querying the database on every audit event. The cache is explicitly invalidated whenever an IOC definition is created, updated, or deleted through the API. This balances performance (most orgs will have a stable set of IOC rules that change infrequently) with freshness (rule changes propagate within seconds, not minutes).


4. Behavioral Anomaly Detection ​

4.1 Baseline Computation ​

The insider risk service computes rolling 30-day behavioral baselines for every active user. The computation runs as a nightly scheduled job and can also be triggered on demand via the admin API.

For each user, six metric dimensions are computed:

MetricSourceComputation
event_count (per category)user_audit_logs grouped by action prefixDaily mean and population stddev across 9 categories: authentication, authorization, data_access, chat, mcp, settings, memory, compliance, billing
pii_volumetool_execution_log.pii_countSum of PII entities detected per day
session_countuser_audit_logs filtered on conversation creation eventsConversations initiated per day
file_downloadsuser_audit_logs filtered on data.file_downloadFile download count per day
off_hours_activityuser_audit_logs timestamps evaluated against 8 PM - 6 AM windowEvent count outside business hours per day
geo_distinct_ipsuser_audit_logs.ip_addressCount of distinct IP addresses per day

The standard deviation for event_count is computed from actual daily counts over the lookback window, with zero-padding for days with no activity. This prevents the stddev from being artificially inflated by only counting active days.

Baselines are stored in the user_activity_baseline table with a composite unique constraint on (organization_id, user_id, metric_type, metric_name, period_start), enabling upsert semantics that prevent duplicate entries on re-computation.

4.2 Z-Score Anomaly Detection ​

The anomaly detection algorithm compares current-period metric values against stored baselines using z-score analysis:

z = (current_value - baseline_value) / stddev

Three detection modes ensure coverage across different data conditions:

ConditionDetection Method
stddev > 0 and sample_count >= 3Standard z-score comparison against configurable thresholds
stddev <= 0 or sample_count < 3Ratio check: fire if current > baseline * 5
Absolute threshold exceededHard caps independent of baseline: request_count > 1,000, data_download_mb > 500, export_count > 50, failed_auth > 100

Severity Classification ​

Z-Score RangeSeverity
z >= critical_threshold (default 3.5)Critical
warning_threshold <= z < critical_threshold (default 2.5)Warning
z < warning_thresholdNot flagged

Both thresholds are configurable per scan via the API, allowing administrators to tune sensitivity based on their organization's risk tolerance.

Deduplication ​

Each anomaly receives a deterministic ID computed as MD5(org_id:user_id:metric_type:metric_name:date)[:16]. This ensures that the same anomaly detected across multiple scan runs within a single day produces the same ID, preventing duplicate alerts.

4.3 Warm-Up and Cold-Start Handling ​

New users or organizations without 30 days of history still receive protection through several fallback mechanisms:

  • The ratio check (5x baseline) catches extreme deviations even when stddev cannot be meaningfully computed
  • Absolute thresholds fire regardless of baseline state, providing a floor of detection for all users
  • IOC rules (particularly off_hours, custom, and access_pattern) do not depend on baselines at all, providing immediate coverage from day one

5. Data Model ​

5.1 IOC Definitions ​

sql
CREATE TABLE ioc_definitions (
    id              TEXT PRIMARY KEY,
    organization_id TEXT NOT NULL,
    name            TEXT NOT NULL,
    description     TEXT DEFAULT '',
    ioc_type        TEXT NOT NULL,       -- volume_spike | off_hours | geo_anomaly |
                                         -- data_exfil | access_pattern | custom
    pattern         TEXT NOT NULL,       -- JSON pattern schema
    severity        TEXT DEFAULT 'medium', -- low | medium | high | critical
    enabled         INTEGER DEFAULT 1,
    alert_channels  TEXT DEFAULT '["webhook"]', -- JSON array
    metadata        TEXT DEFAULT '{}',   -- JSON, extensible
    created_by      TEXT NOT NULL,
    created_at      TEXT DEFAULT CURRENT_TIMESTAMP,
    updated_at      TEXT DEFAULT CURRENT_TIMESTAMP
);

5.2 IOC Match History ​

sql
CREATE TABLE ioc_matches (
    id                  SERIAL PRIMARY KEY,
    organization_id     TEXT NOT NULL,
    ioc_definition_id   TEXT NOT NULL,
    user_id             TEXT,
    session_id          TEXT,
    event_type          TEXT NOT NULL,
    event_data          TEXT DEFAULT '{}',  -- Full event JSON
    matched_at          TEXT DEFAULT CURRENT_TIMESTAMP,
    acknowledged        INTEGER DEFAULT 0,
    acknowledged_by     TEXT,
    acknowledged_at     TEXT,
    FOREIGN KEY (ioc_definition_id) REFERENCES ioc_definitions(id) ON DELETE CASCADE
);

The acknowledged flag and associated fields support SOC triage workflows: analysts can acknowledge matches to distinguish reviewed events from new alerts. The cascade delete ensures match history is cleaned up when IOC definitions are removed.

5.3 User Activity Baselines ​

sql
CREATE TABLE user_activity_baseline (
    id                SERIAL PRIMARY KEY,
    organization_id   TEXT NOT NULL,
    user_id           TEXT NOT NULL,
    period_start      TEXT NOT NULL,
    period_end        TEXT NOT NULL,
    metric_type       TEXT NOT NULL,
    metric_name       TEXT NOT NULL,
    baseline_value    REAL NOT NULL,
    stddev            REAL DEFAULT 0,
    sample_count      INTEGER DEFAULT 0,
    created_at        TEXT DEFAULT CURRENT_TIMESTAMP,
    UNIQUE(organization_id, user_id, metric_type, metric_name, period_start)
);

6. SIEM Integration ​

Both IOC matches and behavioral anomalies emit structured events to the enterprise SIEM pipeline through the unified audit event bus.

6.1 Event Types ​

Event TypeDescriptionMITRE ATT&CKCompliance
insider_risk.ioc_matchedAn event matched an IOC rule definitionT1078 (Valid Accounts)SOC2-CC6.1, SOC2-AE2.2, HIPAA-164.312(b)
insider_risk.anomaly_detectedBehavioral anomaly detected against user activity baselineT1078 (Valid Accounts)SOC2-CC6.1, SOC2-AE2.2, HIPAA-164.312(b)

6.2 Event Payload ​

IOC match events include:

json
{
  "ioc_name": "After-hours bulk download",
  "ioc_type": "off_hours",
  "event_type": "data.file_download",
  "severity": "high"
}

Anomaly detection events include:

json
{
  "metric_type": "off_hours_activity",
  "metric_name": "total",
  "current_value": 45,
  "baseline_value": 3.2,
  "deviation": 4.1,
  "severity": "critical"
}

These payloads are formatted by the SIEM event emitter into the customer's chosen format (JSON, CEF, LEEF, Splunk HEC, Microsoft Sentinel, or OCSF) and delivered via webhook push or pull API.

6.3 Correlation with Existing SOC Workflows ​

The MITRE ATT&CK T1078 mapping enables SOC teams to correlate GhostAI IOC and anomaly events with existing detection rules for valid-account abuse. For example, a SIEM rule that combines insider_risk.ioc_matched (type: geo_anomaly) with VPN login events from the identity provider can produce a high-confidence alert for account takeover that neither system could generate alone.


7. API Reference ​

All endpoints are authenticated and scoped to the caller's organization.

7.1 IOC Management ​

MethodEndpointDescription
POST/api/insider-risk/iocsCreate an IOC definition
GET/api/insider-risk/iocsList IOC definitions (filterable by type, enabled status)
PUT/api/insider-risk/iocs/{id}Update an IOC definition
DELETE/api/insider-risk/iocs/{id}Delete an IOC definition

7.2 IOC Match History ​

MethodEndpointDescription
GET/api/insider-risk/ioc-matchesList matches (filterable by IOC ID, acknowledgment status; max 500)
POST/api/insider-risk/ioc-matches/{id}/acknowledgeAcknowledge a match

7.3 Behavioral Baselines ​

MethodEndpointDescription
GET/api/insider-risk/baselinesList per-user baseline summaries
GET/api/insider-risk/baselines/{user_id}Get detailed baseline metrics for a user
POST/api/insider-risk/baselines/computeTrigger baseline recomputation (configurable period and lookback)

7.4 Anomaly Detection ​

MethodEndpointDescription
GET/api/insider-risk/anomaliesList recent anomaly detections (max 200)
POST/api/insider-risk/anomalies/scanRun anomaly scan on demand (configurable thresholds)
POST/api/insider-risk/ioc-evaluateRun batch IOC evaluation over a time window (1-24 hours)

8. Admin UI ​

The detection results surface in the GhostAI admin console through the Tool Security Center, accessible at Admin Dashboard > Security > Tool Security > Anomalies & Recommendations.

The panel provides:

  • Anomaly list with severity color coding (critical = red, warning = yellow, info = blue), user attribution, metric details, z-score deviation values, and detection timestamps
  • Recommendation list with priority classification (high, medium, low)
  • Time-period selector (last hour, 24 hours, 7 days, 30 days)
  • Anomaly-to-tool drill-down — clicking an anomaly navigates to the affected tool's security detail view

The same view is available in the Platform Admin Console under the Tool Risk tab for multi-tenant operators.


9. Compliance Alignment ​

FrameworkRequirementHow IOC/Anomaly Detection Addresses It
SOC 2 CC6.1Logical access security controlsIOC rules detect unauthorized access patterns; anomaly baselines identify deviation from authorized behavior
SOC 2 AE2.2Anomaly detection in the operating environmentBehavioral baselines with z-score analysis directly satisfy this criterion
HIPAA 164.312(b)Audit controls — mechanisms to record and examine activity in systems containing ePHIIOC match history and anomaly records provide immutable audit trail; SIEM emission enables centralized review
PCI-DSS 10.6Review logs and security events to identify anomalies or suspicious activityAutomated anomaly detection replaces manual log review; configurable thresholds adapt to each org's volume
GDPR Art. 32Appropriate technical measures to ensure security of processingReal-time IOC evaluation and behavioral anomaly detection constitute continuous monitoring
FedRAMP SI-4Information system monitoringDual-layer detection with SIEM integration satisfies continuous monitoring requirements
NIST 800-53 SI-4System monitoring — detect attacks and unauthorized connectionsSix IOC types cover the attack categories specified; geographic anomaly detection addresses unauthorized geographic access

10. Operational Best Practices ​

Rule NameTypePatternSeverity
After-hours bulk downloadoff_hours{"start_hour": 22, "end_hour": 6}High
Query volume spikevolume_spike{"metric": "event_count", "threshold_sigma": 3.0, "min_count": 20}High
PII volume spikevolume_spike{"metric": "pii_volume", "threshold_sigma": 3.0, "min_count": 20}Critical
Geographic anomalygeo_anomaly{"max_countries_per_day": 3, "blocked_countries": []}High
Bulk data exportdata_exfil{"metric": "file_downloads", "threshold_sigma": 3.0, "min_count": 10}Critical
Rapid API key accessaccess_pattern{"resource_types": ["settings.api_key_view"], "max_per_hour": 5}High
Admin role escalationcustom{"event_type_regex": "authz\\.role_change", "detail_match": {"role": "admin"}}Critical

10.2 Tuning Thresholds ​

  • Start with defaults (warning: 2.5 sigma, critical: 3.5 sigma) and observe alert volume for two weeks
  • Lower thresholds for high-security environments (healthcare, financial services): warning: 2.0, critical: 3.0
  • Raise thresholds for high-activity environments (developer platforms, internal tools): warning: 3.0, critical: 4.0
  • Use the min_count floor to suppress false positives from low-volume users — a user with 5 events per day cannot meaningfully spike

10.3 Baseline Warm-Up ​

  • Baselines require a minimum of 3 sample days to produce meaningful stddev values
  • The ratio fallback (5x baseline) provides interim protection during the warm-up period
  • Absolute thresholds provide day-one protection regardless of baseline state
  • Consider running POST /api/insider-risk/baselines/compute with a 30-day lookback immediately after deployment to seed baselines from existing audit history

11. Test Coverage ​

The IOC evaluation engine and behavioral anomaly detection are covered by:

  • Unit tests (tests/unit/services/test_ioc_evaluator.py) — IOC cache lifecycle, all six IOC type check methods, full evaluate pipeline, batch evaluation, match persistence, and alert dispatch (webhook and email)
  • Unit tests (tests/unit/services/test_insider_risk_service.py) — baseline computation, anomaly detection, SIEM emission
  • Integration tests (tests/integration/test_insider_risk_pipeline.py) — end-to-end flow from audit event through IOC evaluation, baseline computation, anomaly detection, and SIEM emission

12. Conclusion ​

GhostAI's IOC and anomaly detection architecture provides continuous, multi-layered monitoring purpose-built for the AI platform threat model. The combination of deterministic IOC rules for known-bad patterns and adaptive behavioral baselines for unknown deviations ensures comprehensive coverage from day one, with increasing precision as baselines mature. Full SIEM integration, structured MITRE ATT&CK mapping, and compliance-aligned event cataloging enable security teams to incorporate AI platform monitoring into existing SOC workflows without building custom integrations.

The system is designed to reduce alert fatigue — configurable sigma thresholds, minimum count floors, absolute hard caps, and hourly deduplication ensure that alerts represent genuine deviations from established patterns rather than statistical noise. At the same time, the fault-isolated evaluation pipeline ensures that no single malformed rule or transient error can silence the detection layer.

For organizations deploying AI at scale, this architecture provides the continuous monitoring, audit trail, and anomaly detection required by SOC 2, HIPAA, PCI-DSS, GDPR, FedRAMP, and NIST 800-53 — while addressing the AI-specific threats that traditional security tooling was not designed to detect.

SOC 2 Type II Certified | BAA Available | HIPAA-Ready