By NHI Mgmt Group Editorial TeamDomain: AI SecuritySource: Flatt SecurityPublished October 29, 2025

TL;DR: Prompt injection, system prompt leakage, unbounded consumption, poisoning, excessive agency, vector weaknesses, and insecure framework configuration remain the core failure modes in GenAI development, according to Flatt Security’s analysis of OWASP Top 10 for LLM Applications 2025. The practical takeaway is that LLM security is a control-design problem, not a model-quality problem, and the identity boundary matters whenever prompts, tools, credentials, or RAG contexts are involved.


At a glance

What this is: This is an analysis of the main security risks in LLM applications, with OWASP Top 10 for LLM Applications 2025 used to frame how GenAI systems fail in practice.

Why it matters: It matters because LLM apps often sit on top of real credentials, tools, and data paths, so IAM, secrets, and privilege controls become part of the model security boundary.

👉 Read Flatt Security's analysis of LLM app security risks for GenAI development


Context

LLM application risk is fundamentally a governance problem because the model is rarely the only component making security decisions. Once prompts, retrieval, tools, and framework functions are connected, the attack surface includes credentials, data context, and action permissions as well as the model output itself. That makes GenAI security a cross-discipline issue for IAM, secrets governance, application security, and AI governance.

For identity teams, the key question is not whether an LLM can answer correctly but whether it can be trusted not to misuse access, expose secrets, or act outside its intended scope. OWASP’s LLM guidance and NHIMG’s NHI research both point to the same operational reality: once AI systems can read, write, or call tools, their identities and permissions need explicit control.

Technical breakdown below uses the article’s risk categories to show where control failures happen, and where the identity boundary becomes part of the security design.


Key questions

Q: How should security teams handle prompt injection in production LLM applications?

A: Security teams should treat prompt injection as a runtime control issue, not a content-moderation problem. The practical response is to inspect prompts, retrieved content, and tool outputs for hostile instructions, then block or downgrade unsafe sessions before the model can act on them. The model should never be the only enforcement layer.

Q: When does an LLM become a privilege problem rather than a chatbot?

A: An LLM becomes a privilege problem the moment it can read, write, call APIs, or act on behalf of users. At that point, its permissions define the blast radius. If the workflow has broader access than the task requires, attackers can turn model interaction into unauthorised action.

Q: What do teams get wrong about system prompt leakage?

A: Teams often assume hidden prompts are protected because users cannot see them directly, but any text the application exposes to the model can potentially be recovered through crafted interactions. That means prompt secrecy is not a reliable security control. Sensitive information belongs outside the model context whenever disclosure would be unacceptable.

Q: How can organisations tell if an LLM framework is configured too permissively?

A: Look for broad file-system access, unsafe template evaluation, write permissions that are not required, and helper functions that can execute beyond the intended workflow. If the framework can touch data or systems the task does not need, the configuration is too broad and should be reduced.


Technical breakdown

Prompt injection and indirect instruction abuse

Prompt injection occurs when attacker-controlled text changes an LLM’s behaviour in ways the application did not intend. Direct injection places malicious instructions in the user prompt, while indirect injection hides them in retrieved web pages, files, or other content the model ingests. The issue is not that the model is “tricked” in a human sense, but that the application fails to separate untrusted input from executable instruction. In tool-linked or RAG-based systems, that failure can cascade into data exposure or unintended tool use.

Practical implication: treat all external text as hostile input and constrain what the model can do with it.

System prompt leakage and secret exposure

System prompts are configuration instructions, not a safe place to store secrets. If API keys, tokens, internal rules, or access logic are embedded there, a successful prompt-leak attempt can expose information that should never have been present in the first place. The deeper failure is architectural: the application is using the model prompt as a security control boundary. That is brittle because prompt content is visible to the model and may be surfaced through crafted requests or chained interactions.

Practical implication: remove credentials and security logic from prompts and enforce those controls outside the LLM path.

