Securing LLM Applications and AI Agents

Secure LLM Applications and AI Agents With Controls That Hold.

Threat-model what an application reads and can do, prove each weakness by its effect, build the controls in working code, gate every release on attacks and ordinary work, and respond when a control fails, in a browser range, a Python lab and a telemetry console.

What you'll be able to do

✓Threat-model an LLM application from its code: every source the model reads, who writes it, and what each tool can reach
✓Prove prompt injection, tenant leakage, poisoned retrieval and unsafe output handling with cases judged by their effects
✓Build controls outside the model: authorization on every tool call, permission-aware retrieval, and a check before each sink
✓Give agents task-scoped delegated identity, validate and exchange tokens at MCP servers, and bind approvals to the exact action
✓Gate model, connector and dependency updates and every control change with an evaluation that measures attacks and work together
✓Investigate an agent incident from its telemetry, contain it without losing evidence, and verify by cause as well as effect
SEC502 | Included with Specialist, from $29/month | 12 modules and an orientation | 38–40 hours at your own pace | 40 CPE credits

Before you start

Prerequisites
None
Hands-on setup
Python on your own machine, for the lab pack. The Lab Setup module walks you through it.
Optional
A local open-weight model through Ollama, for repeated trials on a real model
Learning paths

Course Syllabus

Every module and every lesson. The first three modules are open; the rest open on a click.

Download the full syllabus (PDF)

Phase 1: Foundations

Module 0Orientation and LLM Application ArchitectureCourse Preview

The engineer's job and the principle behind the course, how an LLM application is built, three kinds of failure, testing safely, the lab and its evidence, and the review, prove, fix and verify loop run once. Start here.

Show 6 lessonsHide lessons
  1. 0.10.1 What This Course Is ForPreview
  2. 0.20.2 How an LLM Application Is BuiltPreview
  3. 0.30.3 Application Security, Model Safety and Output ReliabilityPreview
  4. 0.40.4 Testing SafelyPreview
  5. 0.50.5 Your Lab and How Evidence Is ReportedPreview
  6. 0.60.6 A First Weakness, Proved and FixedPreview
Module 1Threat Modeling and Trust Boundaries

Threat-modeling the service-desk agent before it goes live: its design read from the code, trust boundaries, abuse paths from writer to harm, coverage against OWASP, ATLAS and ATT&CK, the threat-model board, and a ranked, written threat model.

Show 6 lessonsHide lessons
  1. 1.11.1 Reading the Agent's Design
  2. 1.21.2 Trust Boundaries
  3. 1.31.3 From Text to Harm: Abuse Paths
  4. 1.41.4 Naming What You Found
  5. 1.51.5 Threat-Modeling the Agent on the Board
  6. 1.61.6 Ranking Abuse Cases and Writing the Threat Model

Phase 2: Inputs, Data and Outputs

Module 2Prompt Injection and Instruction Manipulation

How a customer's ticket steers the service-desk agent, the forms injection takes, attacks that blend in, the layers that lower the rate and how to measure them, and the call check that holds, built and verified in the lab.

Show 6 lessonsHide lessons
  1. 2.12.1 How Injection Reaches the Agent
  2. 2.22.2 The Forms an Instruction Takes
  3. 2.32.3 Riding a Real Task, and Multi-Turn
  4. 2.42.4 Defenses That Lower the Rate
  5. 2.52.5 Measuring Injection
  6. 2.62.6 The Control That Holds
Module 3Sensitive Data and Tenant Isolation

How a shared knowledge assistant hands one tenant's documents to another, the confused deputy behind it, where the permission check belongs, the check and the cache key built in the lab, and the result verified as evidence.

Show 6 lessonsHide lessons
  1. 3.13.1 What the Index Can Read, and What Each User May Read
  2. 3.23.2 Proving It With an Ordinary Question
  3. 3.33.3 Where the Check Belongs
  4. 3.43.4 Implementing the Permission Check
  5. 3.53.5 The Other Routes Tenant Data Takes
  6. 3.63.6 Verifying and Recording Isolation
Module 4Securing RAG and Knowledge Ingestion

Who can put text into the knowledge assistant's index: the write paths, poisoning them, the editor, tenant and second-approval gates, provenance and removing every copy, and the boundary verified as evidence.

Show 6 lessonsHide lessons
  1. 4.14.1 How Content Gets Into the Index
  2. 4.24.2 Poisoning the Index
  3. 4.34.3 Ingestion Approval
  4. 4.44.4 Provenance
  5. 4.54.5 Instructions Inside Approved Content
  6. 4.64.6 Verifying the Ingestion Boundary
Module 5Handling Model Outputs Safely

What happens to the model's output after it is written: rendering replies safely, generated URLs, queries and paths, schema and semantic validation, and output handling verified as evidence.

Show 6 lessonsHide lessons
  1. 5.15.1 Model Output Is Untrusted Input
  2. 5.25.2 Rendering Safely
  3. 5.35.3 Generated URLs
  4. 5.45.4 Generated Queries
  5. 5.55.5 Generated Paths and Validation
  6. 5.65.6 Verifying Output Handling

Phase 3: Agents and Their Actions

Module 6Agent Identity and Authorization

Whose authority the agent uses when it calls an API: application versus delegated access, the confused deputy, one scope and one record per call, tokens as credentials, and the identity boundary verified as evidence.

Show 6 lessonsHide lessons
  1. 6.16.1 Whose Authority the Agent Uses
  2. 6.26.2 Application Access and Its Blast Radius
  3. 6.36.3 Delegated Access
  4. 6.46.4 One Approved Dataset
  5. 6.56.5 Credentials, Lifetime and the Agent With No User
  6. 6.66.6 Verifying the Identity Boundary
Module 7Tool and MCP Security

Securing an agent's tools over MCP: a token per server, no passthrough, audience checks at the server you run, tool definitions approved by hash, and the integration verified as evidence.

Show 6 lessonsHide lessons
  1. 7.17.1 What MCP Adds to the Agent
  2. 7.27.2 Tokens Across Hops
  3. 7.37.3 Tool Definitions Are Input
  4. 7.47.4 Which Tools the Model Sees
  5. 7.57.5 Servers You Run and Servers You Don't
  6. 7.67.6 Verifying the MCP Integration
Module 8Containing Agent Actions

Securing what an agent does: approvals bound to the exact action and shown from its arguments, destinations matched against a registry, a budget per request, an idempotency key, and the approval matrix.

Show 6 lessonsHide lessons
  1. 8.18.1 What the Agent Can Now Do
  2. 8.28.2 An Approval Bound to the Action
  3. 8.38.3 What the Approver Is Shown
  4. 8.48.4 Where the Agent May Send
  5. 8.58.5 Stopping a Runaway Workflow
  6. 8.68.6 Verifying Action Containment
Module 9Memory and Multi-Agent Security

Securing what an agent remembers and who it listens to: provenance on every memory write, recall scoped by customer and expiry by kind, handoffs accepted only from known agents for their own field, and agent-to-agent trust by role.

Show 6 lessonsHide lessons
  1. 9.19.1 What the Agent Remembers, and Who It Listens To
  2. 9.29.2 Provenance on Every Memory Write
  3. 9.39.3 Scope and Expiry
  4. 9.49.4 Another Agent's Output
  5. 9.59.5 Agents That Talk to Agents
  6. 9.69.6 Verifying Memory and Handoffs

Phase 4: Releases and Operations

Module 10Supply Chain and Deployment

Securing what an agent loads and the updates proposed for it: files verified against their publisher's record, formats that run nothing on load, a model swap gated on every earlier case, backdoors and what holds them, and connector and configuration changes reviewed by reach.

Show 6 lessonsHide lessons
  1. 10.110.1 What an Update Brings In
  2. 10.210.2 Verifying What You Load
  3. 10.310.3 A Model Swap Is a Release
  4. 10.410.4 Poisoning and the Backdoor Tests Miss
  5. 10.510.5 Connector and Deployment Changes
  6. 10.610.6 Verifying the Release Gate
Module 11Security Evaluation and Release Gates

Turning security checks into an evaluation that can decide a release: six measures with their conditions, enough runs for the claim, judging by effects, guardrails measured beside controls, a suite grown with variants, and a gate for every change.

Show 6 lessonsHide lessons
  1. 11.111.1 What an Evaluation Must Report
  2. 11.211.2 Trials, and What Zero Failures Means
  3. 11.311.3 Judging by Effects
  4. 11.411.4 Guardrails Measured Beside Controls
  5. 11.511.5 Growing the Suite
  6. 11.611.6 Gating Every Change
Module 12Monitoring and Incident Response

Investigating and responding to incidents in LLM applications and agents: what to record, scoping across services by trace, containing without destroying evidence, deciding what is an incident, and verifying containment by its cause.

Show 6 lessonsHide lessons
  1. 12.112.1 What an Agent Must Record
  2. 12.212.2 Scoping a Memory Incident
  3. 12.312.3 Following Data Out
  4. 12.412.4 Containing It
  5. 12.512.5 Is This an Incident
  6. 12.612.6 Verifying Containment and Closing

Phase 0: Course Resources

ResourcesLab Setup

Installing the SEC502 lab, the ai-app workspace the console queries, and checking both work before the first exercise.

Show 4 lessonsHide lessons
  1. 1Installing the Lab
  2. 2The ai-app Workspace
  3. 3An Optional Local Model
  4. 4Verify the Lab
ResourcesWalkthroughs

Three cases worked end to end across the modules, including the wrong turns, each ending in a scorecard, a report card and the point that transfers.

Show 3 lessonsHide lessons
  1. 1Reviewing the Service Desk Agent for Release
  2. 2A Poisoned Index to a Verified Fix
  3. 3A Cheaper Model and a Guardrail
ResourcesPlaybooks

Eight playbooks, one per thing that lands on an LLM application team: what to check first, how to contain it, and what the record must say.

