Skip to content

About

Wazuh SIEM pipeline with a custom brute-force-success correlation rule (MITRE T1110.001) and an LLM triage agent that scores alerts low→critical.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LogSentinel

A Wazuh SIEM pipeline that ranks alerts by urgency instead of just raising them. A custom correlation rule catches the brute-force attack that worked, and an LLM triage agent puts it at the top of the queue.

Wazuh Docker RHEL Python Groq MITRE ATT&CK License

LogSentinel demo: a 100100 alert enriched with an AI verdict, criticality critical, score 95


The problem

A SIEM that only detects things buries analysts. One SSH brute-force run against a lab VM produces hundreds of level-5 failure events, several stock "brute-force" composites, and somewhere in that noise one login that actually succeeded. Static rule levels can't tell "an attack is happening" apart from "an attack just worked, so act now".

LogSentinel addresses this in two layers:

  1. Detect the compromise, not just the attempt. A custom Wazuh rule links the failure burst and the successful login into one level-12 alert.
  2. Prioritise. An AI agent reads each notable alert, assigns a criticality and a 0–100 score with a one-line rationale, and writes that verdict back onto the alert so the dashboard can sort by it.

Architecture

LogSentinel architecture: Kali attacker, monitored RHEL VM with Wazuh agent, RHEL 9.6 Docker host running Wazuh manager, indexer, AI agent and dashboard

The lab is three VMs on an isolated host-only network (192.168.100.0/24). Each VM also has a NAT adapter, used only for package updates. All management is over SSH with key-only login.

VM IP Role
rhel-wazuh (RHEL 9.6, 6 GB) 192.168.100.10 Wazuh manager + indexer + dashboard in Docker Compose (single-node), plus the AI triage agent
monitored (RHEL, 2 GB) 192.168.100.20 Target running nginx, Postfix and sshd, monitored by the Wazuh agent
kali (2 GB) 192.168.100.30 Attacker running Hydra SSH brute force against a deliberately weak demo account

The dashboard is served over TLS by a private LogSentinel CA. The AI agent talks to the indexer API over verified TLS (no -k / verify=False).


Differentiator 1: correlation rule 100100

The rule fires when an account successfully logs in after 5 or more failed attempts within 60 seconds (MITRE T1110.001, level 12).

<group name="local,syslog,sshd,">
  <rule id="100100" level="12" frequency="5" timeframe="60">
    <if_sid>5715,5501</if_sid>          <!-- SSH auth success OR PAM session opened -->
    <if_matched_sid>5760</if_matched_sid> <!-- ...preceded by 5+ sshd auth failures -->
    <same_user />                         <!-- ...against the same account -->
    <description>SSH login succeeded for $(dstuser) after 5+ failed attempts in 60s - possible brute-force compromise</description>
    <mitre><id>T1110.001</id></mitre>
    <group>authentication_success,brute_force,</group>
  </rule>
</group>

The full, commented version is in rules/local_rules.xml.

The lesson from the live build: rule 5501, not 5715

