Retrieval-Augmented LLMs for Security Incident Analysis
Organizations: Dartmouth College Hanover, NH, USA · Northeastern University Boston, MA, USA · PUNCH Cyber Analytics Reston, VA, USA
Abstract
Investigating cybersecurity incidents requires collecting and analyzing evidence from multiple log sources, including intrusion detection alerts, network traffic records, and authentication events. This process is labor-intensive: analysts must sift through large volumes of data to identify relevant indicators and piece together what happened. We present a RAG-based system that performs security incident analysis through targeted query-based filtering and LLM semantic reasoning. The system uses a query library with associated MITRE ATT&CK techniques to extract indicators from raw logs, then retrieves relevant context to answer forensic questions and reconstruct attack sequences. We evaluate the system with eight LLM configurations on malware traffic incidents and a multi-stage Active Directory attack. We find that LLMs have different performance and tradeoffs, with Claude Sonnet 4 achieving 94% and DeepSeek V3 achieving 89% average recall across 17 malware scenarios, while DeepSeek costs 15 less than Claude per analysis, and locally-deployed Llama 3.1:70b achieves 81% recall at zero per-query cost. Attack step detection on the Active Directory scenario reaches 100% precision and up to 96% recall with an enumeration prompt. These results demonstrate that combining targeted query-based filtering with RAG-based retrieval -- confirmed essential by ablation studies -- enables accurate, cost-effective security analysis within LLM context limits.
Figures & tables
| Scenario | Cl. | Deep- | Ll. | Cisco | GPT | GPT | GPT | GPT |
|---|---|---|---|---|---|---|---|---|
| Seek | 8B | 4 | 4o | 5m | 5.2 | |||
| apr21isc | 92 | 79 | 79 | 71 | 85 | 85 | 85 | 85 |
| burnincandle | 100 | 93 | 84 | 77 | 70 | 70 | 70 | 70 |
| dec21isc | 100 | 100 | 94 | 81 | 75 | 75 | 75 | 75 |
| dirty_rat | 89 | 75 | 71 | 43 | 50 | 64 | 50 | 50 |
| easy_123 | 100 | 100 | 92 | 100 | 75 | 75 | 75 | 92 |
| LLM | Recall on set-valued | Multi-chunk |
|---|---|---|
| questions, hard (%) | cite rate, soft (%) | |
| Claude Sonnet 4 | 89 | 95 |
| DeepSeek V3 | 78 | 88 |
| Llama 3.1:70b | 56 | 76 |
| Cisco 8B | 46 | 36 |
| GPT-4 | 52 | 38 |
| LLM | |||||
|---|---|---|---|---|---|
| Claude Sonnet 4 | 39 | 72 | 86 | 94 | 94 |
| DeepSeek V3 | 35 | 71 | 80 | 89 | 89 |
| Llama 3.1:70b | 40 | 68 | 78 | 81 | 78 |
| Cisco 8B | 43 | 62 | 72 | 71 | 67 |
| GPT-4 | 46 | 60 | 64 | 67 | 66 |
| GPT-4o | 46 | 59 | 65 | 69 | 64 |
| LLM | RAG (k=7) | No-RAG | Logs Seen by LLM |
|---|---|---|---|
| Claude Sonnet 4 | 100 | 50 | 158 (4.3%) |
| DeepSeek V3 | 100 | 50 | 104 (2.8%) |
| GPT-4 | 69 | 38 | 22 (0.6%) |
| GPT-4o | 69 | 38 | 22 (0.6%) |
| GPT-5-mini | 56 | 38 | 22 (0.6%) |
| GPT-5.2 | 69 | 38 | 22 (0.6%) |
| LLM | Recall | Avg time/ | Avg time/ | In | Out | Cost/ |
|---|---|---|---|---|---|---|
| (%) | scenario | question | ($/M) | ($/M) | Anlys. | |
| Claude Sonnet 4 | 94 | 100s | 13.1s | 3.00 | 15.00 | $0.12 |
| DeepSeek V3 | 89 | 110s | 14.4s | 0.28 | 0.42 | $0.008 |
| GPT-4 | 67 | 18s | 2.4s | 3.00 † | 12.00 † | $0.11 † |
| GPT-4o | 69 | 19s | 2.6s | 2.50 | 10.00 | $0.09 |
| GPT-5-mini | 64 | 18s | 2.4s | 0.25 | 2.00 | $0.01 |
| LLMs | 15:30–35 | 15:35–40 | 15:40–46 | Avg Recall |
|---|---|---|---|---|
| ( ) | ( ) | ( ) | (%) | |
| Claude Sonnet 4 | 11 | 8 | 6 | 96 |
| DeepSeek V3 | 11 | 8 | 6 | 96 |
| Llama 3.1:70b | 9 | 6 | 6 | 81 |
| Cisco 8B | 8 | 7 | 6 | 81 |
| GPT-4o | 5 | 7 | 6 | 69 |
| Window | Blue | LLM | P | R |
|---|---|---|---|---|
| 15:30–35 | RC, RK, RD | RC, RK, RD, DU, RP | 3/5 | 3/3 |
| 15:35–40 | RK, RD, RP, DU | DU, RK, RD | 3/3 | 3/3 |
| 15:40–46 | RD, RP, DU, RK | RC, DU, RD | 2/3 | 2/3 |
| RC=Revoke Cert, RK=Reset KRBTGT, RD=Restart DC, | ||||
| DU=Disable User, RP=Reset Password. DU covers RP. | ||||
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Source | Size | No. of Logs |
|---|---|---|---|
| jun21isc | ISC | 43.1 MB | 47,991 |
| oct21isc | ISC | 46.7 MB | 7,278 |
| apr21isc | ISC | 12.9 MB | 5,699 |
| dec21isc | ISC | 31.4 MB | 3,869 |
| may21isc | ISC | 17.9 MB | 1,544 |
| iced_id | Unit-42 | 22.3 MB | 5,701 |
| Claude | DeepSeek | Ollama | Cisco | GPT-4 | GPT-4o | GPT-5-mini | GPT-5.2 | |||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Dataset | Qs | Ref | N | TP/N | Rec. | N | TP/N | Rec. | N | TP/N | Rec. | N | TP/N | Rec. | N | TP/N | Rec. | N | TP/N | Rec. | N | TP/N | Rec. | N | TP/N | Rec. |
| apr21isc | 2 | 8 | 6 | 4/6 | 66.5 | 5 | 4/5 | 66.5 | 6 | 4/6 | 66.5 | 4 | 2/4 | 33.5 | 7 | 3/7 | 41.5 | 7 | 3/7 | 41.5 | 7 | 3/7 | 41.5 | 7 | 3/7 | 41.5 |
| burnincandle | 3 | 14 | 16 | 14/16 | 100.0 | 14 | 11/14 | 83.3 | 12 | 10/12 | 62.7 | 7 | 5/7 | 45.7 | 10 | 10/10 | 62.7 | 10 | 10/10 | 62.7 | 10 | 10/10 | 62.7 | 10 | 10/10 | 62.7 |
| dec21isc | 3 | 6 | 10 | 6/10 | 100.0 | 10 | 6/10 | 100.0 | 9 | 5/9 | 83.3 | 7 | 5/7 | 83.3 | 8 | 4/8 | 66.7 | 8 | 4/8 | 66.7 | 8 | 4/8 | 66.7 | 8 | 4/8 | 66.7 |
| dirty_rat | 2 | 6 | 4 | 3/4 | 62.5 | 5 | 1/5 | 12.5 | 3 | 0/3 | 0.0 | 4 | 0/4 | 0.0 | 11 | 1/11 | 25.0 | 11 | 1/11 | 25.0 | 11 | 1/11 | 25.0 | 11 | 1/11 | 25.0 |
| easy_123 | 1 | 2 | 2 | 2/2 | 100.0 | 2 | 2/2 | 100.0 | 1 | 1/1 | 50.0 | 2 | 2/2 | 100.0 | 1 | 1/1 | 50.0 | 1 | 1/1 | 50.0 | 1 | 1/1 | 50.0 | 1 | 1/1 | 50.0 |
| Query | MITRE ATT&CK |
|---|---|
| PowerShell Injection | T1059 – Command and Scripting Interpreter |
| File Drop | T1204 – User Execution |
| Certificate Enumeration | T1649 – Steal/Forge Authentication Certificates |
| Certificate Request | T1649 – Steal/Forge Authentication Certificates |
| Certificate Issued | T1649 – Steal/Forge Authentication Certificates |
| Kerberos Authentication | T1558 – Steal/Forge Kerberos Tickets |
Cybersecurity
Cybersecurity develops methods to protect digital and cyber-physical systems from attacks, vulnerabilities, data loss, and misuse.
See all 354 papers