OWASP field test
LLM05: A practical improper output handling test
RuntimeGuardrails.ai · · AI-assisted educational content
The failure scenario
Model-generated HTML is inserted directly into a browser page.
Run a safe staging test
Pass harmless script-like test strings through the same output path in staging. Verify they display as text or are sanitised, cannot execute, and cannot introduce unsafe links; separately validate any structured action output.
Keep evidence of the result
Record destination-specific encoding, schema rejection and browser execution results. Schema-valid text can still be unsafe when used in a shell or query.
Controls to verify
- Encode output for its destination (HTML, SQL, shell)
- Validate structured output against a schema
- Sanitise Markdown and block unsafe links
- Sandbox any generated code before running it
- Apply a content security policy
Read the complete OWASP risk guide and sources. This exercise follows the 2025 edition; it is not an official OWASP audit.
Examples are fictional. Test only systems you are authorised to assess, using staging and redacted data. Humans and AI can make mistakes: verify advice before relying on it. A self-assessment does not scan your app or certify its security.