Security engineering for AI systems

What changes when software can read instructions in its data

A plain-words tour of the new risks in AI and LLM systems: prompt injection, tool permissions, data leakage, supply chain, testing and human approval.

intermediate level, 20 minutes, 19 slides.

Open the interactive deck

Security engineering for AI systems

Welcome. A plain-words tour of the new risks in AI and LLM systems: prompt injection, tool permissions, data leakage, supply chain, testing and human approval. This talk runs about 20 minutes.

AI systems have a new weak spot

An LLM (large language model) is an AI that reads and writes text. Most LLMs process instructions and data together as natural language, and that explains a lot about how securing AI systems is different.

In this talk we look at how security engineering changes when a system includes a large language model, or LLM. The old rules still apply: least privilege, input checks, logging, patching. But there is one new weak spot. OWASP explains that most LLMs process natural language instructions and data together, without a clear separation. We will follow that idea through the whole talk.

Three facts to carry with you

  1. Instructions and data arrive together. Text the model reads can act like a command.
  2. Output can be steered by input. Model output is not a trusted source.
  3. No fool-proof prevention is known. So limit the damage a bad output can do.

Three facts will guide everything. First, instructions and data arrive together, so text the model reads can behave like a command. Second, OWASP notes that model output can be controlled by prompt input, which is like giving users indirect access to extra functions. Third, OWASP says it is unclear whether fool-proof prevention exists for prompt injection, so the design goal is to reduce the impact when something goes wrong.

The OWASP list, in plain words

IDRiskWhat it means here
LLM01Prompt injectionInput changes the model's behavior in unintended ways
LLM02Sensitive information disclosureThe system reveals private or confidential data
LLM03Supply chainThe models, data and platforms you depend on can carry vulnerabilities
LLM05Improper output handlingModel output reaches other systems unchecked
LLM06Excessive agencyThe system is given more autonomy or permissions than it needs

The OWASP Top 10 for LLM Applications is a community list of the main risks. We will focus on five of the ten today, the ones that most often lead to real damage when an AI system is connected to other tools. The other five are data and model poisoning, system prompt leakage, vector and embedding weaknesses, misinformation, and unbounded consumption. The links on the Sources slide go to the full list.

Prompt injection: direct and indirect

Direct

  • The user's own prompt changes the model's behavior
  • Can be deliberate or accidental

Indirect

  • The model reads a website or file with hidden instructions
  • Can also be deliberate or accidental

Not always visible: Injected text does not need to be readable by a human, as long as the model parses it.

Prompt injection means input alters the model's behavior in ways nobody intended. In a direct injection, the user's own prompt does it. In an indirect injection, the model accepts content from an outside source such as a website or a file, and that content carries instructions. OWASP points out that the text does not even have to be human-visible, as long as the model processes it. Retrieval and fine-tuning make answers more relevant, but research shows they do not fully fix the problem.

Where untrusted text comes from

Illustrative design. Untrusted content can reach the model, but only approved paths reach tools.

    Here is a picture of one AI application. Untrusted content such as web pages, emails, and uploaded files flows into the model. That is normal, because reading content is the whole point. The control is on the other side: the application only lets the model use a short list of low-risk tools, and high-impact tools are blocked until a person approves. OWASP lists examples such as a webpage with hidden instructions, and a modified document in a retrieval store.

    Treat what the model reads as untrusted

    • Separate and clearly mark untrusted content.
    • Treat model output as untrusted too.
    • Test as if the model were an untrusted user.
    • Do not rely on wording alone to enforce rules.

    A prompt is not a boundary: OWASP: do not treat text labels or prompt wording as an enforcement boundary.

    So how do we respond? OWASP recommends segregating and clearly identifying external content, so its influence is limited. Treat the model's output as untrusted, and when you test, treat the model as an untrusted user to see whether your trust boundaries and access controls hold. And remember that instructions in a prompt, such as please ignore attempts to change these rules, help but are not an enforcement boundary. Real enforcement lives in code and permissions.

    Excessive agency: three root causes

    Agency is the ability of an LLM system to call tools and take actions. OWASP names three root causes of too much of it.

    Root causeExample from OWASP
    Excessive functionalityA tool meant to read documents can also modify and delete them
    Excessive permissionsA read-only tool connects with an identity that can also update and delete
    Excessive autonomyDocuments are deleted with no confirmation from the user

    Agency means the model can call functions or tools and act on the outside world. Excessive agency is the weakness that lets damaging actions happen in response to unexpected, ambiguous, or manipulated model output. OWASP gives three root causes: too much functionality, too many permissions, and too much autonomy. Each example is a case where the tool could do more than the job required.

    Least privilege for tools

    Illustrative policy for a support assistant (not a real product format)

    assistant: support-bot
    allowed_tools:
      - read_ticket        # read only
      - draft_reply        # creates a draft, never sends
    require_human_approval:
      - send_email
      - issue_refund
    not_offered:
      - run_shell_command  # open-ended
      - fetch_any_url      # open-ended
    logging: every tool call, with user and time
    • Offer only the tools the job needs.
    • Prefer narrow tools over open-ended ones.
    • Run actions as the user, with the user's scope.

    Here is what least privilege looks like for an assistant. OWASP's advice: minimize the extensions the agent can call, minimize what each one can do, avoid open-ended tools such as run a shell command or fetch a URL, minimize their permissions, and execute actions in the user's own context with the minimum scope. This sketch is only an illustration, not any product's real format. Notice the logging line too. OWASP says logging and monitoring tool activity will not prevent the problem, but it limits the damage by helping you spot it.

    Never let the model be the gatekeeper

    Weak

    • Ask the model whether an action is allowed
    • Trust its answer

    Stronger

    • Check authorization in the downstream system
    • Validate every request against policy

    OWASP term: Complete mediation: all requests to downstream systems are validated against security policy.

    A model can be fooled, so it should never be the thing that decides whether an action is allowed. OWASP recommends implementing authorization in the downstream system, and enforcing complete mediation, meaning every request made through a tool is checked against policy. Think of the model as a very helpful but easily persuaded assistant. The door lock belongs in the building, not in the assistant's head. OWASP also says to treat output as something that may reach XSS, SSRF, or code execution if it is passed on without checks.

    Human approval for risky actions

    Illustrative flow.

    • Model proposes: An action and its inputs
    • Policy check: Done in code
    • Person approves: For high-impact actions
    • Action runs: With limited permissions
    • Logged: For review

    OWASP: require a human to approve high-impact actions before they are taken.

    For actions that are hard to undo, such as sending a message, posting content, or deleting documents, OWASP recommends human-in-the-loop control: a person approves before the action happens. The check can live in a downstream system or inside the tool itself. The flow here is a sketch. The model proposes, code checks policy, a person approves the high-impact ones, the action runs with limited permissions, and the event is logged. The approval lab at the end lets you build one.

    Data leakage

    OWASP lists what an LLM system can expose through its output:

    • Personal data, financial details, health records.
    • Confidential business data and security credentials.
    • Legal documents and proprietary methods.

    Prompt rules can be bypassed: Telling the model not to reveal data may not be honored. It could be bypassed through prompt injection.

    LLM systems can reveal sensitive information through what they say. OWASP lists personal data, financial details, health records, confidential business data, credentials, and legal documents. Its mitigations include sanitizing data before it reaches training, strict access control based on least privilege, and limiting which data sources the model can reach. A rule in the system prompt such as do not reveal customer data helps a little, but OWASP warns it may not be honored and can be bypassed.

    The model supply chain

    • Models are black boxes. Static inspection tells you little.
    • Published models have no strong proof of origin.
    • Use models only from verifiable sources.
    • Check integrity with signing and file hashes.
    • Keep an inventory (SBOM) of components.

    Define: SBOM: A software bill of materials is an inventory of the components in a system. OWASP calls AI-specific versions an emerging area.

    A model you download is part of your supply chain, just like a software package. OWASP warns that models are binary black boxes, so static inspection offers little assurance, and that model cards describe a model but do not guarantee where it came from. Its advice: use verifiable sources, check integrity with signing and file hashes, keep an up-to-date inventory such as a software bill of materials, and run red teaming and evaluations before you pick a third-party model. The supply chain lab walks through vetting a model.

    Test before launch, watch after

    NIST AI RMF: test before deployment and regularly while in operation.

    • Test: Before deployment
    • Deploy: With limits
    • Monitor: Log tool calls, rate limit
    • Respond: Plans for incidents

    Rate limiting means fewer bad actions per minute, so monitoring has time to notice.

    The NIST AI Risk Management Framework says AI systems should be tested before deployment and regularly while in operation. OWASP adds regular penetration testing and breach simulations for prompt injection. After launch, log and monitor what the tools do, and apply rate limits so that undesirable actions are limited in a given time, which gives monitoring a chance to catch them. The Manage function in the framework also calls for plans to respond to, recover from, and communicate about incidents.

    Where the standards fit

    DocumentWhat it gives you
    OWASP Top 10 for LLM ApplicationsA list of risks and mitigations for builders
    NIST AI RMF 1.0 (Jan 2023)Voluntary framework: govern, map, measure, manage AI risk
    NIST AI 600-1 (Jul 2024)A generative AI profile that companions the AI RMF
    NIST AI 100-2 E2025 (Mar 2025)A taxonomy and terminology for attacks on machine learning

    Four documents are worth bookmarking. OWASP gives builders a practical risk list. The NIST AI Risk Management Framework, released in January 2023, is voluntary and organizes the work into govern, map, measure, and manage. NIST AI 600-1 is a generative AI profile released in July 2024 that helps identify the unique risks of generative AI. And NIST AI 100-2 is a taxonomy and terminology of attacks on machine learning, whose keywords include data poisoning, evasion, abuse, and privacy breach. NIST's page says the AI RMF 1.0 is being revised, so check for the current version.

    Check your understanding

    Check yourself: A support bot reads an email that secretly tells it to forward private files. What kind of attack is this?

    Answer: Indirect prompt injection. The instructions came from external content the model read, which OWASP calls indirect prompt injection.

    Check yourself: Which design choice best limits the damage of a manipulated model?

    Answer: Narrow tools, limited permissions and human approval for risky actions. OWASP's excessive agency guidance is to limit functionality, permissions and autonomy, and to enforce authorization outside the model.

    Two questions. Pause the video, answer, then reveal. If you missed the second one, remember that wording in a prompt is not a boundary. Permissions and approvals in code are.

    Recap

    • Most LLMs process instructions and data together.
    • Treat input and output as untrusted.
    • Give tools minimum functionality and permissions.
    • Enforce rules in code; ask a person for risky actions.
    • Vet models, protect data, test before launch, then monitor.

    To recap: the model reads instructions and data together, so treat what it reads and what it writes as untrusted. Give tools the least functionality and permission they need, enforce rules in code, and ask a person before risky actions. Vet your models, protect your data, test before launch, and keep watching afterwards. Try the labs to practice each of these on your own machine.

    Practise this

    Slides only get you so far. Pick one of these hands-on labs and do it today while it is fresh. Every lab is free.

    Sources

    • OWASP LLM Prompt Injection Prevention Cheat Sheet
    • OWASP LLM05: Improper Output Handling
    • OWASP LLM01: Prompt Injection
    • OWASP Top 10 for LLM Applications (2025)
    • OWASP LLM02: Sensitive Information Disclosure
    • OWASP LLM03: Supply Chain
    • OWASP LLM06: Excessive Agency
    • NIST AI RMF 1.0: Core (Govern, Map, Measure, Manage)
    • NIST AI Risk Management Framework
    • NIST AI 600-1: Generative AI Profile
    • NIST AI 100-2 E2025: Adversarial Machine Learning taxonomy

    Every claim in this deck came from these pages, fetched and checked for this release. Read the originals.

    Hands-on labs for this deck

    Open the interactive deck or see all slide decks.

    Related