LLMs don't know what they don't know: adding threat intel to my AI security tool
Earlier this week I shipped SOC-GPT, an AI alert triage system using multi-LLM consensus voting (local Llama + Groq's gpt-oss-120b). On the sample alert suite it hit 6/6 verdict accuracy. I was happy. Until I actually r
Earlier this week I shipped SOC-GPT, an AI alert triage system using multi-LLM consensus voting (local Llama + Groq's gpt-oss-120b). On the sample alert suite it hit 6/6 verdict accuracy.
I was happy. Until I actually read the reasoning the LLMs were writing.
For an SSH brute-force alert from 185.220.101.34, the AI's reasoning was something like: "Multiple failed SSH attempts from a single IP may indicate malicious intent, but could also be a legitimate user with a forgotten password. Recommend escalation."
That hedge isn't the AI being dumb. It's the AI being honest about what it doesn't know. It can't magically know that 185.220.101.34 is a known Tor exit node that's been reported 368 times in the last 90 days with a 100/100 abuse confidence score.
Nothing in the alert payload told it. So it did what any reasonable analyst would do with no context โ it hedged.
LLMs are only as good as their context window
Common Crawl doesn't include real-time threat intelligence. Even the best prompt engineering in the world can't compensate for missing facts about an IP that first appeared on abuse feeds two weeks ago.
So I added an enrichment layer โ a step that runs BEFORE the LLM, pulling structured external context into the alert before the AI ever sees it.
The architecture
Alert arrives via webhook
โ
Enrichment service queries AbuseIPDB for source IP
โ
Enrichment data merged into alert dict
โ
LLMs analyze alert + enrichment context together
โ
Verdict + action
AbuseIPDB's free tier gives 1,000 IP checks per day, no credit card required. It returns abuse confidence (0โ100), country, ISP, usage type (datacenter / residential / Tor exit), and how many times the IP has been reported.
The code
The enrichment service is a dataclass plus one async method:
@dataclass
class EnrichmentData:
abuse_score: int | None = None
country: str | None = None
isp: str | None = None
usage_type: str | None = None
total_reports: int = 0
is_tor: bool = False
is_whitelisted: bool = False
source: str = "none"
def summary(self) -> str:
if self.source == "none":
return "No external enrichment data available."
parts = []
if self.abuse_score is not None:
parts.append(f"abuse_confidence_score={self.abuse_score}/100")
if self.is_tor:
parts.append("tor_exit_node=YES")
# ...
return " | ".join(parts)
class EnrichmentService:
async def enrich(self, alert_json: dict) -> EnrichmentData:
source_ip = alert_json.get("source_ip")
if not source_ip or self._is_private_ip(source_ip):
return EnrichmentData()
try:
return await self._query_abuseipdb(source_ip)
except Exception as e:
logger.error("Enrichment failed: %s", e)
return EnrichmentData() # fail safe โ never block triage
Three design choices worth calling out:
Fail safe. If AbuseIPDB is down or rate-limited, enrichment returns empty data instead of crashing. The LLMs still get the alert โ just without the extra context. Enrichment should degrade, not break the pipeline.
Skip private IPs. 10.x.x.x, 192.168.x.x, 172.16โ31.x.x are internal. AbuseIPDB has no data on them and querying wastes quota. A simple prefix check handles it.
Typed dataclass, not a nested dict. The result is a real object with real fields. When I add VirusTotal (file hash reputation) and GeoIP next, they slot into new fields without breaking anything downstream.
Before and after
Same alert. Same LLMs. Same prompt. Only the context changed.
Before enrichment:
"Multiple failed SSH attempts from a single IP may indicate malicious intent, but could also be a legitimate user. Recommend escalation for human review."
Verdict: SUSPICIOUS ยท Confidence: 70%
After enrichment:
"The source IP 185.220.101.34 is a known Tor exit node (100/100 abuse confidence, 368 reports in 90 days), targeting the root account with 15 failed attempts in 60 seconds. This matches a classic credential-stuffing pattern. Immediate IP block recommended."
Verdict: MALICIOUS ยท Confidence: 96%
Night and day.
The lesson
Most "make your LLM smarter" advice is about better prompts, longer context, chain-of-thought, fine-tuning. All real techniques.
But for any domain where the AI needs real-world data to reason correctly โ security, finance, medical, legal โ the biggest leverage usually isn't making the model cleverer. It's making sure the model has the facts.
Context > cleverness.
What's next
- VirusTotal for file hashes (CryptoLocker alerts don't carry threat family info โ VT would add it)
- GeoIP (free via MaxMind GeoLite2 download)
- Real Wazuh integration โ stop using mock alerts, start triaging alerts from a real SIEM running on a DigitalOcean droplet
Repo: github.com/0mer-byte/soc-gpt
About me: I'm a senior at Rock Ridge HS in Ashburn, VA. Taking CompTIA Security+ in December. Competing in CyberPatriot. Looking for data center / SOC internships for summer 2027 anywhere in Northern Virginia. If you work at AWS, Oracle Cloud, Equinix, Digital Realty, QTS, CoreSite, Vantage, HITT, M.C. Dean, or anywhere in the NoVA ecosystem, I'd love to connect.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.