Free self-study · No account needed · Progress stays in this browser. Back it up before clearing site data or changing devices.

← Week 17: AI Threat Modeling

Week 17 / Lesson 1

Threat modeling an agent system

Trace attacker-controlled inputs to assets and protected operations.

Section 1.1 1 of 7

Overview

Focus

Trace attacker-controlled inputs to assets and protected operations.

Your route through the lesson

  • 1.2 Assets, actors, and entry points
  • 1.3 Data flows and trust boundaries
  • 1.4 Excessive authority and attack paths
  • 1.5 Put it into practice
  • 1.6 Guided comparison
  • 1.7 A new tool that expands authority

All required teaching is included here. Review selections are saved. Choose a correct answer for every question to continue; retries are unlimited. Study time and personal notes are optional.

Section 1.2 2 of 7

Assets, actors, and entry points

Focus

Identify protected assets, attacker control, and reachable entry points.

A threat model explains how an adversary could cause an unwanted outcome in a particular system. Begin with assets: private documents, credentials, task integrity, stored state, money, availability, and the authority to perform operations. An asset need not be a secret; a public report's correctness may still require protection.

Actors include legitimate users, service operators, document authors, tool providers, and attackers controlling some of those surfaces. An entry point is where their input reaches the system, such as a chat request, retrieved document, uploaded file, tool result, or changed skill instruction. State exactly what the attacker controls. Control of one retrieved paragraph is different from control of the executor's permission database.

For a local case-summary assistant, an attacker might edit an imported document but cannot modify the authenticated user's export approval. The protected asset is the private case note, and the unwanted outcome is exporting it to an unapproved destination. That framing avoids vague threats such as the model gets hacked. It supplies concrete objects and boundaries that a control can test, while keeping the classroom examples fictitious and harmless.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. An attacker edits one retrieved paragraph but cannot change permissions. What should the threat model state?
2. Which can be an asset even when it contains no secret?
3. A malicious tool result reaches the assistant. What is it in the model?

Section 1.3 3 of 7

Data flows and trust boundaries

Focus

Trace data flow and mark each transition from information to authority.

A data-flow view follows information from source to model context, proposed action, executor, and resulting effect. A trust boundary is a point where data or control crosses between differently trusted components. The most consequential boundary often occurs when model-generated text becomes an executable operation.

In the case-summary workflow, document text enters retrieval, retrieval enters the model's context, the model proposes an export, and the executor decides whether to write the export. A document author may influence the first two stages, but that should not grant permission at the last stage. Label content provenance so an instruction inside a document remains document data rather than being promoted to an authenticated user request.

For each arrow ask what validation occurs and who supplies authority. Schema validation checks shape; authorization checks whether this actor may perform this operation on these resources; runtime isolation limits process capabilities. These are different checks. A well-formed export request can still be unauthorized. A rejected export may still leak data through a debug log if that second flow is omitted. Include outputs, logs, memory, and network destinations in the diagram rather than tracing only the main happy path.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A model proposes a well-formed export to an unapproved destination. Which check is decisive?
2. Why include debug logs in a data-flow model?
3. A document says I am the administrator. What authority should that text carry?

Section 1.4 4 of 7

Excessive authority and attack paths

Focus

Prioritize attack paths by reachable authority and concrete impact.

Excessive agency means a system has more capability or autonomy than its task requires. A summarizer that only needs to read one folder should not automatically receive shell access, unrestricted network egress, and credentials for every project. Broad authority turns a content mistake into a larger potential effect.

An attack path links entry point, attacker-controlled content, a decision influenced by that content, a protected operation, and an asset. For example: poisoned document asks for export; model proposes export; executor accepts arbitrary destinations; private notes leave the allowed workspace. The concrete control is destination and project authorization enforced before the write, supported by limiting what data the worker can read.

Prioritize plausible reachable paths with serious impact before obscure paths requiring authority the attacker does not have. Record assumptions and residual risk. Removing an export tool blocks one path but may leave response text, logs, or network requests as alternatives. A useful threat model therefore maps controls to specific transitions and tests them. It does not claim that a single prompt instruction or a long list of generic threats makes the whole system secure.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. A read-only summarizer receives unrestricted shell and network access. What is the concern?
2. Which threat statement is actionable?
3. Removing an export tool proves no disclosure path remains. Correct?