Excessive agency and insecure framework usage

Excessive agency happens when an LLM is granted permissions that exceed the minimum needed for its task. In practice, this often appears in tool use, file systems, cloud storage, or other integrations where write or delete rights are unnecessary but granted anyway. The article also shows that framework misconfiguration can turn a benign-looking helper into a dangerous execution path. The risk is not just model misbehaviour, but delegated capability without tight bounds, logging, or approval controls.

Practical implication: limit tool permissions to read-only or task-scoped access and review framework defaults before deployment.


Threat narrative

Attacker objective: The attacker wants to manipulate the LLM application into revealing protected information or performing unauthorised actions through trusted integrations.

  1. Entry begins when an attacker supplies a crafted prompt or malicious external content that enters the LLM application through chat, retrieval, or template inputs.
  2. Escalation occurs when the model has access to tools, files, or privileged context and is induced to reveal secrets, overwrite data, or execute unintended functions.
  3. Impact follows when the application leaks confidential information, consumes excessive resources, or performs actions outside approved business logic.

NHI Mgmt Group analysis

LLM application security is really identity and authority design in disguise. Once a model can act through tools, storage, or APIs, the real question becomes who or what is authorised to perform those actions. That means GenAI security cannot be separated from IAM, secrets management, and privilege scoping. The practitioner implication is clear: model risk reviews must include identity, not just prompt safety.

Prompt injection exposes a control boundary failure, not a model intelligence failure. The article demonstrates that malicious instructions can arrive through prompts, retrieved content, or templates, and the model may obey them if the application has not isolated trust domains. That is a structural weakness in application design. The practitioner implication is to harden input, output, and tool boundaries rather than chasing perfect content filtering.

Excessive agency is the GenAI version of standing privilege. When LLMs receive broader permissions than their task requires, they inherit a blast radius that attackers can exploit through malformed prompts or poisoned context. This is where the identity angle becomes decisive: permissions, not just prompts, define the damage path. The practitioner implication is to bind each model workflow to the smallest practical set of capabilities.

System prompt leakage is a reminder that prompts are not a secrets vault. The article’s examples show why security controls placed inside the prompt are easy to expose and hard to trust. That makes prompt-based enforcement unsuitable for real protection. The practitioner implication is to move policy enforcement to application logic, access layers, and infrastructure controls.

Template and function misuse widen the attack surface beyond the model itself. Once framework defaults allow unsafe template evaluation or broad file-system access, the application becomes a general-purpose execution environment with LLM semantics layered on top. That is where secure-by-default assumptions fail. The practitioner implication is to review framework configuration as part of threat modelling, not after integration is complete.

What this signals

GenAI security programmes will increasingly be judged by how well they control delegated authority, not by how well they classify prompts. The operational question is whether tool access, file access, and API access are actually bounded at runtime. That pushes LLM governance into the same design territory as NHI and PAM, where least privilege, logging, and revocation determine the size of the incident.

Identity controls around AI systems will matter more as organisations wire LLMs into business workflows. The moment a model can interact with storage, ticketing, or cloud services, the underlying access model becomes part of the AI risk model. Teams should map those access paths now, before the workflow becomes business-critical and harder to unwind.

Prompt safety and credential safety will converge in practice. That is where NHIMG’s research on machine identity, including the Ultimate Guide to NHIs and the 52 NHI breaches Report, becomes directly useful for AI governance teams.


For practitioners

  • Constrain tool permissions to task scope Give each LLM workflow only the permissions needed for the specific action it must perform. Read-only access is usually safer than write access, especially for storage, documents, and external services. Review the effective permission set, not just the intended design.
  • Separate prompts from security controls Do not store API keys, tokens, or authorization rules in system prompts. Enforce authentication, authorization, and policy decisions in application code or adjacent control layers where the model cannot read or rewrite them.
  • Treat retrieved content as untrusted Apply validation and filtering to documents, web pages, files, and other data that may enter RAG or tool-linked workflows. Use allowlists, structure checks, and output constraints so hostile content cannot become instruction content.
  • Review framework defaults before deployment Check template engines, file-system helpers, and other framework functions for unsafe defaults such as broad directory access or executable template syntax. Align configuration with the narrowest workable operating scope.