The textbook version of this rule (including Wazuh's own documentation example) keys on 5715 (sshd: authentication success) and same_source_ip. On RHEL 9.6 + OpenSSH 9.9 it never fired. Across 338 failure events there was not a single 5715 for the victim account.

The cause is a log-transport asymmetry in OpenSSH 9.8+, where the daemon was split into sshd and sshd-session:

Event Destination Seen by the Wazuh journald collector?
Failed password journald ✅ → rule 5760
Accepted password syslog(LOG_AUTHPRIV) → rsyslog → /var/log/secure only ❌ → no 5715
pam_unix(sshd:session): session opened journald ✅ → rule 5501

So the rule keys on 5501 (keeping 5715 for portability) and correlates by user instead of source IP. That is arguably the better detection anyway, because a compromise is defined by which account fell, not by the attacker's current IP. The full investigation is in the Phase 4 runbook.


Differentiator 2: AI triage agent

agent/ai_agent.py is a ~190-line Python service that turns static rule levels into a triage decision.

┌────────────┐  1. poll every 15 s     ┌──────────────┐  2. alert summary    ┌───────────────────┐
│   Wazuh    │ ──────────────────────▶ │   ai_agent   │ ───────────────────▶ │ Groq LLM          │
│  indexer   │   level ≥ 7, unscored   │   (Python)   │   (rule, MITRE,      │ openai/gpt-oss-120b│
│ (OpenSearch│                         │              │    user, raw log)    │ strict JSON out   │
│   :9200)   │ ◀────────────────────── │              │ ◀─────────────────── │                   │
└────────────┘  4. _update  ai.* block └──────────────┘  3. verdict          └───────────────────┘
       │                                                 {criticality, score, reasoning}
       ▼
  Wazuh dashboard: "AI Triage" view sorted by ai.score
  1. Poll. Query wazuh-alerts-* for alerts with rule.level ≥ MIN_LEVEL (default 7) that have no ai.scored_at yet. This keeps the agent idempotent with no cursor file.
  2. Score. Send a compact summary of each alert (rule, level, MITRE ID, groups, target user, source IP, raw log) to Groq with a SOC-analyst system prompt and JSON-mode output.
  3. Validate. Coerce the response into a fixed schema: criticality ∈ {critical, high, medium, low, info}, integer score from 0 to 100, and reasoning of at most 160 characters. This keeps the OpenSearch mapping stable.
  4. Write back. _update the original alert document with an ai.* block (criticality, score, reasoning, model, scored_at) so the verdict is searchable and filterable in the Wazuh dashboard.

Resilience. If Groq returns an error or is unreachable, the agent logs a warning and leaves the alert unscored to retry later; nothing crashes. With --degraded it switches to a severity heuristic that needs no LLM, so 100100 is still flagged critical when offline.

Low → critical differentiation

The agent doesn't just repeat the Wazuh level. In one live run it ranked related alerts from the same attack differently:

AI agent live output: HIGH 80 for 5763, CRITICAL 95 for 40112, LOW 30 for 2502


Results

Results from a single live Hydra run (kali → backupsvc@monitored) with the agent polling:

Rule What it means Wazuh level AI verdict
2502 Stock composite: "user missed the password more than one time" 10 low · 30 ("multiple failures, no success")
5763 sshd brute-force attempt 10 high · 80 ("brute force in progress, no successful login yet")
40112 Stock: authentication success after multiple failures 12 critical · 95
100100 Custom: SSH login after a 5+ failure burst for the same user 12 critical · 95 ("likely compromise")

The level-10 2502 composite, which a static view would rank near the top, is correctly demoted to low. The two alerts that mean an account fell are promoted to critical.

AI verdict written onto the 100100 alert "AI Triage" dashboard
ai.* fields on the 100100 alert document AI Triage dashboard: rule.id × ai.criticality

MITRE ATT&CK mapping

Tactic Technique Where it's detected
TA0006 Credential Access T1110.001 Brute Force: Password Guessing 5760 per attempt, 2502 / 5763 burst composites
TA0006 Credential Access → TA0001 Initial Access T1078 Valid Accounts (the guessed credential is used to log in) 100100 (custom) and 40112

Repository layout

LogSentinel/
├── README.md
├── LICENSE
├── rules/
│   └── local_rules.xml          # custom rule 100100 (commented)
├── agent/
│   ├── ai_agent.py              # AI triage agent (Groq + degraded fallback)
│   ├── requirements.txt
│   └── .env.example             # GROQ_API_KEY, INDEXER_PASSWORD, GROQ_MODEL
├── docs/
│   ├── architecture.html / .png # lab architecture diagram (the HTML is in French)
│   ├── demo-thumbnail.png
│   └── runbooks/                # phase-by-phase build runbooks, written during the live build
└── screenshots/
Runbook Covers
Build plan Phase checklist
Phase 0: setup VMware, host-only network, 3 VMs, SSH key-only hardening
Phase 1: Wazuh Wazuh 4.14.6 single-node Docker stack, credential rotation
Phase 2b: dashboard TLS Private CA, dashboard certificate
Phase 3: attack traffic Victim account, Hydra, reading the real rule IDs
Phase 4: custom rule Rule 100100 and the 5715/5501 investigation
Phase 5: AI agent Verified-TLS indexer access, ai.* mapping, agent, dashboard, degraded mode

Setup & run

Prerequisites

  • A running Wazuh 4.x stack (single-node wazuh-docker works) with at least one agent sending SSH auth logs
  • Python 3.9+ on a host that can reach the indexer on :9200
  • A Groq API key (console.groq.com, free tier is enough). This is optional in --degraded mode.

1. Deploy the rule

# Append the <group> block from rules/local_rules.xml to the manager's
# /var/ossec/etc/rules/local_rules.xml (exact heredoc in Phase 4 §3a), then:
docker exec single-node-wazuh.manager-1 /var/ossec/bin/wazuh-analysisd -t   # syntax gate
docker restart single-node-wazuh.manager-1

2. Prepare the indexer

Copy the Wazuh root-ca.pem to the agent host and map wazuh.indexer to the indexer's IP so the TLS SAN matches. Then declare the ai.* mapping once. Phase 5 §3 and §5 have the exact commands.

3. Run the agent

cd agent
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt

export INDEXER_PASSWORD='...'          # indexer user password
export GROQ_API_KEY='...'              # your own Groq key
export GROQ_MODEL='openai/gpt-oss-120b' # optional, this is the default

python ai_agent.py --once              # score the current backlog once
python ai_agent.py                     # continuous: poll every 15 s
python ai_agent.py --degraded          # no LLM: severity heuristic only
Variable Default Purpose
INDEXER_URL https://wazuh.indexer:9200 Indexer API
INDEXER_USER / INDEXER_PASSWORD admin / (required) Indexer credentials
INDEXER_CA ~/logsentinel-ai/root-ca.pem CA used to verify the indexer certificate
GROQ_API_KEY (required unless --degraded) Groq API key
GROQ_MODEL openai/gpt-oss-120b Groq model ID
MIN_LEVEL 7 Minimum Wazuh rule level to score
LOOKBACK 30m Time window to scan
POLL_SECONDS 15 Poll interval

Security notes

  • No secrets in this repo. Every credential in the runbooks has been replaced with a placeholder (<your-admin-password>, <your-indexer-password>, <your-groq-api-key>, <victim-password>). The agent reads secrets only from environment variables.
  • Bring your own key. Copy agent/.env.example, fill it in locally, and never commit it. .gitignore blocks .env, *.key, *.pem, SSH keys and internal_users.yml.
  • Lab only. The victim account, its weak password and the Hydra wordlist exist only to generate realistic attack telemetry on an isolated host-only network. Don't reproduce them on a reachable host.
  • Least privilege. The demo uses the indexer admin user for simplicity. Phase 5 Appendix A describes a dedicated user restricted to wazuh-alerts-*.

Author

Oussama Hamada, @oussema-007 Built with Aladine Fadhli as the SSIRF module project at TEK-UP (class CII-5-J-SSIRF-D, 2026–2027).

Released under the MIT License.

About

Wazuh SIEM pipeline with a custom brute-force-success correlation rule (MITRE T1110.001) and an LLM triage agent that scores alerts low→critical.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages