Skip to content
aiqbenchAI & Quantum Intelligence
NewsInsightsBenchmarksSkillsAsk AILearnAbout
...Loading your session
NewsInsightsBenchmarksSkillsAsk AILearnAbout
  1. Future Jobs
  2. ›
  3. AI Security Engineer
  4. ›
  5. Lesson 6 of 8

Detection, Monitoring and Incident Response for AI Systems

Intermediate¶ Read · 5 min⚑ Mission · 35 min◆ Quiz · 4 questions

You'll be able to:

You can specify what an AI system must log to be investigable (prompts, retrieved context, tool calls, model versions, policy decisions), place input/output classifiers where they help without pretending they are a boundary, and run an incident through the NIST lifecycle with AI-specific containment steps such as revoking tool credentials and rolling back a model or index.

You cannot investigate what you did not record

Traditional incident response assumes the system is deterministic: replay the request, see the bug. An AI system is not. The same prompt can produce different outputs, the "code" includes a model version and an index snapshot that both change, and the harmful event may have been a perfectly well-formed request that the model simply obeyed. Detection and response for AI therefore start with one decision: what gets logged.

The minimum investigable record

For every model call, capture:

  1. Identity and session — which user, which tenant, which agent run.
  2. The full prompt as assembled — system prompt version, the user message, and the exact retrieved chunks or tool results that were included. Not "the query"; the context the model actually saw.
  3. The model identifier and parameters — provider, model version, temperature, any safety settings.
  4. The raw output — before post-processing, and the post-processed version.
  5. Tool calls — name, arguments, result, and whether a gate was shown and what the human chose.
  6. Policy decisions — which classifiers ran, their scores, and what the application did with them.

The OpenTelemetry semantic conventions for generative AI define attribute names for most of this, which matters because consistent naming is what lets you query across services during an incident rather than grepping four log formats. Retention and access to these logs is itself a privacy question — prompts contain personal data — so they need the same controls as any sensitive store, and a stated retention period.

Detection: what good signals look like

Few AI attacks are detectable from a single request. Patterns are.

  • Injection attempts often appear as instruction-like text inside retrieved content or tool results. A classifier such as Llama Guard, or a simpler rule set, scoring the context rather than only the user's message, gives a signal; the Llama Guard paper is a clear account of how such input/output safeguards are built and, importantly, how they are evaluated. Treat scores as telemetry — a rise in flagged documents from one source is an alert — not as a boundary (module 2).
  • Extraction shows up as query volume and coverage: one client systematically sweeping the input space, or many accounts with correlated traffic.
  • Data leakage shows as outputs that contain patterns from the sensitive class — account numbers, another tenant's identifiers. Output-side scanning for known formats is cheap and catches the embarrassing cases.
  • Agent anomalies: tool calls to destinations never seen before, an unusual sequence (read many records, then one outbound call), or an approval rate that jumps to 100% overnight.
  • Drift: a sudden change in the distribution of outputs, categories or refusal rates after a model or index update is often the first sign that something upstream changed under you.

Alert on changes relative to a baseline rather than on absolute values; the baseline for an AI system moves with every model release, so re-establish it deliberately after each one.

Response: the NIST lifecycle, with AI-specific steps

NIST SP 800-61 Rev. 2 structured response as preparation, detection and analysis, containment, eradication and recovery, and post-incident activity; Rev. 3 (April 2025) replaces that cycle with a new model built on the CSF 2.0 functions — Govern, Identify and Protect as preparation, which NIST treats as broader risk management rather than incident response itself; Detect, Respond and Recover as the response (incident analysis, containment and eradication are Respond categories); and Identify's Improvement category taking lessons learned from every function continuously rather than only after the incident. The old phases still work as a checklist; the content changes.

Containment for an AI system means removing capability fast: revoke or rotate the agent's tool credentials; switch consequential tools to require approval or disable them; pin the model to a known-good version; take a suspect index or document source offline. Because a compromised model or index affects every user, containment is usually broader and faster than for a conventional bug.

Eradication asks which artefact was the problem. A poisoned document in the retrieval index is removed and the source quarantined. A backdoored or regressed model is rolled back using the registry record from module 3, which is why that record must exist before the incident. A leaked system prompt is rotated along with any secrets it contained — and it should never have contained secrets.

Recovery restores capability with the fix verified: replay the incident's logged prompts against the fixed system and confirm the behaviour is gone.

Worked example: the cross-tenant quote

A user reports that the RAG assistant quoted another customer's contract.

  1. Detection: the report. What should have caught it: an output scanner for tenant identifiers that do not match the session's tenant.
  2. Triage: pull the logged context for the session. Did the retrieved chunks include the other tenant's document? If yes, the fault is in retrieval filtering (a missing tenant filter on the vector query), not the model.
  3. Containment: disable retrieval for the affected corpus, or enforce the tenant filter at the query layer immediately.
  4. Eradication: fix the filter; audit the index for cross-tenant chunks; check whether the bug existed since the index was built.
  5. Recovery: replay the logged query; confirm only the correct tenant's chunks return.
  6. Post-incident: add the tenant check to the retrieval layer's tests, add the output scanner, and estimate exposure from the logs — which users saw which foreign chunks — for disclosure obligations.

Without the retrieved-chunks log, step 2 takes days of guesswork; with it, an hour.

What is still unsettled

There is no agreed standard for what counts as an "AI security incident" versus a model quality issue, which complicates disclosure. Prompt logging conflicts with data-minimisation obligations, and organisations resolve it differently. Detection of subtle manipulation of outputs — a model persuaded to give slightly wrong advice — has no reliable signal today.

What to remember

  • Log the context the model actually saw, the model version, tool calls and policy decisions; this is the difference between an hour and a week.
  • Classifiers and scanners are telemetry, not boundaries; alert on changes from a baseline that you re-establish after every model release.
  • Containment for AI is revoking capability: credentials, tools, model pins, index sources.
  • Eradication depends on registry and provenance records that must exist before the incident.

Check Yourself

Loading the questions…

Module Mission

30–40 min

Decision 6 of the case file. Write the incident runbook for one scenario: a customer reports that the chat widget quoted another customer's contract. Lay out detection (what signal would have caught it earlier), triage questions, containment in order (what do you switch off first?), eradication (index, model, permissions), recovery and the changes afterwards. Then list the six log fields that would have made the investigation take an hour, not a week.

Open Case file: Halden Assist →

Good looks like

  • Containment is ordered, and the first step stops further exposure before anyone looks for the cause.
  • Triage asks how many customers and which documents, and says how you would find out with today's logs.
  • Eradication fixes the cause in the architecture (how customers are separated), not only the one query.
  • The six log fields are specific enough to implement, and include what was retrieved and for whom.
  • The runbook says who is told and when, including the affected customer.

Loading your work…

Curated Materials

1.7h

The deep work happens here — the lesson is your briefing.

  • NIST SP 800-61 Rev. 3: Incident Response Recommendations and Considerations for Cybersecurity Risk ManagementDocs· 40 min
  • Inan et al.: Llama Guard — LLM-based Input-Output Safeguard for Human-AI ConversationsPaper· 35 min
  • OpenTelemetry Semantic Conventions for Generative AI systems (what to trace on every model and tool call)Docs· 25 min

Live on aiqbench

This lesson's subject on the rest of the site, today.

In the news, last 30 days

  • Hackers Hide Password-Stealing Malware in GitHub Code, Putting Software Downloads at RiskCybersecurity News · Nov 26
  • Silver Fox Hackers Use Fake Software Downloads to Spread Gh0stRAT Malware That Can Spy on PCsCybersecurity News · Nov 26
  • MINE: A Training-Free Defense against Indirect Prompt Injection via Mutual Information and Embedding VariancearXiv · Nov 26
More news on this subject →

Go further

  • How the leaderboards workHow scores are combined, and what a rank cannot tell you.
  • Ask AI about this lessonOpens Ask AI with a question about this lesson, answered from the news archive with sources.
  • Agent skills for this workReady-made skills for AI coding agents, checked and rated.
← Previous lesson5. Securing Agents and Tool Use — Least Privilege, Sandboxes, Gates, EgressNext lesson →7. A Secure Development Lifecycle for AI — Threat Modelling, Testing, Red Teams, Regulation
aiqbench
AI & Quantum Intelligence© aiqbench. All rights reserved.

Feeds:RSS·JSON Feed

LanguageEnglish·Românăbeta
NewsAI & TechQuantumInsights
ExploreBenchmarksLearn
CompanyAboutTrustLegal noticeTerms of ServicePrivacy PolicyCopyright noticesData erasureReport content

The aiqbench take, the insights, the daily digest and Ask answers are written by AI models from the sources shown, without editorial review before publication. They may contain errors — check the source. How the model is used →

  • News
  • Insights
  • Ask AI
  • Benchmarks
  • Account