Key takeaways

  • LLM application risk is driven by trust boundaries, delegated permissions, and framework configuration, not just by model output quality.
  • Prompt injection, prompt leakage, and excessive agency all become more dangerous when the application can call tools or access sensitive data.
  • GenAI governance should bring IAM, secrets management, and runtime controls into the same review process as prompt and model security.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10 and MITRE ATT&CK address the attack surface, NIST AI RMF, NIST CSF 2.0 and NIST SP 800-53 Rev 5 set the technical controls, and ISO/IEC 42001:2023 define the regulatory obligations.

FrameworkControl / ReferenceRelevance
OWASP Agentic AI Top 10Prompt Injection and Tool MisuseThe article centres on prompt injection, excessive agency, and agent-tool boundaries in LLM apps.
Recommendation — Apply agentic AI controls to restrict tool use, separate trust domains, and limit model authority to task scope.
NIST AI RMFGOVERN — AI Governance and AccountabilityThe article ties LLM risk to governance, permissions, and control ownership.
Recommendation — Assign governance owners for LLM workflows and require documented accountability for model-linked actions.
NIST CSF 2.0PR.AC-4 — Access Permissions and AuthorisationsOverbroad tool and data access is a central failure mode in the article.
Recommendation — Map LLM integrations to PR.AC-4 and reduce permissions to the minimum required for each workflow.
NIST SP 800-53 Rev 5AC-6 — Least PrivilegeLeast privilege directly addresses excessive agency and overbroad framework permissions.
Recommendation — Enforce least privilege for every model-linked service account, API token, and external tool connection.
MITRE ATT&CKTA0006;TA0010 — Credential Access; ExfiltrationPrompt leakage and injected instructions can expose secrets and sensitive data.
Recommendation — Map LLM misuse paths to credential access and exfiltration tactics and monitor for leakage indicators.

Key terms

  • Prompt Injection (Agentic): An attack where malicious instructions are embedded in content that an AI agent reads — causing the agent to execute unintended actions using its own legitimate credentials. A primary vector for agent goal hijacking and identity abuse.
  • System Prompt Leakage: System prompt leakage is the exposure of hidden prompt content to users or attackers. The real security problem is usually not the prompt itself, but the secrets, policy logic, and internal architecture details placed inside it. If those details are sensitive, they should live in code or secrets management instead.
  • Excessive agency: A condition where an AI system is given more operational authority than its task requires. The risk is not just poor output. It is that mistakes, manipulation, or compromise can produce destructive actions at machine speed across the systems the agent can reach.
  • Unbounded Consumption: Unbounded consumption is the failure to cap how much compute, token volume, or downstream cost an AI request can consume. In LLM environments, it turns legitimate use into a financial and availability attack surface when input size, retries, and model complexity are left unchecked.

What's in the full article

Flatt Security's full article covers the implementation detail this post intentionally leaves at the analysis level:

  • Worked examples showing how direct and indirect prompt injection alter LLM behaviour in real application flows
  • Code-level demonstrations of system prompt leakage, including how sensitive values can be exposed through crafted prompts
  • Framework-specific configuration issues such as unsafe template handling and overly broad file-system access
  • Practical mitigation notes tied to OWASP Top 10 for LLM Applications 2025 categories

👉 Flatt Security's full article shows the example code, attack behaviours, and mitigation details behind each LLM risk category.

Deepen your knowledge

The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, secrets management, and identity lifecycle control. It is designed for practitioners who need to govern AI-connected systems without losing sight of access, privilege, and accountability.
NHIMG Editorial Note
Published by the NHIMG editorial team on September 14, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org