Section 1.5 5 of 7

Put it into practice

Focus

Run a fictitious threat record and connect its fields into one attack path.

Download week17.py, save it in an exercise folder, and run python week17.py --lesson 1. This single practice creates one local threat record from fictitious data. It uses only the standard library, a small processor, and seconds of runtime. There are no credentials, external recipients, model calls, or generated executable programs.

The record names retrieved document as entry, document text as attacker control, synthetic case notes as asset, text to export action as authority transition, and an executor authorization check as control. A Python dictionary represents these named fields. all(threat.values()) checks that every supplied field is nonempty; it does not establish that the model is complete or the control is effective.

The file is written into a temporary directory and removed at completion. PASS means the expected structure is populated. The instructional work is to trace the path: attacker edits document, document influences proposal, executor checks authorized operation and destination, and protected notes remain inside the intended boundary when the check rejects. This is a starter threat artifact for the weekly system, not a claim that every possible attack has been cataloged.

Download this week’s Python lab ↓

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. all(threat.values()) is true. What does that establish here?
2. Which field describes the privilege-relevant crossing in the fixture?
3. A threat-record script writes fictitious metadata to a temporary file and contains no network or model calls. Does it send private notes anywhere?

Section 1.6 6 of 7

Guided comparison

Focus

Explain what the completed threat record proves and what must be tested next.

The worked record has five linked parts rather than five unrelated labels. Retrieved document is the entry surface. Document text is the adversary's controllable material. Synthetic case notes are the asset. Text-to-export is the authority transition. The executor's operation-and-destination check is the proposed control at that transition.

This gives a falsifiable prediction: an export proposal from document content should be denied when it lacks authorized operation and destination. The next test must exercise that decision and inspect actual effects. A nonempty control field is not enough. Likewise, the record should include legitimate summarization so the control does not solve disclosure risk by disabling the entire product.

The threat model can be expanded with source permissions, project scope, logs, and worker runtime capabilities. Each addition should explain a distinct path or boundary. Avoid multiplying vague entries that all say ignore malicious text. The model is useful when it directs concrete checks and helps interpret their limits. A passing synthetic executor fixture validates selected transitions; a live model test and an operating-system isolation test remain separate competencies with different evidence.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. What test follows naturally from the threat record?
2. Why include legitimate summarization in later testing?
3. A synthetic executor test passes. Which competency is still separate?

Section 1.7 7 of 7

A new tool that expands authority

Focus

Revisit the threat model when a new tool expands reachable effects.

A case-summary assistant initially has only read_case and write_local_summary. A new send_report tool can transmit content to a destination. This changes the system even if the summarization prompt remains identical: an attacker-controlled document now has a possible path to an external effect through a proposed send operation.

The worked update adds the tool's inputs, recipient interpretation, authentication, project scope, and effect record to the data-flow model. It asks whether the assistant can choose arbitrary recipients and whether approval binds the exact payload and destination. A narrow design allows only an authorized local reporting destination for this classroom system. Negative tests include a changed destination, a cross-project payload, and a document claiming emergency permission.

The new tool may also expose credentials or descriptive text that enters model context. Those become additional surfaces to inspect. Review the actual authority provided by the tool integration rather than assuming a trusted tool name makes every returned string trustworthy. Threat models should change with capabilities, data sources, and deployment permissions. A previously passing catalog cannot establish coverage for a newly reachable operation that it never exercised.

// Quick review

Check your understanding.

Choose an answer for immediate feedback. Retry freely; a correct answer for every question unlocks the next section.

1. Adding send_report changes which aspect of the threat model?
2. Which new negative case directly tests recipient authority?
3. Old tests passed before send_report existed. What can they establish about the new tool?

Your personal notes

Optional, ungraded, and saved only in this browser. Export a backup from the Academy homepage to keep them.

References and further reading
Ask your own AI assistant

Copy this prompt into an assistant you already use. Nothing is sent automatically, and your personal notes are not included.

Next lesson: Testing injection and information leakage →