Show 8 lessonsHide lessons
  1. 1Prompt Injection Reported
  2. 2Data Disclosed in an Answer
  3. 3Memory Poisoning Found
  4. 4A Runaway Agent or Cost Spike
  5. 5An MCP Server or Tool Compromised
  6. 6The Model or Vendor Changes
  7. 7A Guardrail Bypass Reported
  8. 8Hidden Context Exposed
ResourcesPlayground

The range to practice on freely, and every tool scenario, predict block and console query in the course, by module.

Show 1 lessonHide lessons
  1. 1Free Play and Everything to Operate
ResourcesReferences

The standards, lists, protocols and tools the course relies on, each with the version it was read at.

Show 3 lessonsHide lessons
  1. 1Standards and Frameworks
  2. 2Telemetry, Protocols and OAuth
  3. 3Tools and Versions

Course Completion

CompletionCourse Exam

Securing LLM Applications and AI Agents end-of-course exam: 40 questions in four parts, from threat modeling to incident response, ending on a case study.

Show 1 lessonHide lessons
  1. 1Course Completion. Securing LLM Applications and AI Agents

Course overview

Assistants, retrieval systems and agents are reaching production faster than security teams can review them, and the review usually falls to engineers who know web security but not this kind of system. This course teaches it as engineering: review the architecture, prove each weakness, implement the control, and verify with evidence that it holds and that the application still does its job.

Module 0 sets out how an LLM application is built and how the course's evidence is reported. Module 1 threat-models an agent from its code. Modules 2 to 5 cover prompt injection, tenant isolation, retrieval and ingestion, and model output reaching a browser, network, database or file. Modules 6 to 9 cover what agents add: identity, tools and MCP, actions and approvals, memory and other agents. Module 10 treats every model, package and connector update as a release, Module 11 builds the evaluation that gates it, and Module 12 investigates and contains an incident.

How this course works

Controls that hold when the model does not. Model behavior can fail, so every module builds a control that stays enforceable whatever the model is persuaded to do, outside the model, and measures the defenses that only change the odds, such as markers, prompts and guardrails, for what they are.

Two applications, three places to practice. A knowledge assistant over a shared index and a service desk agent with tools, memory and approvals carry the whole course. The AI Range in your browser proves each weakness, the Python lab pack is working code you fix until its check passes, attacks and legitimate work together, and a month of recorded application telemetry is investigated in the query console.

Named, versioned, and checked. Each weakness is named against the OWASP Top 10 for LLM Applications 2026, the OWASP Top 10 for Agentic Applications 2026 and MITRE ATLAS, with the version on every page that relies on one. The course ends on a 40-question exam that includes a case study of each application.

What you will learn

✓ Threat-model an LLM application from its code: every source the model reads, who writes it, and what each tool can reach
✓ Prove prompt injection, tenant leakage, poisoned retrieval and unsafe output handling with cases judged by their effects
✓ Build controls outside the model: authorization on every tool call, permission-aware retrieval, and a check before each sink
✓ Give agents task-scoped delegated identity, validate and exchange tokens at MCP servers, and bind approvals to the exact action
✓ Gate model, connector and dependency updates and every control change with an evaluation that measures attacks and work together
✓ Investigate an agent incident from its telemetry, contain it without losing evidence, and verify by cause as well as effect

Who this course is for

Security practitioners, application developers and cloud engineers who have been handed an AI feature to secure, and the testers and responders who prove its weaknesses and answer its incidents. No minimum experience: Module 0 covers the Python, HTTP APIs and OAuth the lab uses, and every concept is explained where it is first used.

What this course does not cover: training or fine-tuning models, or the mathematics of adversarial examples; jailbreaks for harmful content; general web application security the model does not change; AI governance and regulation, which GRC302 teaches; and detection rules or hunting on AI telemetry, which SEC401 teaches.

Things you need to know

What are the prerequisites?

None. Reading a little Python helps you move faster in the lab, but Module 0 covers what the exercises assume, and every term is explained where it is first used.

What do I need?

A browser for the lessons, the AI Range and the query console, and Python on your own machine for the lab pack, which needs no other installation and calls no model provider. A local open-weight model through Ollama is optional, for running the same cases against a real model.

What will I be able to do after this course?

You'll be able to review an LLM application or agent before it ships and keep it secure after: a threat model from its code, each weakness proved by its effect, controls built outside the model with regression results, a release gate for model and connector updates, and an incident investigated, contained and verified.

Usage rights and disclaimer

Course materials: Licensed for individual professional development. The lab pack's code is yours to adapt in your own work. You may not redistribute course content or share account credentials.

Test only what you may test: The course demonstrates attacks on its own range and lab. Test a real system only with written authorization from its owner, as lesson 0.4 sets out.

Fictional examples: The applications, organizations and people in the course are fictional. Any resemblance to real organizations or people is coincidental.

COURSE ASSESSMENT

End of Course Exam

Complete the course, then answer forty questions, from threat modeling to incident response, ending on a case study of one of the two applications, in 90 minutes. Pass mark: 70. Earn your certificate with CPE credits.

40questions
90minutes
100points
Take End of Course Exam

Answers are checked on the server. Certificate issued on pass.