AI Security for Apps
Last updated Sep 8, 2026 Applications that use large language models (LLMs) are exposed to threats specific to how LLMs process input — prompt injection attacks, PII exposure in prompts, and prompts about unsafe topics.
AI Security for Apps (formerly Firewall for AI) complements your existing WAF rules with detections designed for these LLM-specific threats. It is model-agnostic — the detections work regardless of which LLM you use.
- PII detection — Detect personally identifiable information (PII) in incoming prompts, such as phone numbers, email addresses, social security numbers, and credit card numbers.
- Unsafe and custom topic detection — Detect prompts related to unsafe subjects such as violent crimes or hate speech, or custom topics specific to your organization.
- Prompt injection detection — Detect prompts designed to subvert your LLM's intended behavior, such as attempts to make the model ignore its instructions or reveal its system prompt.
When enabled, AI Security for Apps scans incoming requests to endpoints labeled cf-llm for LLM prompts that may contain threats. Currently, the detection only handles requests with a JSON content type (application/json).
Based on scan results, Cloudflare populates AI detection fields — fields you can use in WAF rule expressions. You can use these fields in two ways:
- Monitor: Filter by the
cf-llmlabel in Security Analytics to review detection results across your traffic. - Mitigate: Use the fields in custom rules or rate limiting rules to block or challenge requests based on detection results.
Availability
AI Security for Apps capabilities vary by Cloudflare plan:
| Capability | Free | Pro | Business | Enterprise |
|---|---|---|---|---|
| LLM endpoint discovery — Automatically identify AI-powered endpoints across your web properties | Yes | Yes | Yes | Yes |
| AI Security Log Mode Ruleset — Pre-built ruleset that logs the full request body alongside detection results | No | No | No | Paid add-on |
| AI detection fields — PII detection, prompt injection scoring, unsafe topic detection, custom topics | No | No | No | Paid add-on |
To get access to the AI Security Log Mode Ruleset and enable AI detection fields, contact your account team.
AI Security for Apps is built into the Cloudflare Web Application Firewall (WAF) — the WAF must be enabled on your zone before detection fields can be populated and used in rule expressions.
More resources
- AI Gateway — Monitor, control, and cache requests to LLM providers.
- What are the OWASP Top 10 risks for LLMs? ↗︎ — Background on the most common security risks for LLM-powered applications.
Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/waf/detections/ai-security-for-apps/#page","headline":"AI Security for Apps","description":"Detect prompt injection, PII, and unsafe topics in AI application traffic.","url":"https://developers.cloudflare.com/waf/detections/ai-security-for-apps/","inLanguage":"en","image":"https://developers.cloudflare.com/waf/detections/ai-security-for-apps/og.png?v=386afb887bec9a78","dateModified":"2026-09-08","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"},"keywords":["AI"]}
description: Example mitigation rules for AI Security for Apps detections. title: Example mitigation rules image: https://developers.cloudflare.com/waf/detections/ai-security-for-apps/example-rules/og.png?v=23ffe249e1a10e47
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/waf/llms.txt
Use this file to discover all available pages before exploring further.
Docs