Generative AI security best practices: A guide to secure GenAI usage

  •  
     
  • -Select-
By clicking 'Download PDF', you agree to processing of personal data according to the Privacy Policy.

Thank you!

The PDF link has been sent to your email.

We hope you enjoy reading and sharing these best practices.

Generative AI (GenAI) systems have fundamentally changed how organizations approach security. Unlike traditional software, where attackers exploit known software vulnerabilities to steal data or gain unauthorized access, GenAI platforms introduce new risks where sensitive data, user interactions, and AI behavior become potential targets. Attackers can manipulate AI behavior through techniques such as prompt injection, training data poisoning, and output manipulation, while everyday AI usage can lead to unintended data exposure, unauthorized information disclosure, and unsafe outputs. Because these risks extend beyond the application itself, they cannot be fully addressed using conventional security controls alone. Implementing AI-specific security best practices helps reduce these risks while enabling the safe adoption of GenAI applications.

How to protect your organization against GenAI usage and platform risks

 

Audit employee prompts for sensitive data exposure

  • Inspect prompt content in real time before it leaves the organization, and flag or block inputs carrying sensitive data.
  • Define prompt content policies that name which data categories are prohibited in GenAI interfaces, such as customer records, financial projections, proprietary code, and HR data.
  • Classify sensitive data at the enterprise level first, so prompt monitoring can detect it by classification label rather than keyword or pattern matching.
  • Review logs of flagged prompts regularly to surface systemic misuse patterns.
 

Detect and block shadow GenAI application use

  • Gain visibility into all GenAI traffic on corporate networks.
  • Maintain an inventory of approved GenAI applications and update it regularly as new tools emerge.
  • Block or restrict access to high-risk unapproved platforms at the network or endpoint level, starting with those that have no enterprise data handling agreement.
  • Offer sanctioned alternative options with a fast approval process, so employees are less likely to seek work-arounds.
 

Validate GenAI outputs before downstream system use

  • Sanitize model outputs before sending them to downstream systems such as query engines, shells, and interpreters.
  • Validate responses against expected formats, policy constraints, and content safety thresholds.
  • Require human review of high-stakes outputs such as legal documents, compliance reports, financial summaries, and medical content.
  • Flag low-confidence or anomalous outputs for review.
  • Add confidence scoring and citation requirements to RAG pipelines.
 

Prevent jailbreaking and guardrail bypass

  • Deploy an input classifier that screens prompts for jailbreak framing before they reach the model.
  • Filter model outputs through a separate check that blocks restricted content even if a prompt slips past input screening.
  • Red-team the AI model against known jailbreak techniques such as roleplay framing, token manipulation, and many-shot prompting.
  • Alert on bypass signals such as escalating instruction chains and repeated requests to pretend, roleplay, or ignore prior rules.
  • Refresh red team test cases every cycle to cover newly published jailbreak methods.
 

Protect against training data and model poisoning

  • Track the origin and integrity of every data source used for pre-training, fine-tuning, or embedding.
  • Scan training data for adversarial samples before ingestion, since poisoned samples can embed backdoors.
  • Allow only authorized accounts to have write access to training pipelines, embedding stores, and vector databases.
  • Monitor model output over time for drift or unexpected patterns that signal a poisoned retrieval source.
  • Run integrity checks on RAG knowledge bases to catch poisoned entries before they reach the model at inference.
 

Secure GenAI APIs against model extraction and abuse

  • Require every API call to a model endpoint to carry a valid, verified credential such as an API key or access token.
  • Rate-limit and throttle queries to stop adversaries from probing the model repeatedly to replicate its behavior.
  • Log every API call with its query pattern, response size, and timestamp.
  • Alert on call patterns that suggest systematic probing.
  • Rotate API keys on a fixed schedule and audit active credentials to revoke any tied to unauthorized use.
 

Restrict excessive agency in agentic AI workflows

  • Restrict each agent to the exact tools and scopes its task requires, nothing broader.
  • Require human approval before any high-impact or irreversible action, such as file deletion, external messages, financial transactions, or configuration changes.
  • Define explicit permission boundaries in the agent framework.
  • Test each agent against indirect prompt injection that attempts to push it into unauthorized actions.
  • Log every agent action at the tool-call level to maintain an auditable record of what the agent actually did.
 

Prevent system prompt leakage

  • Do not embed secrets, API keys, or credentials in system prompts. Reference them through environment variables or a secrets manager instead.
  • Segment system instructions from user input in the model's input structure, so user content cannot easily reference or override system-level instructions.
  • Test for prompt leakage before deployment by instructing the model to repeat or summarize its instructions, and verify it refuses.
  • After deployment, scan each model reply for phrases from the system prompt and flag them as a possible leak.
 

Guard against prompt injection

  • Distinguish between direct and indirect prompt injection:
    • An attacker attempting to change the AI's behavior by giving malicious prompts is a direct injection.
    • An attacker hiding malicious instructions inside documents, emails, webpages, or any external content the AI model processes is an indirect injection.
  • Validate and sanitize all inputs before incorporating them into the model.
  • Reject or neutralize patterns that attempt to override system instructions.
  • Filter and isolate external content before it reaches the model, especially in retrieval-augmented generation (RAG) pipelines.
  • Test your applications against prompt injection techniques, such as scenarios covered in OWASP LLM01:2025.
 

Address supply chain risks in third-party AI components

  • Vet third-party model providers and AI vendors before onboarding. Check:
    • Data handling: Confirm where prompt and output data is stored, how long it is retained, and whether it is used for training.
    • Training data provenance: Require documentation of what data the model was trained on and its licensing status.
    • Security certifications: Verify current SOC 2, ISO 27001, or equivalent audit reports.
    • Vulnerability disclosure: Check for a published disclosure policy and a track record of patching reported issues.
  • Maintain an AI bill of materials that tracks every model, dataset, library, and plug-in in the stack, with version and known-vulnerability status for each.
  • Patch AI dependencies on the same discipline as traditional software, since outdated model versions and libraries are as exploitable as unpatched application code.

Monitor GenAI usage in your organization with DataSecurity Plus

ManageEngine DataSecurity Plus can monitor and restrict organizational GenAI usage through its Cloud Protection module. It gives security teams direct visibility into the two most operationally significant GenAI risks: the sensitive data employees feed into AI platforms and the unauthorized AI tools they use. With DataSecurity Plus, you can track GenAI usage, block unvetted shadow AI applications, and inspect GenAI prompts. Learn more about DataSecurity Plus' GenAI prompt auditing and shadow AI discovery capabilities.

  • Monitor GenAI usage in your organization with DataSecurity Plus
  • Monitor GenAI usage in your organization with DataSecurity Plus
  • Monitor GenAI usage in your organization with DataSecurity Plus

Frequently asked questions

Traditional security tools work on syntax, the form of the input. They catch things by their structure, such as a malformed file, a known malware signature, or a traffic pattern that looks abnormal. That works because conventional attacks look different from normal activity.

GenAI attacks arrive as ordinary, well-formed language, passing every structural check without tripping a rule. A prompt injection payload reads like a normal sentence. A jailbreak reads like a reasonable request. The model cannot distinguish between a trusted system instruction and a user-supplied override if both are embedded in the same token stream. The danger isn't in how the text is built, it's in what the text means, and meaning is exactly what syntax-based tools don't read.

Protecting GenAI takes controls that work at the level of meaning instead: content classifiers that judge intent, behavioral monitoring, output validation, and adversarial red-teaming, none of which come with a traditional application security stack.

Prompt injection hijacks the model's behavior within a session by embedding adversarial instructions that the model treats as authoritative. The attack can be direct (crafted user input) or indirect (malicious instructions hidden in external content the model retrieves and processes). The goal is typically to exfiltrate data, trigger unauthorized actions, or override application logic.

Jailbreaking is a specific form of prompt injection that targets the model's built-in safety guardrails—the restrictions its developers trained it to follow. A successful jailbreak makes the model disregard those restrictions entirely, enabling it to produce prohibited content or take actions outside its intended scope. The distinction matters for defense: Prompt injection defenses focus on input validation and trust boundaries; jailbreak defenses require adversarial training, model-level updates, and ongoing red-teaming against new bypass techniques.

The categories that carry the most compliance and competitive risk, such as customer PII, source code, login credentials, internal financial data, and confidential business plans, should never be entered into a GenAI tool. These are the off-limits categories that appear most often in leaked prompts. A clear acceptable use policy should name them explicitly, and prompt monitoring should enforce the list rather than relying on employees to remember it.

A standard GenAI chat interface generates text. An agentic AI system generates text and acts on it—calling APIs, executing code, sending emails, modifying files, querying databases, or browsing the web. This creates a qualitatively different risk profile:

  • The blast radius of a successful prompt injection is no longer a harmful output. It is an unauthorized system action.
  • Agents operating across multiple steps can compound errors or be manipulated to perform a sequence of individually low-risk actions that together constitute a serious breach.
  • Indirect prompt injection becomes significantly more dangerous: Malicious instructions embedded in a document or web page the agent retrieves can cause it to exfiltrate data to attacker-controlled endpoints, delete records, or escalate permissions.
  • Many agentic frameworks grant broad tool access by default, making excessive agency the rule rather than the exception unless explicitly constrained.

Standard incident response playbooks do not address the failure modes specific to GenAI systems. A GenAI incident response plan should cover:

  • Prompt injection and jailbreak events: How to identify that the model has been manipulated, what data or actions were affected, and how to isolate the affected session or application.
  • Model or training data compromise: Procedures for assessing whether a fine-tuned model or RAG knowledge base has been poisoned, and the criteria for rolling back to a known-clean model version.
  • Data exposure via prompts: How to determine what sensitive content was submitted to which platform, whether that platform's data handling policies cover the exposure, and what notification obligations apply.
  • Shadow GenAI incidents: How to respond when an unauthorized AI tool is found to have processed regulated data, including vendor communication and regulatory disclosure.
  • Agentic AI failures: A containment procedure for autonomous agents that have taken unauthorized or unexpected actions, including how to revoke agent credentials and reverse affected system changes where possible.

Get DataSecurity Plus easily
installed, configured and running within minutes.

Download Now  
Email Download Link