Generative AI · Advanced level

Advanced level · Module 11: AI Application Testing and Observability · Lesson 2 of 3

Adversarial, Safety and Security Testing

Learners red-team their application against the OWASP LLM Top 10 (prompt injection, sensitive information disclosure, improper output handling, unbounded consumption and others) and content-safety risks.

In this lesson you will

  • Run adversarial tests against an application
  • Fix and retest vulnerabilities

Key concepts

red-teamingprompt injectionsensitive information disclosureimproper output handlingunbounded consumption

The lesson

The OWASP Top 10 for LLM and Gen AI applications (2025) lists the main risks, including prompt injection, sensitive information disclosure, improper output handling, excessive agency, misinformation and unbounded consumption.

Write adversarial tests: injected instructions in uploads, attempts to reveal other users' documents or system prompts, outputs that could inject HTML into pages, and very long inputs to exhaust budgets. Add content-safety tests for harmful requests.

Fix, retest and keep these tests in the suite so vulnerabilities do not return.

Step by step

  1. Write 15 adversarial and safety tests.
  2. Run them against the capstone.
  3. Fix failures.
  4. Retest and record results.

Practice activity

Produce a red-team report for the capstone.

Expected result: Documented attacks, fixes and passing retests.

Check your understanding

  1. Name three OWASP LLM risks.

    Show answer

    For example prompt injection, sensitive information disclosure, improper output handling or unbounded consumption.

  2. Why keep adversarial tests in the suite?

    Show answer

    To stop vulnerabilities returning after changes.

Further learning

Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.