CyberSecurity
OWASP for LLM applications
OWASP for LLM applications
Lecture 5: OWASP for LLM Applications
OWASP Top 10 for LLM Applications is a security awareness guide from the OWASP GenAI Security Project that identifies the most critical security risks in applications using Large Language Models (LLMs), such as ChatGPT-based assistants, RAG systems, and AI agents.
To identify, understand, and prioritize the most critical security risks associated with Large Language Model (LLM) applications, enabling development teams to design, build, test, and deploy AI solutions securely.
It helps teams establish security requirements, implement appropriate controls, and reduce risks such as prompt injection, sensitive data leakage, and unauthorized AI agent actions.
This occurs when malicious input or a document manipulates an LLM into ignoring its intended instructions.
Example: a document in a RAG knowledge base instructs the assistant to reveal confidential information.
Resolution: Separate trusted instructions from untrusted content, restrict tool permissions, enforce access controls, and test against direct and indirect prompt injection.
An LLM may expose confidential information, personal data, credentials, or another customer's records.
Example: a licensing assistant returns one customer's application details to another customer.
Resolution: Enforce authorization at the API and data-retrieval layers, minimize sensitive information in prompts, redact outputs, and apply data-loss prevention controls.
An AI agent may perform unauthorized or unintended actions because it has excessive permissions or insufficient safeguards.
Example: an agent cancels a customer's application without approval. Resolution: Apply least privilege, allowlist tools and operations, require human approval for high-impact transactions, and maintain auditable action logs.
AI systems may inherit risks from compromised models, third-party libraries, datasets, or external tools.
Example: a compromised model package introduces malicious behavior into an AI application.
Resolution: Verify model provenance and integrity, scan dependencies, pin approved versions, maintain software and model inventories, and assess suppliers before integration.
Attackers manipulate training data, fine-tuning datasets, or knowledge sources to influence AI behavior.
Example: fraudulent documents are added to a knowledge base, causing the assistant to recommend incorrect procedures.
Resolution: Validate data sources, restrict ingestion permissions, track data provenance, detect anomalies, and test datasets and model behavior before deployment.
Excessive prompts, repeated requests, or uncontrolled agent loops can exhaust computing resources, increase costs, or degrade availability.
Example: an agent repeatedly invokes tools until its cloud budget is exhausted.
Resolution: Apply rate limits, token and context limits, execution timeouts, concurrency controls, request quotas, and cost monitoring.
An LLM may generate incorrect or fabricated information while presenting it confidently.
Example: an assistant invents a regulatory requirement or provides an incorrect licensing fee.
Resolution: Ground responses in authoritative sources, validate factual claims, provide source references, communicate uncertainty, and require human review for consequential decisions.
Internal instructions, confidential contextual information, or sensitive workflow details may be revealed through model responses.
Example: a user manipulates an assistant into disclosing internal prompts or retrieved confidential content.
Resolution: Avoid placing secrets in prompts, minimize contextual data, enforce access controls, isolate sensitive information, and test for unintended disclosure.
Weaknesses in vector databases, embedding pipelines, or retrieval controls can expose data or return manipulated or irrelevant content.
Example: A RAG assistant retrieves confidential documents belonging to another department or tenant.
Resolution: Enforce document-level and tenant-level authorization before retrieval, validate metadata filters, secure vector stores, isolate indexes where appropriate, and test retrieval boundaries.
Applications may trust AI-generated content and execute it without proper validation, creating conventional security vulnerabilities.
Example: an application renders malicious AI-generated HTML or executes generated SQL directly against a database.
Resolution: Treat model output as untrusted input, validate against strict schemas, use parameterized queries, apply context-aware output encoding, and execute sensitive operations only through controlled APIs.
Dr. Ghoniem Lawaty
Tech Evangelist @TechHuB Egypt