Behavioral baselines, dwell time, and the attacker that rules never catch
Your IDS ruleset is a list of things you already know about. It catches the attacks that were common enough, documented enough, and obvious enough for someone to write a signature for. It is, by definition, a catalog of the past.
The attacker who moves slowly, uses valid credentials, and mimics normal behavior does not trip those rules. Not because your rules are wrong — they are correct for what they describe. But because this attacker is not doing anything your rules recognize as an attack.
This is the gap AI-assisted intrusion detection is designed to close. Not by replacing your rules, but by adding a layer underneath them that watches for deviation rather than known signatures.
A behavioral baseline is a statistical model of what normal looks like for a specific entity — a user, a host, a service, a network segment. It is built from historical data and answers questions like:
| Entity | Baseline questions |
|---|---|
| User account | When do they typically log in? From where? Which systems do they SSH to? What commands do they run? How much data do they typically move? |
| Server | What services does it run? What outbound connections are normal? What is typical CPU, memory, disk I/O, and network throughput for this time of day? |
| Service account | Does it ever log in interactively? Which hosts does it connect from? What is normal query volume for a database service account? |
| Network segment | What protocols are normal here? What destinations? What is typical bandwidth? Does traffic in this segment ever go to external IPs? |
Once you have a baseline, you have a definition of normal. Anything that deviates significantly from that baseline is an anomaly — worth investigating, even if no rule fired.
Dwell time is the gap between when an attacker gains access and when they are detected. It is the single most important number in your security posture that most shops do not track.
Industry data consistently puts median dwell time in the range of weeks to months. The attackers responsible for the worst breaches — ransomware gangs, nation-state actors, sophisticated criminal groups — are not the ones who trigger your IDS the moment they get in. They are the ones who spend weeks or months moving quietly before anyone notices.
Each of those behavioral signals is invisible to a rule-based system unless someone specifically wrote a rule for it. A behavioral baseline catches them because they all represent deviation from what is normal for that entity.
Lateral movement is how attackers go from one compromised host to everything else you care about. It is also the detection problem that exposes the limits of perimeter-focused security.
Once an attacker is inside your network using valid credentials, the traffic looks legitimate. SSH from host A to host B using a real account is not an attack — it is something your sysadmins do every day. The difference is context:
| Signal | Rule-based view | Behavioral view |
|---|---|---|
SSH login: user jsmith → db-prod-01 |
Valid credentials. Allow. | jsmith has never accessed db-prod-01 in 18 months of baseline. Flag for review. |
New cron job added on web-01 |
Valid admin action. No rule. | Added at 02:47 AM, outside any known change window. Anomaly score elevated. |
Service account reads /etc/shadow |
Permitted by file ACL. | This service account has never read /etc/shadow. High anomaly. Immediate alert. |
Outbound connection on port 443 from db-prod-01 |
HTTPS is permitted. Allow. | db-prod-01 has never made outbound connections. Destination is a cloud storage endpoint. High anomaly. |
None of those rule-based responses are wrong. The rules are working as designed. Behavioral analysis adds the question that rules cannot ask: is this normal for this entity?
Under the hood, modern AI-assisted detection tools use several techniques. You do not need to implement these yourself — but understanding what the tool is doing helps you tune it, trust its output, and know when it is lying to you.
The simplest form. For each entity, the tool maintains statistical distributions of normal behavior — login times, connection counts, data volumes, command frequency. Events that fall outside expected ranges get an anomaly score. High scores trigger alerts.
Fast to build, fast to query, easy to explain to management. Also easy to evade if an attacker moves slowly enough to stay within statistical norms.
Instead of comparing a user only to their own history, compare them to a peer group — other accounts with similar roles, access levels, and usage patterns. If every other DBA connects from the corporate VPN and one suddenly connects from a residential IP in another country, that is an anomaly even if that user has no personal baseline to compare against.
Useful for new accounts and for detecting compromised credentials where the attacker matches the user's own behavioral history.
Individual events look legitimate. The sequence of events is the tell. Login → read passwd → read shadow → enumerate home directories → compress files → outbound connection. Each step alone is explainable. The sequence is a kill chain.
AI tools that do sequence analysis maintain short-term memory of event chains per entity and score sequences that match known attack patterns even when individual events are clean.
Model your environment as a graph: hosts as nodes, connections as edges. Normal admin activity creates a predictable connection graph. An attacker moving laterally creates new edges that were not in the baseline graph. Graph anomaly detection catches this even when the credentials used are valid.
You do not need a commercial SIEM to start doing behavioral analysis. Here are practical starting points using tools already on your systems, with AI assist for the pattern recognition layer.
Start by understanding what normal looks like. Run this weekly and compare output:
# Who logs in, from where, at what hours — build your own baseline
grep "Accepted" /var/log/auth.log | \
awk '{print $1, $2, $9, $11}' | \
sort | uniq -c | sort -rn
# Output: count month day user source_ip
# Save this weekly. Diff against last week. New source IPs stand out.
# Login hours by user — what does normal look like?
grep "Accepted" /var/log/auth.log | \
awk '{split($3,t,":"); print $9, t[1]}' | \
sort | uniq -c
# Shows: count username hour — flag logins at unusual hours for that user
# Save today's source IPs
grep "Accepted" /var/log/auth.log | \
awk '{print $11}' | sort -u > /var/tmp/auth-ips-today.txt
# Compare against your known-good baseline
diff /var/tmp/auth-ips-baseline.txt /var/tmp/auth-ips-today.txt
# Lines starting with > are new IPs not seen before
# Run this in cron, pipe new IPs to mail or your ticketing system
# Collect a week of login data and ask AI to describe the baseline
grep "Accepted" /var/log/auth.log | \
awk '{print $1,$2,$3,$9,$11}' | \
sgpt "Analyze these successful SSH logins. Describe the normal pattern:
typical users, typical hours, typical source IPs. Flag anything that
looks like an outlier against the dominant pattern."
# Or with curl if you don't have sgpt yet:
LOGIN_DATA=$(grep "Accepted" /var/log/auth.log | tail -500)
echo "$LOGIN_DATA" | ask_claude "Describe the normal login pattern here.
List any logins that look like outliers — unusual hours, unusual source
IPs, users accessing systems they rarely touch."
# Find authorized_keys files modified in the last 24 hours
find /home /root -name "authorized_keys" -newer /var/tmp/last-check \
-exec ls -la {} \;
# Update the timestamp reference
touch /var/tmp/last-check
# Run from cron. Any output means a key was added — worth knowing about.
# Pipe results to sgpt for context if multiple files changed:
find /home /root -name "authorized_keys" -newer /var/tmp/last-check \
-exec cat {} \; | \
sgpt "These SSH authorized_keys files were modified in the last 24 hours.
List each key, what type it is, and any comments. Flag anything unusual."
If you are building a checklist of what to monitor before deploying a full SIEM, these are the highest-value behavioral signals for a typical Linux environment:
| Signal | Why it matters | How to catch it |
|---|---|---|
| Login from new geographic location or ASN | Credential theft often shows up here first | Baseline source IPs; diff daily |
| Login at unusual hours for this user | Attackers work in their timezone, not yours | Track login hours per user; flag outliers |
| Service account used for interactive login | Service accounts should never log in interactively | grep auth.log for service account names + "session opened" |
| New SSH key added outside change window | Persistence mechanism — attacker ensuring return access | find on authorized_keys with -newer |
| User accessing host they have never accessed | Lateral movement using valid credentials | Build per-user host access map; diff weekly |
| Outbound connection from server with no history of outbound | Data exfiltration or C2 beacon | Baseline outbound connections per host; alert on new destinations |
| Elevated data volume from a user account | Staging data for exfiltration | Track bytes transferred per user; flag 3× baseline |
| New cron job or systemd timer added | Persistence and scheduled exfiltration | Monitor /etc/cron* and /etc/systemd/system for changes |
| Privilege escalation outside normal admin accounts | Attacker moving from user to root | grep sudo auth.log; flag accounts that never run sudo |
Behavioral detection is a significant improvement over rules alone. It is not a complete solution. Know its limits before you trust it:
| Limitation | Why it matters |
|---|---|
| Slow attackers evade baselines too | An attacker who moves slowly enough will gradually shift what looks normal. Given weeks, behavior that was anomalous becomes baseline. |
| Insider threats know the baseline | A malicious insider knows exactly what behavioral patterns look normal for their account and can stay within them. |
| New environments have no baseline | You cannot detect anomalies on a system that was just deployed. The first 30–90 days are a blind spot. |
| False positive fatigue is real | Every legitimate change — new hire, new application, staff travel — generates anomalies. Without tuning, alert volume becomes unmanageable. Page 4 covers this in depth. |
| Context lives in your head, not the tool | The tool does not know that your developer always works at 2 AM, that the database server legitimately connects to S3 for backups, or that last week's spike was a planned migration. You do. |
You now have the conceptual framework: what behavioral baselines are, why dwell time matters, how lateral movement evades rules, and what AI is actually doing under the hood. Page 3 gets concrete about the tools you can deploy.