Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
5f48aff
feat: add anomaly detection configuration for HTTPS traffic
eldraco Feb 14, 2026
33f96d2
feat: add HTTPS anomaly detection configuration parameters
eldraco Feb 14, 2026
c74f0f0
feat: implement HTTPS anomaly detection module with adaptive baselines
eldraco Feb 14, 2026
e7f6a79
feat: add license and copyright information to HTTPS anomaly detectio…
eldraco Feb 14, 2026
3271eec
feat: add comprehensive README for HTTPS anomaly detection module
eldraco Feb 14, 2026
d404d05
feat: enhance anomaly detection with confidence scoring and history m…
eldraco Feb 14, 2026
a7bc8cc
feat: update README to clarify data source and processing details for…
eldraco Feb 14, 2026
b3dc381
feat: implement analyze_ad_log.py for generating HTML reports from HT…
eldraco Feb 14, 2026
ead44f4
feat: enhance event handling and reporting in analyze_ad_log.py with …
eldraco Feb 15, 2026
10ef73d
feat: add detailed output features to README for anomaly detection mo…
eldraco Feb 15, 2026
bfae01d
feat: update anomaly_detection_https training_hours to enable online …
eldraco Feb 15, 2026
0a1e58c
feat: remove log_emojis and log_colors options from anomaly_detection…
eldraco Feb 15, 2026
ede48f1
feat: enhance anomaly detection with evidence emission and statistica…
eldraco Feb 15, 2026
fc9ec3d
feat: implement configurable "assume-benign" training and enhance ano…
eldraco Feb 15, 2026
9cdc4c4
feat: update anomaly_detection_https training_hours to 24 for improve…
eldraco Feb 19, 2026
a66c1d2
feat: enhance ProcessManager to initialize processes list and update …
eldraco Feb 19, 2026
6fbf9af
feat: enhance EWMAStats for Welford online moments and add training m…
eldraco Feb 19, 2026
3818593
feat: enhance anomaly detection documentation with two-stage baseline…
eldraco Feb 19, 2026
624adee
feat: add JA3 change sensitivity configuration for anomaly detection
eldraco Feb 19, 2026
d49a022
feat: add server-specific JA3 tracking and limit for anomaly detection
eldraco Feb 19, 2026
fb19871
feat: add HTTPS anomaly detection JA3 minimum variants per server con…
eldraco Feb 19, 2026
fb7bf14
feat: refine JA3 anomaly detection with server-specific variant limit…
eldraco Feb 19, 2026
299e6b4
feat: update JA3 change sensitivity description for anomaly detection
eldraco Feb 20, 2026
3595f7a
feat: add confidence score series and training window detection to an…
eldraco Feb 20, 2026
77e68a7
feat: update JA3S novelty anomaly handling and enhance hourly feature…
eldraco Feb 20, 2026
99cdd66
feat: enhance JA3 change tracking and refine anomaly detection logic
eldraco Feb 20, 2026
8bcbfc8
feat: add transition timestamp updates and enhance SVG chart markers …
eldraco Feb 20, 2026
67f9570
feat: clarify transition markers in anomaly detection report
eldraco Feb 20, 2026
571a0f8
feat: set training_hours to 0 for immediate anomaly detection baselin…
eldraco Feb 22, 2026
5865534
feat: enhance SVG chart with dynamic legend and add anomaly summary b…
eldraco Feb 22, 2026
9c5e5f9
feat: add interactive offline charts and anomaly summary table to README
eldraco Feb 22, 2026
d7df844
feat: add source and destination ports to SMTP flow class
eldraco Feb 23, 2026
5e6f042
feat: add method to filter unknown class fields in Zeek flow processing
eldraco Feb 23, 2026
ae3702c
feat: enhance anomaly detection logging with detailed reasons and values
eldraco Feb 23, 2026
2856887
feat: add example image for Slips-AD documentation
eldraco Feb 23, 2026
d4f6686
feat: add HTTPS anomaly detection module description to documentation
eldraco Feb 23, 2026
b3c1896
feat: add HTTPS anomaly detection section to documentation
eldraco Feb 23, 2026
714ac94
feat: add comprehensive documentation for HTTPS anomaly detection module
eldraco Feb 23, 2026
58fcf50
feat: add anomaly detection configuration for HTTPS traffic
eldraco Feb 14, 2026
833aad3
feat: add HTTPS anomaly detection configuration parameters
eldraco Feb 14, 2026
238d6c6
feat: implement HTTPS anomaly detection module with adaptive baselines
eldraco Feb 14, 2026
9f68db9
feat: add license and copyright information to HTTPS anomaly detectio…
eldraco Feb 14, 2026
7455c8e
feat: add comprehensive README for HTTPS anomaly detection module
eldraco Feb 14, 2026
e601c75
feat: enhance anomaly detection with confidence scoring and history m…
eldraco Feb 14, 2026
4abe7db
feat: update README to clarify data source and processing details for…
eldraco Feb 14, 2026
b183fc1
feat: implement analyze_ad_log.py for generating HTML reports from HT…
eldraco Feb 14, 2026
f5cdf5e
feat: enhance event handling and reporting in analyze_ad_log.py with …
eldraco Feb 15, 2026
4bffa73
feat: add detailed output features to README for anomaly detection mo…
eldraco Feb 15, 2026
e4f48c4
feat: update anomaly_detection_https training_hours to enable online …
eldraco Feb 15, 2026
c1ce897
feat: remove log_emojis and log_colors options from anomaly_detection…
eldraco Feb 15, 2026
fc6bfbb
feat: enhance anomaly detection with evidence emission and statistica…
eldraco Feb 15, 2026
88e41df
feat: implement configurable "assume-benign" training and enhance ano…
eldraco Feb 15, 2026
bdb5c62
feat: update anomaly_detection_https training_hours to 24 for improve…
eldraco Feb 19, 2026
0bfc2d3
feat: enhance ProcessManager to initialize processes list and update …
eldraco Feb 19, 2026
43450cf
feat: enhance EWMAStats for Welford online moments and add training m…
eldraco Feb 19, 2026
f36cdce
feat: enhance anomaly detection documentation with two-stage baseline…
eldraco Feb 19, 2026
68d8d0c
feat: add JA3 change sensitivity configuration for anomaly detection
eldraco Feb 19, 2026
45f4edc
feat: add server-specific JA3 tracking and limit for anomaly detection
eldraco Feb 19, 2026
699a41c
feat: add HTTPS anomaly detection JA3 minimum variants per server con…
eldraco Feb 19, 2026
e58c566
feat: refine JA3 anomaly detection with server-specific variant limit…
eldraco Feb 19, 2026
6e1b4b8
feat: update JA3 change sensitivity description for anomaly detection
eldraco Feb 20, 2026
78273d8
feat: add confidence score series and training window detection to an…
eldraco Feb 20, 2026
cac17fb
feat: update JA3S novelty anomaly handling and enhance hourly feature…
eldraco Feb 20, 2026
ed1dfcb
feat: enhance JA3 change tracking and refine anomaly detection logic
eldraco Feb 20, 2026
2df97b5
feat: add transition timestamp updates and enhance SVG chart markers …
eldraco Feb 20, 2026
91ef8ee
feat: clarify transition markers in anomaly detection report
eldraco Feb 20, 2026
0dbcd70
feat: set training_hours to 0 for immediate anomaly detection baselin…
eldraco Feb 22, 2026
b89d9a1
feat: enhance SVG chart with dynamic legend and add anomaly summary b…
eldraco Feb 22, 2026
fd28115
feat: add interactive offline charts and anomaly summary table to README
eldraco Feb 22, 2026
05f414e
feat: add source and destination ports to SMTP flow class
eldraco Feb 23, 2026
77da9e0
feat: add method to filter unknown class fields in Zeek flow processing
eldraco Feb 23, 2026
3314361
feat: enhance anomaly detection logging with detailed reasons and values
eldraco Feb 23, 2026
7a40f2e
feat: add example image for Slips-AD documentation
eldraco Feb 23, 2026
4fcf5a2
feat: add HTTPS anomaly detection module description to documentation
eldraco Feb 23, 2026
10fb1fb
feat: add HTTPS anomaly detection section to documentation
eldraco Feb 23, 2026
45a61fc
feat: add comprehensive documentation for HTTPS anomaly detection module
eldraco Feb 23, 2026
50ec582
Merge branch 'sebas-AD-https' of github.com:stratosphereips/Stratosph…
eldraco Feb 24, 2026
cb931d3
feat: add ADWIN-based drift detection options to anomaly_detection_ht…
eldraco Feb 24, 2026
c2c828c
feat: add optional ADWIN drift detection parameters to configuration
eldraco Feb 24, 2026
eb0a358
feat: integrate ADWIN drift detection into HTTPS anomaly detection mo…
eldraco Feb 24, 2026
2425e3d
feat: add ADWIN drift detection configuration options for HTTPS anoma…
eldraco Feb 24, 2026
d43df84
feat: enable ADWIN drift detection for HTTPS anomaly detection
eldraco Feb 24, 2026
d195e91
feat: update documentation to include default ADWIN drift detection s…
eldraco Feb 24, 2026
8801a6d
feat: enhance ADWIN integration with separate hourly and flow models …
eldraco Feb 24, 2026
9318fae
feat: enable ADWIN drift detection by default in HTTPS anomaly detect…
eldraco Feb 24, 2026
3dbe959
feat: enable ADWIN drift detection for HTTPS anomaly detection by def…
eldraco Feb 24, 2026
9d2228c
feat: add source and destination ports to SMTP login and brute force …
eldraco Feb 24, 2026
eed09a6
feat: add source and destination ports to SMTP brute force test cases
eldraco Feb 24, 2026
0462572
feat: enhance ADWIN drift detection logic for hourly and flow paths i…
eldraco Feb 24, 2026
0f8f672
feat: add ADWIN drift trigger details to README for anomaly detection…
eldraco Feb 24, 2026
9d8764e
feat: enhance documentation for ADWIN drift detection with raw signal…
eldraco Feb 24, 2026
1d44cf7
feat: refactor ADWIN handling to support multiple signals in anomaly …
eldraco Feb 24, 2026
2913806
feat: add performance impact details for ADWIN updates in anomaly det…
eldraco Feb 24, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions config/slips.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,51 @@ flowmldetection:
# 'Malicious' data in order for the test to work.
mode: test

#############################
anomaly_detection_https:
# Number of initial hours used to train the baseline model assuming benign traffic.
# If set to 0, detection starts immediately and baseline is learned online.
training_hours: 0

# Thresholds for anomaly detection in hourly and per-flow checks.
hourly_zscore_threshold: 3.0
flow_zscore_threshold: 3.5

# If hourly anomaly score is lower than this, treat it as drift and adapt.
adaptation_score_threshold: 2.0

# Adaptation speed for baseline updates.
baseline_alpha: 0.1
drift_alpha: 0.05
suspicious_alpha: 0.005

# Minimum baseline history required before z-score checks are applied.
min_baseline_points: 6

# Max flow anomalies in an hour still considered "small drift".
max_small_flow_anomalies: 1

# Optional ADWIN-based drift trigger (river).
# If true, drift/suspicious update is decided only after ADWIN signals drift.
# If false, Slips uses the previous threshold-only drift logic.
use_adwin_drift: true
adwin_delta: 0.002
adwin_clock: 32
adwin_grace_period: 10
adwin_min_window_length: 5

# JA3 statistical fallback gate used only when training_hours = 0.
# If there is no benign training period, ja3_changes is not scored
# until this minimum hourly value is reached.
ja3_min_variants_per_server: 3

# Operational logging verbosity:
# 0: disabled
# 1: important events only (detections, drift, training fit, stop/start)
# 2: + hourly summaries (recommended)
# 3: + per-flow arrivals and model update details
log_verbosity: 3

#############################
virustotal:
# This is the path to the API key. The file should contain the key at the
Expand Down
6 changes: 6 additions & 0 deletions docs/detection_modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ tr:nth-child(even) {

</table>

## HTTPS Anomaly Detection Module

For the full technical description of the HTTPS anomaly detector (features, training, adaptation, z-score logic, evidence format, and configuration), see:

- [HTTPS Anomaly Detection](https_anomaly_detection.md)



### Virustotal Module
Expand Down
192 changes: 192 additions & 0 deletions docs/https_anomaly_detection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# HTTPS Anomaly Detection Module

This document describes how the `anomaly_detection_https` module detects anomalies from TLS/HTTPS traffic in Slips.

![HTTPS anomaly detection example](images/Slips-AD-example.png)

## Goal

Detect unusual HTTPS behavior per host, using:

- Hourly behavior changes (volume and novelty patterns).
- Flow-level deviations (for known servers).
- Adaptive baselines that update over time, with poisoning resistance.

## Input data used

The module subscribes to SSL/TLS events and reads related connection metadata from DB for the same UID.

Main fields used:

- SSL: `uid`, `server_name` (SNI), `ja3`, `ja3s`, `dport`, `sport`
- Conn (correlated): destination IP, total bytes, timing info

## Traffic-time logic

All detection windows are based on **traffic timestamps** (packet/log time), not wall clock time.

This keeps behavior consistent for:

- live interface capture,
- live Zeek folder input,
- offline PCAP,
- offline Zeek logs.

## Features

The module computes per-host hourly features:

- `ssl_flows`: number of SSL flows in the hour.
- `unique_servers`: number of distinct destination servers.
- `new_servers`: number of servers not seen before for that host.
- `ja3_changes`: number of new JA3 variants seen per server in the hour.
- `known_server_avg_bytes`: mean bytes for flows to already-known servers.

Flow-level feature:

- `bytes_to_known_server`: per-server bytes deviation on each flow.

## Baseline and training

Each host has independent models.

### Training phase (`training_hours > 0`)

For the first configured benign hours, the module does **fit-only** (Welford online moments):

- no detection decisions are emitted from hourly z-score rules before training ends,
- baseline mean/variance are learned strongly from this period.

### No explicit training (`training_hours = 0`)

Detection starts immediately using online adaptation.

Special fallback only for `ja3_changes`:

- if hourly `ja3_changes < ja3_min_variants_per_server`, that hourly signal is ignored until enough activity exists.

## Scoring

Each modeled feature uses z-score:

- `z = |x - mean| / std_effective`
- `std_effective` uses variance with a robust minimum floor to avoid unstable near-zero std.

Thresholds:

- `hourly_zscore_threshold` for hourly features
- `flow_zscore_threshold` for flow bytes to known servers

## Adaptation states

After each hour closes, the module chooses model update mode:

1. `training_fit`
During benign training: Welford fit (no EWMA alpha).

2. `drift_update`
If anomaly score is small (`hourly_score <= adaptation_score_threshold`) and flow anomaly count is small (`<= max_small_flow_anomalies`), update with `drift_alpha`.

3. `suspicious_update`
Otherwise update with `suspicious_alpha` (much smaller), to limit poisoning.

For normal non-anomalous periods outside training, per-feature EWMA uses `baseline_alpha`.

### Optional ADWIN drift trigger

If `use_adwin_drift=true` and `river` is installed, ADWIN is used as drift trigger in both paths:

- **Hourly path**: ADWIN receives `hourly_adwin_score` (sum of hourly feature z-scores).
- **Flow path**: ADWIN receives `flow_score` (sum of reason z-scores, novelty reasons mapped to a small fixed score).
- ADWIN drift detected -> classify as `drift_update` or `suspicious_update` using existing thresholds.
- No ADWIN drift -> use `baseline_update` (`baseline_alpha`).
- During benign training, ADWIN is still warmed with benign scores to reduce cold-start noise after training.

Why raw signals:

- drift is a distribution change in the observed variables, so ADWIN tracks the raw feature streams directly,
- z-scores are still used for anomaly magnitude and evidence reasons, but not as the primary drift input.

Performance note:

- hourly ADWIN cost scales with hourly feature count,
- flow ADWIN cost scales with per-flow signal count,
- both are constant-time scalar updates and usually lightweight.

## New server vs JA3 behavior

- `new_servers` is modeled as an hourly statistical feature and adapted over time.
- `new_server` can also appear as a direct flow-level novelty reason.
- `ja3_changes` is handled statistically at hourly level (with fallback gate only when training is zero).
- `new_ja3s` can appear as direct flow-level novelty reason.

## Confidence and threat level

Each detection computes confidence score `[0,1]` from multiple factors:

- anomaly severity,
- persistence in recent history,
- baseline quality,
- multi-signal agreement.

Mapped levels:

- low / medium / high confidence

Threat level used in evidence:

- `low` for low or medium confidence
- `medium` for high confidence

## Evidence format

Evidence description is human-readable and concise:

`HTTPS anomaly: type=<type>; confidence=<level> (<score>); reason=<reason>; value=<value>; why=<explanation>.`

Examples of reasons:

- New Server
- New JA3S
- Bytes to Known Server
- Hourly feature deviations (e.g., New Servers Count, JA3 Changes)

## Configuration keys

Section: `anomaly_detection_https` in `config/slips.yaml`.

Main keys:

- `training_hours`
- `hourly_zscore_threshold`
- `flow_zscore_threshold`
- `adaptation_score_threshold`
- `baseline_alpha`
- `drift_alpha`
- `suspicious_alpha`
- `min_baseline_points`
- `max_small_flow_anomalies`
- `ja3_min_variants_per_server`
- `use_adwin_drift`
- `adwin_delta`
- `adwin_clock`
- `adwin_grace_period`
- `adwin_min_window_length`
- `log_verbosity`

Default: `use_adwin_drift=true`.

Reference:

- River ADWIN: https://riverml.xyz/latest/api/drift/ADWIN/

## Operational logs

The module logs key events such as:

- flow arrivals,
- hour close and computed features,
- training fit updates,
- drift updates,
- suspicious updates,
- detections and emitted evidence.
Binary file added docs/images/Slips-AD-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ This documentation gives an overview how Slips works, how to use it and how to h

- **Detection modules**. Explanation of detection modules in Slips, types of input and output. See :doc:`Detection modules <detection_modules>`.

- **HTTPS anomaly detection**. Detailed design and behavior of the HTTPS anomaly detector. See :doc:`HTTPS anomaly detection <https_anomaly_detection>`.

- **Architecture**. Internal architecture of Slips (profiles, timewindows), the use of Zeek and connection to Redis. See :doc:`Architecture <architecture>`.

- **Training with your own data**. Explanation on how to re-train the machine learning system of Slips with your own traffic (normal or malicious).See :doc:`Training <training>`.
Expand Down Expand Up @@ -49,6 +51,7 @@ This documentation gives an overview how Slips works, how to use it and how to h
usage
architecture
detection_modules
https_anomaly_detection
flowalerts
features
training
Expand Down
4 changes: 4 additions & 0 deletions managers/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from typing import (
List,
Tuple,
Dict,
Iterable,
)

from exclusiveprocess import (
Expand Down Expand Up @@ -52,6 +54,8 @@
class ProcessManager:
def __init__(self, main):
self.main = main
# Can be used by signal handlers before startup finishes.
self.processes: List[Process] = []

# this is the queue that will be used by the input proces
# to pass flows to the profiler
Expand Down
Loading
Loading