TL;DR
This paper introduces a specialized Retrieval-Augmented Generation (RAG) framework designed to automate cybersecurity incident response. By pairing targeted log-filtering queries with the semantic reasoning of Large Language Models (LLMs), the system accurately reconstructs complex attack timelines and answers forensic questions. The approach achieves up to 94% recall while remaining highly cost-effective, proving that smart data preprocessing can successfully bring massive security logs within LLM context constraints.
What Problem Does This Paper Address?
Security Operations Centers (SOCs) are drowning in data. A single security incident can generate millions of raw log entries across intrusion detection systems, network telemetry, and authentication logs. Human analysts suffer from alert fatigue, making it easy to miss sophisticated, multi-stage attacks that unfold over hours or days.
While LLMs are naturally suited to piecing together unstructured text into coherent narratives, dumping raw logs directly into a prompt is impossible due to strict context window limits. Furthermore, raw logs are incredibly noisy, meaning the actual "signal" of an attack is easily buried under routine background traffic. The authors tackle this bottleneck by designing a system that filters and condenses raw logs before presenting them to an LLM for high-level reasoning.
Methods
The authors develop a two-stage architecture consisting of Security Context Extraction (SCE) and RAG-LLM Analysis:
- Filter and Aggregate (SCE): Instead of feeding raw logs to the LLM, the system runs targeted queries from a predefined library mapped to the MITRE ATT&CK framework. These queries extract Indicators of Compromise (IOCs) and compress thousands of discrete events into compact, behavioral summaries (e.g., grouping Kerberos authentications or high-severity Suricata alerts by IP).
- Embed and Retrieve (RAG): These aggregated summaries are split into semantically meaningful chunks, embedded using a sentence transformer (
all-mpnet-base-v2), and indexed in a FAISS vector database. When an analyst poses a forensic question, the system retrieves the top-$k$ most relevant chunks to populate the LLM's prompt.
The system operates in two modes: structured forensic question-answering (e.g., "What is the infected host IP?") and attack sequence reconstruction using timestamped enumeration prompts.
Datasets
The framework was evaluated across two distinct environments:
- Malware Traffic Analysis: 17 distinct public scenarios curated from Malware-Traffic-Analysis.net, Unit 42 Wireshark Quizzes, and SANS ISC contests, totaling 321 MB of PCAPs and nearly 95,000 log events.
- Active Directory (AD) Attack: A controlled red-team exercise simulating a sophisticated multi-stage intrusion, including certificate template abuse (ESC1), Kerberos ticket forgery, lateral movement via PSExec, and SCADA service disruption.
Key Insights and Ideas
- Reasoning Trumps Domain Specialization: Surprisingly, general-purpose models like Claude Sonnet 4 and DeepSeek V3 significantly outperformed a security-specialized model (Cisco Foundation-Sec-8B). Complex forensics depends heavily on cross-chunk synthesis and logical reasoning rather than just knowing cybersecurity terminology.
- The "Cross-Chunk Crossover": GPT models often treat the task as simple data extraction, pulling answers from single chunks. In contrast, Claude and DeepSeek excel at cross-source synthesis—corroborating data across multiple retrieved chunks (e.g., linking a Suricata alert chunk with a Kerberos authentication chunk via a shared IP address) to eliminate false positives.
- Context Size Sensitivity: Performance peaks at $k=7$ retrieved chunks. Providing too little context ($k=1$) forces models to hallucinate or report "not found," while too much context ($k=14$) dilutes the signal and risks exceeding model context limits on large scenarios.
Key Results
The system was tested against eight different LLM configurations, demonstrating excellent feasibility for real-time deployment:
- Top Performers: Claude Sonnet 4 achieved the highest average recall at 94%, closely followed by DeepSeek V3 at 89% across the 17 malware scenarios.
- Cost-Effectiveness: DeepSeek V3 emerged as the most cost-effective cloud model, delivering near-Claude accuracy at 15$\times$ lower cost ($0.008 vs $0.12 per analysis). For strict data privacy, the locally deployed Llama 3.1:70b achieved a respectable 81% recall at zero per-query cost.
- Active Directory Reconstruction: On the multi-stage AD attack, Claude and DeepSeek achieved 100% precision and 96% recall in detecting attack steps, successfully identifying complex privilege escalation vectors like Subject/SAN mismatches.
- Baselines Defeated: A "No-RAG" baseline failed completely, missing later attack infrastructure because the raw logs quickly filled up the context window with benign startup noise.
Limitations and Future Work
- Query Library Dependency: The system's visibility is bounded by its query library. If an adversary uses a novel technique not covered by an existing IOC query, the relevant logs won't be extracted.
- Aggregation Truncation: Because Elasticsearch aggregations return the top-$N$ items, low-ranked but highly significant attack indicators can occasionally be dropped silently before reaching the LLM.
- Scope Expansion: The current implementation relies primarily on network PCAPs and Windows Event logs. The authors note that expanding the pipeline to ingest endpoint EDR, email gateways, and proxy logs is a crucial next step for broader attack coverage.
Summary updated