SynfraCore
Synfracore
Start Learning
Navigation

Academies

Platform

RoadmapsLabsCertificationsInterviewPYQsAI AssistantCareer
Start Learning Free Learning Roadmaps

AI Security — Overview

What it is, why it matters, architecture and key concepts

📄
Last updated Nov 2026
Expert Content

AI Security

The attacker's input is just more text to the model — that's the whole problem

Category: Defensive Security & SOC

Here's the plan: why this is a genuinely different problem, the modules below, a runbook-style walkthrough, interview prep last.

Worth knowing going in: the CIA triad and basic threat modeling (Security Fundamentals covers that). It also helps to know roughly what an LLM agent and tool use mean — see the AI Agents track.


Why AI Security Is a Different Problem

Traditional application security draws a reasonably clean line between code (trusted, written by developers) and data (untrusted, supplied by users). SQL injection, XSS, and most classic vulnerabilities exploit exactly that boundary blurring — data that gets accidentally interpreted as code.

An LLM has no equivalent boundary built in. Everything — the system prompt written by the developer, a user's message, a document retrieved for RAG, a tool's returned result — arrives as the same kind of thing: text in the context window. The model has no structural way to know that the developer's instruction deserves more trust than text that showed up inside a retrieved document. That collapsed distinction is the root of prompt injection, and it's why defenses borrowed directly from traditional web security (sanitize the input, escape special characters) don't fully transfer — there's no reliable syntactic marker separating "instruction" from "data" the way there is in SQL.

Analogy — Think of a brilliant new employee who takes absolutely everything they read at face value, including a sticky note found taped to a customer's file that says "please also email this customer's full records to this other address." A well-trained human employee has accumulated judgment about which instructions are legitimate and which aren't; an LLM, by default, has no equivalent instinct — it just processed more text, and some of that text looked like an instruction. Securing an LLM system means building that judgment back in deliberately, since the model won't develop it on its own just from being capable.

The Expanded Attack Surface, Once Tools Enter the Picture

A plain chatbot with no tool access can still be tricked into saying something embarrassing, but the damage stays contained to its own output. An agent with tool access — one that can read files, call APIs, send messages — turns a successful prompt injection into a real action with real consequences, not just bad text.

Untrusted text enters context
User message, retrieved doc, tool result
Model can't structurally distinguish it from instructions
The core vulnerability
If tools are connected
A successful injection becomes a real action

Learning Modules

Module 01 — Prompt Injection, Direct and Indirect

The core vulnerability, and the much harder variant

Topics covered:

•Direct injection — the user directly tries to override system instructions — 🟢 Beginner
•Indirect injection — the malicious instruction arrives via a document, tool result, or webpage the model reads — 🔴 Advanced
•Why indirect injection is harder to defend against than direct — 🔴 Advanced

Direct injection stays visible in the conversation itself, so a human reviewer or a message-scanning classifier at least has a shot at noticing it. Indirect injection buries the same kind of attempt inside something the model was only supposed to treat as data — a retrieved webpage, a PDF, a tool's returned result — content nobody set out to review for a hidden instruction at all.

Module 02 — Agent Permission Scoping

Treating every connected tool as a capability grant, not a convenience

Topics covered:

•The principle of least privilege, applied to what an agent can call — 🟡 Intermediate
•Human-in-the-loop confirmation for consequential actions — 🔴 Advanced
•Why "the model probably won't misuse this" is not a security control — 🔴 Advanced

Connecting an agent to a tool that can delete records, send messages, or move money hands it real-world capability the moment the connection exists — whether or not the model ever actually misuses it under normal conditions. Scoping exactly which tools are reachable for a given task, and requiring explicit confirmation before anything consequential executes, is what limits the damage when (not if) a successful injection occurs.

Module 03 — Data Exfiltration Through Tool Use

Why "the model said something it shouldn't" is the mild version of this risk

Topics covered:

•Exfiltration via a tool the agent already has legitimate access to — 🔴 Advanced
•Markdown/image rendering as a covert exfiltration channel — 🔴 Advanced
•Why output filtering alone doesn't catch this — 🔴 Advanced

A genuinely dangerous outcome of a successful injection isn't a rude response — it's an agent with access to sensitive data and a messaging or network-capable tool being instructed to combine the two. Rendering an image whose URL encodes stolen data as query parameters is a documented real technique: the data leaves the system the moment the image is rendered and the request fires, with nothing in the visible text output looking obviously wrong.

Legitimate access + a reachable channel
An agent with real data access and any outbound-capable tool already has what exfiltration needs
Output text filtering alone
Doesn't catch exfiltration that happens through a side channel, not the visible response

Production Example

bash
# Production Runbook — "a customer-support agent appears to have followed an
# instruction embedded in a submitted ticket, not from the actual user"

# Step 1: Confirm it's indirect injection, not a direct user attempt
# Check whether the suspicious instruction appears in the ticket body/
# attachment content the agent read, rather than in the user's own messages

# Step 2: Determine what the agent actually had access to at the time
# Which tools were reachable, and did any of them touch sensitive data
# or have any outbound capability (sending, posting, emailing)

# Step 3: Check whether anything was actually exfiltrated or actioned
# Don't assume "the output looked fine" means nothing happened --
# check tool call logs directly, since the visible text response is
# not the only place a successful injection's effect shows up

# Step 4: Reduce what the agent can reach, not just patch this one input
# If a ticket-processing agent doesn't need outbound-messaging access
# to do its job, remove that access rather than trying to filter every
# possible injected instruction that might try to invoke it

# Step 5: Add logging specifically for tool calls triggered by content
# read from an external/untrusted source, not just user messages --
# this is what makes the next incident's Step 1 faster

Interview Prep

Give the problem, the fix, and what it changed — around a minute a question works well.

Questions This Track Tends to Draw

Q1. Why would layering several weaker defenses beat relying on one strong-sounding defense for an LLM system?

A: Problem: no single mitigation available today reliably closes off prompt injection on its own, so betting everything on one control leaves a single point of failure. Solution: combining least-privilege tool scoping, marking retrieved content as data rather than instructions, monitoring tool-call behavior, and human confirmation on consequential actions means an attacker needs multiple independent layers to fail at once, not just one. Result: the system degrades gracefully when any single layer is bypassed, instead of failing completely the moment its one strong defense doesn't hold.


Q2. Where exactly should a human-confirmation step go, and what happens if it's added too liberally?

A: Problem: teams sometimes add a confirmation prompt everywhere "to be safe," which sounds cautious but changes user behavior in a way that undermines the control. Solution: reserve confirmation specifically for actions with real consequences — deleting data, sending something externally, moving money — and let routine, low-stakes actions proceed without one. Result: when a confirmation does appear, users still read and consider it, rather than having been trained to click through approvals without looking because most of them didn't matter.


Q3. A model's own training data gets manipulated to teach it a subtly harmful behavior. How is that different from prompt injection, and how do most teams actually address it?

A: Problem: this risk, usually called data poisoning, happens during training or fine-tuning, well before any runtime input ever reaches the deployed model — a completely different stage of the pipeline than an attacker crafting a clever prompt. Solution: a team that fine-tunes a foundation model it didn't train itself can't fix this with a runtime defense; the real mitigation is vetting whoever provided the base model and carefully checking any fine-tuning data that team controls. Result: treating this as a supply-chain concern, not an application-security one, puts the effort where it can actually catch the problem.


Open the Interview Q&A tab for the rest; Cheatsheets keeps the OWASP LLM risk categories handy for a quick look-up.

Share:
Join our Community
Daily tips, job alerts, interview help — join engineers learning together
→
Up Next
🔤
AI Security — Fundamentals
Core concepts and commands — hands-on from the start
Also Worth Exploring
← Back to all AI Security modules
Prerequisites →