./blog/threat-modelling-maestro-rag-agent
[manual] trust boundaries .. 3 identified, threat actors .. 3 identified
[manual] owasp-llm-top10 mapping .. 6 categories applicable
[maestro] automated scan .. 35 threats found, risk 48/100 (medium)
[maestro] validated attack paths .. 35/35, 4 critical
done — manual model called the shape, MAESTRO called the count
Threat-modelling my RAG agent with MAESTRO
A manual trust-boundary model, the OWASP four-layer LLM model, and an automated MAESTRO scan — run against the same target, compared side by side.
Before I attack anything I build a model of it first — scope, trust boundaries, threat actors, the works. For this engagement I ran the same local n8n + Qdrant + Ollama RAG agent through two very different processes: a manual pass using Microsoft-style data-flow diagramming and the OWASP four-layer model for LLM applications, then an automated pass using MAESTRO — Cloud Security Alliance's Multi-Agent Environment, Security, Threat, Risk, and Outcome framework for agentic systems. Same target, same synthetic canary secret standing in for a real crown jewel, two different lenses. This is what each one found, and why I don't trust either one alone.
The manual model told me where to look — three trust boundaries, a content-poisoner actor nobody had written down before, and which OWASP LLM categories actually applied. The MAESTRO automated scan told me how many and how bad — 35 threats, 4 of them critical, every attack path validated against the real asset graph instead of guessed. Run only the automated scan and you get a number with no judgment behind it. Run only the manual model and you get judgment that doesn't scale past a handful of components. The two together are what actually held up once I started attacking the thing for real.
the-engagement --scope-and-target
The target was ACME Assistant, an n8n AI Agent workflow answering questions over a handbook
indexed in Qdrant, served by a local Ollama llama3.1:8b model — the same shape of stack
I've red-teamed before, rebuilt here as a proper
sandboxed engagement rather than a weekend experiment. The asset under test was a synthetic canary secret
sitting in a "restricted" section of the knowledge base, protected only by system-prompt instructions —
deliberately the weakest possible defense, so the model would have something real to find.
- In scope: the n8n agent workflow, the Qdrant retrieval path, the Ollama embedding and chat models, and the document-ingestion pipeline feeding the vector store.
- Out of scope: model weights and training data, host/Docker infrastructure, denial-of-service.
- Rules of engagement: own local sandbox only, synthetic data only, no production systems touched.
Scope first, model second, attacks last — in that order. A threat model built after the attack playbook is just a justification for whatever you already tried.
the-target --architecture
Two independent data paths feed the same vector store — that seam is where most of what follows actually lives.
manual-model --trust-boundaries-and-actors
The part automated scanners don't do for you: naming who's on the other side of each boundary, and why.
Trust boundaries
- User → Chat Trigger — anyone who can reach the n8n webhook, no authentication modelled.
- Document source → ingestion path — anyone who can get a file into whatever feeds
/docs, with no chat access required at all. - n8n → Ollama / Qdrant — internal, assumed trusted for this engagement, but still a real boundary if that trust is ever wrong.
Threat actors
- Anonymous chat user — direct prompt injection, social engineering, jailbreak attempts.
- Content poisoner — can write to any source the ingestion pipeline consumes, and never touches the chat interface at all. This one doesn't show up if you only think in terms of "who talks to the bot."
- Insider with partial access — pivots from non-restricted to restricted content using legitimate-looking queries.
The content-poisoner actor is the whole reason indirect prompt injection ends up the highest-severity finding later. You don't find that actor by fuzzing the chat box — you find it by asking "who else can reach this system, and through what" before you touch the keyboard.
OWASP Top 10 for LLM Applications — category mapping
| Category | Applies? | Status |
|---|---|---|
| LLM01 | Prompt Injection (direct) | Yes |
| LLM01 | Prompt Injection (indirect) | Yes — confirmed exploitable |
| LLM02 | Sensitive Information Disclosure | Yes — confirmed |
| LLM05 | Improper Output Handling | Partial — no output-layer filter |
| LLM06 | Excessive Agency | Worth monitoring |
| LLM08 | Vector and Embedding Weaknesses | Yes — confirmed |
manual-model --owasp-four-layer-view
A second manual lens, orthogonal to trust boundaries: which architectural layer does each risk actually live in?
This view earns its keep when a finding doesn't fit neatly in a single OWASP LLM category: the missing output-layer filter is an Implementation-layer gap regardless of which category eventually catches it, and naming the layer makes it obvious which team owns the fix.
automated-model --maestro
MAESTRO — Multi-Agent Environment, Security, Threat, Risk, and Outcome — is Cloud Security Alliance's threat-modelling framework purpose-built for agentic AI systems, rather than a generic app-security checklist retrofitted onto one. I ran the same engagement's asset graph through an automated MAESTRO scan to see what a structured, repeatable process would surface that a one-off manual pass might miss.
The number that mattered most wasn't the risk score — it was 35/35 validated. Every path the scanner reported was reconstructed hop-by-hop from the actual modelled data flows between real assets, not a generic "this category of system is usually vulnerable to X" guess. That's the property that made the output worth triaging instead of skimming.
Top validated attack paths
Both paths start from the same entry point and both land on "critical" — but they're different findings with different fixes. One is about what the workflow engine lets an authenticated step do; the other is about how far a single hijacked instruction travels through the agent → model call chain before anything checks it. A risk score alone collapses that distinction; the hop-by-hop path doesn't.
MITRE ATLAS — the same idea, for ML-specific tactics
Alongside MAESTRO, I cross-checked the finding set against MITRE ATLAS (Adversarial Threat Landscape for Artificial-Intelligence Systems) — a knowledge base of adversary tactics and techniques against AI/ML systems, built as a deliberate structural mirror of MITRE ATT&CK: the same tactic columns (reconnaissance, initial access, persistence, exfiltration, impact…), populated with AI-specific techniques like prompt injection, model inversion, and data poisoning instead of traditional-infrastructure ones. Content poisoning against the Qdrant store maps cleanly onto ATLAS's data-poisoning tactic, which is exactly the finding MAESTRO's automated scan and the manual trust-boundary model both independently pointed at — three different methods converging on one root cause is a stronger signal than any one of them alone.
manual-vs-maestro --what-each-approach-is-actually-good-for
Trust boundaries + OWASP layers
- Surfaces actors a scanner won't guess — the content-poisoner never touches the chat interface, so nothing that only models "user → bot" traffic finds it.
- Carries judgment about severity — knowing why a boundary matters, not just that one exists.
- Doesn't scale — fine for a six-node architecture, painful for a real multi-agent production system with dozens of tools and services.
Asset-graph driven scan
- Exhaustive and repeatable — 35 paths checked the same way every run, not whatever the analyst happened to think of that day.
- Validates, doesn't guess — every reported path is a real verified hop between modelled assets.
- Only as good as the asset graph you feed it — it can't invent a trust boundary or actor you never modelled in the first place.
Neither replaces the other. The manual pass decides what belongs in the asset graph and why a given boundary is dangerous; the automated pass then checks that graph exhaustively instead of relying on one analyst's afternoon. Skip the manual step and MAESTRO scores a graph that's missing the content-poisoner actor entirely. Skip MAESTRO and you're back to hoping you thought of everything.
where-the-model-pointed --what-testing-later-confirmed
The point of a threat model is that it should predict where the real findings land. This one did.
Indirect prompt injection via poisoned document
High severity, LLM01 + LLM08 — exactly the content-poisoner / ingestion-boundary path both the manual model and MAESTRO flagged before a single attack was run.
Sensitive-information disclosure via refusal metadata
Medium severity, LLM02 — the agent named a restricted item's existence and format while still withholding its value, living squarely in the Implementation-layer gap Fig. 2 called out.
Security posture relying on incidental factors
High severity, systemic — retrieval topK and sampling temperature, not architecture, were doing the defensive work. A finding no automated scan surfaces, because it's about configuration drift, not a known attack pattern.
That last one is the real argument for doing both: it only showed up from manually re-running the same query and noticing the answer changed shape between runs. No threat-modelling framework, manual or automated, predicts "your defense is an accident of a config default" — that one needed hands on the keyboard after the model was built, not instead of it.
next-round --automating-the-playbook
The manual tiers and the MAESTRO scan told me where to aim. The next pass runs that playbook automatically, on a schedule, instead of by hand in a terminal. Four tools I'm shortlisting for it:
Promptfoo
Open-source eval and red-team harness for LLM apps. Define test cases as config and it fires a library of adversarial prompts — jailbreaks, injections, PII probes — at your endpoint, then grades the output automatically. Closest thing to a CI test suite for prompt safety, and it slots into a pipeline the same way a unit-test runner would.
promptfoo.dev →PyRIT
The Python Risk Identification Tool for generative AI, built by Microsoft's own AI Red Team. Where most harnesses fire a static prompt list, PyRIT orchestrates multi-turn adversarial conversations — including crescendo-style gradual escalation — and scores each response against the target, closer to tier 8 of the manual playbook than tier 0.
github.com/microsoft/PyRIT →DeepEval
An open-source LLM evaluation framework that runs as pytest-style unit tests. Started as a quality tool — RAG faithfulness, answer relevancy, hallucination — and has grown a real red-teaming surface alongside it: safety metrics for bias, toxicity, and PII leakage sit in the same test file as the quality checks.
github.com/confident-ai/deepeval →Garak
A generative-AI vulnerability scanner with a large, actively maintained probe library — prompt injection, jailbreaks, data leakage, hallucination, encoding tricks. It shines against a model you can query directly and repeatedly, so it's most at home scanning local or self-hosted models rather than a rate-limited hosted API.
github.com/NVIDIA/garak →None of these replace the manual tiers — Tier 8's crescendo and Tier 11's indirect injection still need a human deciding what "innocuous-looking" means for this specific agent. What they replace is re-typing the same 40-odd payloads by hand every time the system prompt changes. More on how this shortlist performs once I've actually wired one up against ACME Assistant.
sources --further-reading
Related on this site: Red-teaming my own RAG agent · Working through the OWASP LLM Top 10 · Prompt injection, from first principles