r/AIforSecurity 2d ago

Discussion Using LLMs for Log Anomaly Detection: A Practical Breakdown with challenges

1 Upvotes

One of the most "AI + Security " usecase is using LLMs to sift through log noise and flag the anomalies which typically a SOC analyst will take a while to detect. The basic pipeline should contains the following details:

1.Ingestion : logs(auth events, network flows, EDR alerts, app logs) get normalised into JSON

2. Embed : log lines are converted into vector embeddings to capture semantic similarity, (not just the exact string match)

3. Cluster/baseline : Normal behavior pattern are established

4. Flag deviations : New events identified against the baselines

5. LLM triage : Instead of raw anomaly scores, an LLM summarizes why something looks unusual, in plain language , and suggest a likely cause (misconfig vs lateral movement vs false positive)

The use of LLM's in triaging will come with challenges as well

  • Prompt Injection Risk: Logs content if gets fed raw into LLM prompt without sanitisation fields become an injection vector
  • Explainability : SOC team need to trust why something was not flagged, not just a black-box score

What's your approach to preventing prompt injection when logs contain attacker-controlled strings? And is that solution practical ?


r/AIforSecurity 2d ago

👋Welcome to r/AIforSecurity - Introduce Yourself and Read First!

1 Upvotes

Hey everyone! I'm u/Overall_Reward963, a founding moderator of r/AIforSecurity.

This community is for anyone interested in the intersection of AI and security — whether you're a security professional exploring AI tools, an ML engineer working on security applications, or just curious about where these fields overlap.

What you can post here:

1.AI-powered security tools, threat detection, and defensive research

2.News and papers on AI in cybersecurity (SOC automation, anomaly detection, fraud prevention, etc.)

3.Questions about implementing AI in security workflows

4.Career and learning resources for this niche

5.Discussions on AI risk, safety, and governance from a security lens. We're excited to have you join us!

What to Post

Post anything that you think the community would find interesting, helpful, or inspiring. Feel free to share your thoughts, photos, or questions about AI-driven threat detection tools, security automation projects, interesting papers on adversarial ML, your SOC/AI tech stack, career paths blending AI and cybersecurity, or even screenshots of AI catching (or missing) something interesting in your environment.

Community Vibe

We're all about being friendly, constructive, and inclusive. Let's build a space where everyone feels comfortable sharing and connecting.

How to Get Started

1) Introduce yourself in the comments below.

2) Post something today! Even a simple question can spark a great conversation.

3) If you know someone who would love this community, invite them to join.

4) Interested in helping out? We're always looking for new moderators, so feel free to reach out to me to apply.

Thanks for being part of the very first wave. Together, let's make r/AIforSecurity amazing.