Skip to content

[FEATURE] Threat detection: security incident type and active-threat detection in alerts and logs #166

Closed

Description

@OkiriGabriel

Problem

The agent treats active attacks like ordinary outages:

  • There is no security incident type. classify_issue routes Falco's "Terminal shell in container" to k8s (because of "container"), "SSH brute force" to server (because of "ssh"), and anything unknown to server. The model then gets an SRE playbook ("restart the service, raise limits") for an intrusion.
  • Nothing looks for threats in the evidence. SecurityScanner checks configuration and compliance (privileged flags, secrets in manifests); it doesn't detect crypto miners, reverse shells, brute force or credential theft in alert text, raw_logs or the Loki alert_logs the agent already fetches (feat: Grafana alerts, Loki logs, and bearer auth for Alertmanager #101).
  • Escalation has no security path. If the model reports a security incident as "resolved", nobody is paged.

Proposal (foundation)

  1. security incident type, checked before all others. Triggered by security alert names (falco, guardduty, intrusion, brute force, malware, cryptominer, reverse shell, privilege escalation, unauthorized access, …), by security sources (Falco, GuardDuty, Security Command Center, Defender, Wazuh, CrowdStrike), and by labels such as security, threat or mitre_technique.
  2. Deterministic threat detector (collectors/threat_detector.py) over alert text and logs, with no LLM involved. Each finding has a MITRE ATT&CK technique, severity, the matching evidence lines (PII-scrubbed and capped) and extracted indicators (IPs):
    • SSH/auth brute force: repeated failed logins from one source, above a threshold
    • crypto mining: xmrig, stratum+tcp://, known pool hosts, cryptonight
    • reverse shells: /dev/tcp/, nc -e, bash -i >&, socket-spawned shells, mkfifo pipes
    • shell or exec in a container (Falco terminal shell, pods/exec)
    • privileged or host-namespace pod creation
    • credential access (/etc/shadow, cloud credential files, service-account tokens)
    • download-and-execute (curl | sh, wget -O- | bash)
    • cloud findings that name a threat (GuardDuty UnauthorizedAccess:*, CryptoCurrency:*, Backdoor:*)
  3. Every incident is scanned. Findings are attached as threat_findings, and an incident with a high-severity finding is re-typed to security, even when it arrived as a disk or CPU alert. A miner shows up as "high CPU" first.
  4. Security playbook prompt. Preserve evidence (never delete pods, files or logs), gather with read-only tools, propose containment only via approval, and notify. It's treated as never "resolved" by the agent alone.
  5. Always escalate security incidents (ESCALATION_ON_SECURITY=true), at critical priority for high-severity findings.
  6. A read-only detect_threats tool, so the model can scan more logs it fetched (for example after query_logs).
  7. A metric: devops_agent_threat_findings_total{technique,severity} ([FEATURE] Expose Prometheus /metrics for the agent itself (incidents, queue, tools, approvals, tokens) #125).

Out of scope (follow-ups)

  • native Falco / GuardDuty / SCC / Defender webhooks
  • approval-gated containment actions
  • Kubernetes audit log and CloudTrail detections

Activity

  1. added
    enhancement
    security
    on Nov 14, 2026
  2. OkiriGabriel commented on Nov 14, 2026

    @OkiriGabriel
    CollaboratorAuthor

    Picking up this foundation issue now; PR to follow. The follow-ups are tracked separately (webhooks, containment, audit-trail detections).

  3. self-assigned this
    on Nov 14, 2026
  4. added a commit that references this issue on Nov 14, 2026
  5. OkiriGabriel commented on Nov 14, 2026

    @OkiriGabriel
    CollaboratorAuthor

    Follow-up #171 adds injection-attack detection (SQLi, command injection, Log4Shell, path traversal, SSRF to metadata, XSS, SSTI) with volume-aware severity, and prompt-injection hardening (#118).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementsecurity

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions