CertBrain
CoursesBlog
Sign in
← Back to decks
Sign in to save your progress, vote, and build your own decks.Sign in

Security and Privacy Risks in AI Systems

A generative AI application faces the usual security risks of any application, plus new ones: prompts that try to hijack the model, answers that leak private data, toxic content, and conversations that need an audit trail. No single control covers all of this. This lesson goes beyond recognising…

12 cards
Study this deck

Security and Privacy Risks in AI Systems

A generative AI application faces the usual security risks of any application, plus new ones: prompts that try to hijack the model, answers that leak private data, toxic content, and conversations that need an audit trail. No single control covers all of this. This lesson goes beyond recognising prompt attacks to the controls a team puts around an AI system: filtering what goes in and comes out, keeping private data out of answers, logging every interaction, encrypting data, and finding threats and vulnerabilities.

Defense in depth

Security for AI works in layers, so one failure doesn't expose everything:

  • Identity and access. Only approved people and services can call the model or read its data.
  • Network. Private connections such as AWS PrivateLink keep traffic off the public internet.
  • Input checks. Prompts are screened before the model sees them.
  • Output checks. Responses are screened before the user sees them.
  • Monitoring. Logs and alerts show what happened and when.

AWS's guidance for generative AI recommends validating prompts before they reach a model, for example with guardrails, size limits and rate limits, and combining those with checks in the application itself. Prompt-level defences, such as clear instructions in a system prompt, help but can be talked around, so they're never the only layer.

Filtering inputs and outputs

Data leakage happens when a model reveals information the user shouldn't get, such as another customer's details or confidential documents. Two controls work together:

  • Limit what the model can see. In a RAG application, filter retrieval so each user only gets documents they're allowed to read. Bedrock managed knowledge bases offer ACL-aware retrieval for this: your app authenticates the user and passes their identity, and only documents they may read come back. A model can't leak a document it never received.
  • Filter what comes out. Amazon Bedrock Guardrails can block or mask personal data in responses.

Toxicity is hateful, abusive or threatening content, in user input or model output. Bedrock Guardrails content filters cover model conversations. For text from other sources, Amazon Comprehend detects toxic content. For recorded speech, Amazon Transcribe toxicity detection analyses both the words and the tone of voice. That feature works on batch transcription in US English.

Logging and audit trails

Two AWS logs answer different questions:

LogWhat it recordsQuestion it answers
Amazon Bedrock model invocation loggingFull request and response bodies, model ID, caller identity, token countsWhat exactly did users ask, and what did the model say?
AWS CloudTrailAPI calls such as InvokeModel, CreateGuardrail and DeleteGuardrail, with who made them, when and from whereWho changed or called what?

Invocation logging is off by default and sends logs to Amazon CloudWatch Logs, Amazon S3 or both. Because these logs hold real prompts, they can contain personal data, so encrypt them with AWS KMS and limit who can read them.

Encryption in transit and at rest

Bedrock requires TLS 1.2 for API connections and recommends TLS 1.3. At rest, you can use AWS KMS keys you manage for custom models, knowledge base data sources, agents and evaluation jobs. Training data and documents in S3 can use server-side encryption with KMS keys.

Threats and vulnerabilities

  • Threat detection. Amazon GuardDuty analyses CloudTrail events and can flag suspicious Bedrock activity, such as a user signing in from an unusual place and then removing a guardrail.
  • Vulnerability management. When you host models yourself, Amazon Inspector continuously scans EC2 instances, container images in Amazon ECR and Lambda functions for known software vulnerabilities and unintended network exposure.

On the exam

"Record every prompt and response" points to model invocation logging. "Who deleted or changed it" points to CloudTrail. "Users see data they shouldn't" means restrict access at retrieval, not just in the prompt. "Known vulnerabilities in our model's containers" points to Amazon Inspector.

Quiz me on this
A bank's compliance team must be able to review the full text of every prompt sent to its Amazon Bedrock assistant, the model's exact responses, and which IAM role made each call. Which feature provides this?
  1. AWS CloudTrail management events for Amazon Bedrock
  2. Amazon Inspector scans of the application's instances
  3. ✓ Amazon Bedrock model invocation logging
  4. AWS Config rules for Amazon Bedrock resources
A guardrail that protected a public chatbot was deleted last week, and harmful answers started appearing. The security team needs to find out which identity deleted it and when. Which service should the team check?
  1. ✓ AWS CloudTrail
  2. Amazon Bedrock model invocation logging
  3. Amazon Inspector
  4. Amazon Macie
A healthcare company has turned on Amazon Bedrock model invocation logging to an Amazon S3 bucket, because auditors require a full record of AI conversations. The security team notices the logs contain patients' names and conditions from their prompts. Which action protects this data while keeping the audit record?
  1. Turn off model invocation logging so that no prompt text is ever stored anywhere
  2. Apply a Guardrails sensitive information filter to the model's responses only
  3. Rely on CloudTrail alone, because it keeps prompt text in a protected format
  4. ✓ Encrypt the logs with a KMS customer managed key and limit who can read them
An online game records players' voice chat. The company wants to flag hate speech, threats and harassment in those recordings for human moderators, taking tone of voice into account as well as the words. Which AWS capability fits BEST?
  1. Amazon Polly
  2. ✓ Amazon Transcribe toxicity detection
  3. Amazon Rekognition content moderation
  4. Amazon Comprehend PII detection
A company's HR assistant uses an Amazon Bedrock knowledge base built from all HR documents, including every employee's salary record. Testers find that employees can get colleagues' salaries by rephrasing their questions. Which control addresses this MOST reliably?
  1. ✓ Use ACL-aware retrieval so each user retrieves only documents they may see
  2. Add a system prompt instructing the model never to reveal any employee's salary details
  3. Turn on a Guardrails contextual grounding check with a high grounding threshold
  4. Lower the model's temperature so that it quotes retrieved passages less freely
A startup runs an open-source language model in containers on Amazon EC2, using images stored in Amazon ECR. It wants continuous, automatic scanning of those images and instances for known software vulnerabilities, with rescans when new vulnerabilities are published. Which service meets this need?
  1. Amazon Macie
  2. AWS CloudTrail
  3. Amazon Bedrock Guardrails
  4. ✓ Amazon Inspector
Amazon Bedrock model invocation logging
Records full prompts, responses, model ID and caller identity for model calls, to CloudWatch Logs and/or S3. It's off by default.
AWS CloudTrail with Amazon Bedrock
Records Bedrock API calls, such as InvokeModel or DeleteGuardrail, with who made them, when and from where, but not prompt text.
Data leakage prevention in RAG
Limit what each user can retrieve, e.g. ACL-aware retrieval using the app's verified user identity, and filter outputs. A model can't leak a document it never receives.
Amazon Bedrock encryption
Data in transit is protected with TLS. At rest, you can use your own AWS KMS keys for custom models, knowledge base data sources, agents and evaluation jobs.
Amazon Inspector
Continuously scans EC2 instances, ECR container images and Lambda functions for known software vulnerabilities and unintended network exposure.
Toxicity detection in speech
Amazon Transcribe toxicity detection uses both the words and cues such as tone and pitch to flag toxic speech, in categories like hate speech, threats and profanity.