Skip to Content
Applied SciencesApplied Sciences
  • Article
  • Open Access

21 December 2025

24 Pages

LLM Firewall Using Validator Agent for Prevention Against Prompt Injection Attacks

,
,
,
and
1
Institute of Computer Science, University of Opole, Oleska 48, 45-052 Opole, Poland
2
Faculty of Computer Science, Opole University of Technology, Proszkowska 76, 45-758 Opole, Poland
3
Opolskie Centrum Zarzadzania Projektami, Technologiczna 2, 45-839 Opole, Poland
4
Institute of Computer Science, Maria Curie-Sklodowska University, Akademicka 9, 20-033 Lublin, Poland

Abstract

Large Language Models with Retrieval-Augmented Generation are considered to be modern, chat-native interfaces to enterprise knowledge. However, deploying such systems safely requires precautions more advanced than input filtering. Numerous LLM-related security threats (including the top one: prompt injection attacks) demand robust defense mechanisms beyond input filtering. This paper extends our dual-agent RAG architecture as an LLM firewall with output-level security validation. Similar to network firewalls, which monitor semantic boundaries, we position the Validator Agent as a response firewall performing multi-feature security checks: prompt injection detection, policy compliance verification, sensitive information redaction, and toxic content filtering. While existing defense approaches focus mainly on input-level screening, our architecture proposes to analyze the output, where a successful attack becomes more obvious. The proposed architecture was verified to be viable using the Polish Bielik 2.3 LLM in an on-premise RAG system designed for energy auditing.

1. Introduction

Large Language Models LLMs have become a common part of modern Natural Language Processing NLP applications, becoming the invisible fabric of the ubiquitous conversational agents across multitude of application domains: healthcare, finance, legal services, entertainment, and many more. The integration of Retrieval-Augmented Generation RAG [1,2] has further expanded the usability of LLMs by enabling the use of additional external knowledge for formulating responses, thereby mitigating hallucinations and offering the possibility to conduct a case-specific dialogue without fine-tuning a model. Unfortunately, as LLM-based systems transition from research prototypes to production deployments, they open a new wide range of possibilities for exploitation and other malicious activities, some of which were not possible “before LLMs”. They introduce novel security vulnerabilities [3,4,5] that traditional cybersecurity frameworks are not prepared to address.
One of the most critical threats facing LLM applications is Prompt Injection, which has been identified by the OWASP (OWASP Top 10 for LLM Applications 2025 [6]) as the number one risk [5,7]. Prompt Injection attack occurs when an adversary deliberately prepares malicious inputs (usually prompt) to manipulate an LLM’s behavior [8,9], bypassing safety mechanisms and guardlines, causing the system to execute unintended actions. These attacks can lead to unauthorized data exfiltrations, policy violations, compromise of system integrity [1,3], or even a leakage of information stored in locations available for the agent. The severity of this threat is partially a consequence of its accessibility: traditional exploits required basic (or advanced) technical expertise, while Prompt Injection can be performed by anyone capable of using natural language [10], and without any tools other than internet browser.
To counteract to this emerging threat, several approaches have been proposed. Some of them discuss analysis of the prompt for malicious intentions, some of them search for patterns, or perform sanitization. In our paper we have decided to review only a part of the broader landscape of possible solutions: the concept of “LLM firewall”, which seems to get traction in the industry (but also in academic research—[1,4,11,12,13,14]). Inspired by computer network firewalls (analysing and controlling packets based on security policies), LLM firewalls operate at the semantic level, analyzing natural language queries (sent to the model) and model outputs presented to the user to detect possible malicious activities, report them, and mitigate if possible [1,12,15]. Recent work has introduced various firewall architectures, including ControlNET for RAG-based systems [1,15], which makes good use of the activation shift phenomena to detect malicious adversarial queries, and systems like Cloudflare’s Firewall for AI [16] for input and output filtering [11,12,17].
Current LLM firewall implementations mostly focus on input-level defense as the main (or the only one) strategy [11,12,14,17], attempting to identify and block malicious prompts before they are sent to the model (see Figure 1). Input filtering seems to be a reasonable approach, limiting the usage of computational power for handling malicious prompts, and it can surely be treated as a first line of defense, but it addresses only a part of the security challenge. Malicious instructions can be embedded in retrieved documents (indirect prompt injection) [1,12,18], or attacks may be sophisticated enough to trigger inappropriate output after the model processes seemingly “harmful” (benign) input [8]. Attackers capable of preparing prompts able to evade input-based detection may be still achieving their objectives in the generated output [19,20] without triggering any alarms in input-based security analysis modules. For this reason, we have focused our efforts on the research on security architectures capable of more than just input validation, or typical guardrails [21,22,23].
Figure 1. Input-level prompt validation is not enough for some models, as there are numerous creative attacks to overcome prompt validation.
As illustrated in Figure 1, purely input-level prompt validation can often be bypassed by creative or indirect attacks. Even when the initial user query appears benign, adversaries may hide harmful instructions in retrieved documents, exploit formatting tricks, or rely on multi-step interaction patterns that are difficult to capture with static input filters alone. This observation motivates our focus on complementing input-side protections with an additional validation layer that operates on the model’s outputs.
In our previous work [2], we introduced a dual-agent architecture for on-premise RAG-based conversational systems, specifically applied to the Energy Performance of Buildings Directive domain. The architecture employed two distinct LLM agents: a Generator Agent responsible for retrieving relevant knowledge and formulating responses, and a Validator Agent, system-prompted to ensure that the outputs stay relevant to the topic, and conform to required JSON specifications and the company policies, before presenting the system’s output to the user. This separation of concerns is able to improve response reliability and enable flexible deployment across various hardware configurations without requiring model retraining [2]. However, that work focused primarily on format compliance and did not explicitly address the security implications of the Validator Agent role. In other words, the Validator Agent in [2] acted mainly as a JSON and business-rule validator to improve reliability and integration with downstream systems. In this paper, we extend this mechanism into a security-focused LLM firewall: the Validator Agent is redesigned as an output-level security component that performs multi-dimensional checks (prompt injection detection, sensitive information redaction, toxic content filtering, and policy compliance), and is embedded within an explicit threat model and three-layer defense architecture (input, retrieval, output).
This work, on the other hand, is focused solely on the security aspect of LLM-based systems/modules, especially in applications that are available to external users, but should not reveal internal instructions, data, or guidelines.
The dual-agent use has emerged independently in research as the simplest use of multiagent system. The literature also mentiones “Dual LLM Pattern”, in the research area of LLM security, as an architecture intended to defend against Prompt Injection attacks [21,24,25,26]. This pattern introduces a separation of privileges by employing a Privileged LLM with access to tools and sensitive operations, and a Quarantined LLM that processes untrusted content only in its own sandbox [21,24]. The main idea is that unfiltered outputs from the quarantined component should not reach privileged systems [21,26]. This architectural uni-directional sandbox-based approach aligns somewhat with our Validator Agent conception [2], which intercepts and examines LLM at the output, effectively becoming a trust boundary.
Recent research has further progressed the development of LLM security architectures. The concept of “agentic firewalls” has been proposed to secure dynamic multi-agent LLM systems [4], introducing data firewalls able to abstract (temporarily replace/encode) sensitive information, trajectory firewalls able to validate action sequences, or input firewalls able to convert natural language to structured protocols. Similarly, frameworks like GenTel-Shield demonstrate state-of-the-art performance in detecting Prompt Injection attacks by being trained on comprehensive attack taxonomies [8]. These advances suggest (or prove) that effective LLM security requires multi-layered defense, and should operate on all stages: input, retrieval, and output [1,4,12,15].
Despite the progress of detection methods, output validation (as a security mechanism in RAG-based systems) is not significantly visible in research literature. Most existing firewall solutions either focus exclusively on input filtering [11,12,17] or require significant computational overhead because of multiple model calls [4,21]. There is limited research on lightweight, production-grade architectures that would use output validation at a core of the firewall architecture, in order to be capable of detecting and mitigating attacks, which managed to bypass input defenses.
This paper reframes and extends our dual-agent RAG architecture introduced in [2], by introducing the security context into the architecture as an LLM firewall system with comprehensive attack defense capabilities. Our previous research used the 2nd agent mainly as a JSON format checker and for policy enforcement. In this paper we present the Validator Agent as LLM firewall intended to perform multi-dimensional security validation (including Prompt Injection detection, sensitive information redaction, and toxic content filtering). By operating at the output level (see Figure 2), such an approach provides an important complementary defense mechanism capable of identifying attacks (and anomalies) missed by input-level methods and detect other adversarial behaviors, which may be visible only in outputs.
Figure 2. The proposed output-level validation, used either as the primary validation policy or as an additional “last-resort” failsafe, adds a much-needed layer of protection.
Figure 2 provides a high-level view of the proposed output-level validation stage integrated into the dual-agent RAG architecture. The Validator Agent inspects the responses generated by the Generator Agent before they are returned to the user, enforcing security and compliance policies and acting as a ’last-resort’ failsafe if earlier safeguards are bypassed. In particular, it is responsible for detecting prompt-injection patterns, identifying potential sensitive-information leakage, and filtering toxic or policy-violating content at the moment when such issues become visible in the model’s outputs.
Problem formulation. In this paper, we address the problem of designing a lightweight, production-grade LLM firewall architecture for on-premise, Retrieval-Augmented Generation (RAG)-based conversational systems. The goal is to provide effective defense against prompt injection, information leakage, and policy-violating outputs, while preserving the practicality of deployment in regulated environments. We focus on architectures in which an output-level Validator Agent enforces security and compliance policies on generated responses, complementing existing input-level defenses and operating under a clearly defined threat model.
The contributions of this paper are as follows:
  • A comprehensive threat- and attack-taxonomy, listed particularly for RAG-based conversational agents, categorizing vulnerabilities into input-level, retrieval-level, and output-level attacks [1,5,9,15], with additional attention to information leakage and policy violations—Section 2.
  • The methodology behind our conception of LLM firewall (dual-agent architecture first outlined in [2], enhanced by the security Validator Agent—Section 3.
  • Practical guidance for deploying secure on-premise LLM-based agents in regulated environments, discussing the trade-offs between security overhead and response latency [2,21], and identifying scenarios where dual-agent firewall architectures offer optimal protection.
The paper’s structure is as follows: Section 2 reviews related work on LLM security threats, firewall concepts, guard models, and multi-agent architectures. Section 3 presents our methodology, including the threat model, extended Dual-agent Firewall architecture, and implementation details. The last section discusses the advantages, limitations, and future research directions for Dual-agent Firewall approaches in securing LLM-based conversational systems.

3. Methodology

The dual-agent architecture, presented within this paper, is the practical presentation of the applicability of the proposed LLM FW architecture. Its minimalistic, yet output-level-based approach, is based on separating two distinct tasks between agents. The proposed approach is similar in a way to the use of the Evaluator agent (as presented in Section 2.2.4), but its role is much richer, including detection, analysis, reporting, and other roles.
Individual agents of the proposed dual-agent LLM FW may be built using the same model or different ones, depending on specific deployment. In previous research, the authors chose to use the same model (Bielik 2.3) for both agents, using different system prompts for each of them to fulfill their respective roles.

3.1. Input Firewalls vs. Output Firewalls

In the context of large language models (LLMs), an input firewall refers to a mechanism that checks whether a user’s prompt complies with predefined security rules. An output firewall is used to verify whether the response generated by the LLM meets predefined safety/policy requirements.

3.2. Dual-Agent Architecture for RAG

One of the agents is responsible for generating the user’s response, also utilizing information from a knowledge base. This agent retrieves several of the most relevant facts based on the user’s prompt. Using these facts, the model then generates the final answer.

3.3. Validator Agent for JSON Compliance

The response generated by the first agent must be verified to ensure that it contains a valid JSON structure. In the initial tests, the first agent often failed to produce a stable JSON output that could be reliably used by other systems. The model occasionally generated additional explanatory text alongside the JSON, or the JSON itself was syntactically incorrect, e.g., missing commas or quotation marks. An additional responsibility of this agent was to check whether the generated response contained any toxic or harmful content [81] that could potentially pose risks to humans or the organization.
This idea was implemented in the original, primarily format-oriented role of the second agent, as introduced in our previous work [2].

3.4. Threat Model and System Assumptions

This work addresses the problem of securing on-premise, Retrieval-Augmented Generation (RAG)-based conversational systems deployed in applications involving the need for data protection. The threat model considers both direct and indirect prompt injection attacks, as well as attacks that show only in LLM outputs (i.e., after bypassing input-level defenses). Specific attack scenarios, relevant to conversational LLM agents, include adversaries attempting to extract sensitive information from retrieved documents, bypassing safety guidelines, poisoning knowledge base entries, manipulating the system into generating policy-violating outputs, or exfiltration of internal data through “LLM-social engineering” within the conversational context.
We assume that the LLM itself, as a model, remains intact (it is not manipulated in any way), but is (may be) vulnerable to manipulation through prompts, data, or other exploits), and that the underlying hardware infrastructure is trusted and physically secured. The architecture is designed for isolated network deployments where the knowledge base and model weights do not leave the organization’s premises, reflecting the typical applicability constraints of on-premise deployments in institutions. Trust boundaries are established at three critical junctures: between user input and the system, between the Generator Agent and the Validator Agent, and between the Validator Agent and the end user. The Generator Agent operates in an untrusted context where outputs are assumed potentially compromised until validated, while the Validator Agent occupies a privileged security position where its validation decisions are treated as authoritative.
To make this threat model more concrete, we briefly illustrate three representative attack scenarios. In a prompt injection attack, an adversary may succeed in influencing the Generator Agent so that it produces content that the system should never return to the user, even if the original user query looks relatively benign. For instance, a poisoned document in the knowledge base might contain hidden instructions that cause the Generator to output a step-by-step description of how to perform an illegal or dangerous activity (e.g., “how to construct an explosive device” under an innocuous label such as “B.O.O.M. device”). The Validator Agent does not rely on the literal presence of prompt-override phrases, but instead analyses the semantic content of the generated answer and is designed to recognize that detailed instructions for such activities fall outside the allowed policy and must be blocked or replaced with a safe refusal.
In a knowledge-base poisoning scenario, an attacker might insert manipulated guidance into the RAG knowledge base, for example by recommending practices that deliberately violate safety or legal requirements while being presented as “expert advice”. The Generator Agent may faithfully reproduce this guidance in its answer. The Validator’s output-level checks are intended to detect that the suggested actions conflict with encoded domain policies (e.g., building safety regulations or internal compliance rules) and to either reject the answer or modify it so that only compliant recommendations remain.
Finally, in a guideline-bypassing attack, a user can explicitly ask for advice that contradicts operational constraints (for instance, ways to disable mandatory safety mechanisms or to circumvent metering and billing rules). Even if the Generator produces a technically correct description, the Validator is configured to identify that the requested outcome is not permitted under the organization’s policies and to return a warning or refusal instead of forwarding the original answer.

3.5. Reframing the Dual-Agent Architecture as an LLM Firewall

In the remainder of this section, we extend this initially format-focused design into a security-oriented LLM firewall and clarify how the Validator Agent’s responsibilities are broadened from JSON checking to comprehensive output-level security validation.
Our previous work introduced a dual-agent architecture for on-premise RAG-based conversational systems, originally motivated by the practical engineering challenge: ensuring consistent output formatting across diverse hardware configurations and improving system reliability in production environments. In that setting, the first agent (responsible for RAG-based response generation) frequently failed to produce reliable JSON-compliant output. The model occasionally added explanatory text alongside the JSON or produced syntactically incorrect structures (e.g., missing commas or quotation marks). To address this, a second agent was introduced, solely to validate and correct the JSON structure before transmitting it to API endpoints.
However, this architectural separation revealed a deeper security potential. In this work, we reframe and extend the dual-agent architecture as a comprehensive LLM firewall, drawing conceptual parallels to traditional network security. Just as classical network firewalls monitor traffic at system boundaries according to predefined security policies, an LLM firewall operates at the semantic boundary between model generation and output.
The dual-agent firewall (Figure 3) positions two agents operating with distinct roles: the Generator Agent and the Validator Agent. Both agents are instantiated from the same base model, the Polish Bielik 2.3 LLM, but operate with distinct system prompts that define their respective operational contexts and constraints. This approach of using a single model for both agents offers significant practical advantages over architectures requiring multiple distinct models. It reduces memory footprint, inference latency, and computational requirements (critical considerations for on-premise deployments with constrained resources). Simultaneously, it maintains the separation of privileges necessary for effective defense, as the different system prompts ensure the agents operate within distinct security contexts and enforce distinct constraints. The architectural separation is enforced not through model differences but through prompt-based role specification and output validation, making the system implementable on a broad range of hardware platforms.
Figure 3. Informative diagram of the proposed Dual-agent LLM Firewall. The agent marked with green colour may become an object of an attack, but the agent marked with red makes sure the final answer does not go beyond predefined policies.

3.6. Generator Agent: RAG-Based Response Generation

The Generator Agent implements a standard Retrieval-Augmented Generation pipeline as established in our prior work. The RAG approach enables the system to incorporate domain-specific knowledge from external sources by using dense vector embeddings of text. Domain-specific knowledge documents are preprocessed into semantically coherent chunks and encoded as dense vector embeddings using the Ollama embeddings function, which captures semantic content through continuous vector representations. These preprocessing steps are performed once during knowledge base initialization, enabling efficient runtime retrieval.
At inference time, upon receiving a user query, the Generator Agent first embeds the query into the same vector space as the knowledge base. The system then identifies the most relevant knowledge chunks through similarity scoring, typically using dot product operations from optimized linear algebra libraries such as NumPy [82]. The top-k most similar chunks (in our implementation, k = 5) are retrieved and incorporated into the system prompt provided to the Generator Agent. Using this retrieved context as grounding, the Generator Agent formulates responses intended to directly address the user’s query while incorporating information from the knowledge base.
The system prompt provided to the Generator Agent is intentionally designed to encourage helpful, informative responses while maintaining awareness of its role within the broader system architecture. Critically, this system prompt does not implement security constraints or attempt to defend against adversarial manipulation. This design decision is deliberate and operationally important: the Generator Agent’s role is to leverage the full capabilities of the model to produce the most useful responses possible, given that all output will be subject to security validation downstream. Attempting to implement security constraints at the generation stage can lead to defensive behaviors that reduce helpfulness and utility for legitimate users, while simultaneously proving ineffective against sophisticated attacks.
The RAG approach replaces traditional NLP-based content matching with mathematically efficient dot product operations, significantly reducing retrieval latency while improving contextual relevance. The similarity search operates on precomputed embeddings stored in JSON format, enabling fast, low-latency retrieval during each user interaction. This efficiency is essential for on-premise deployments where response latency directly impacts user experience and system utility. The runtime process proceeds as follows: the user submits a query; the query is embedded into the vector space; the system identifies the most similar knowledge chunks via similarity scoring; the top chunks are retrieved and incorporated into the system prompt; the Generator Agent receives this augmented prompt and generates a response based on the context; and the generated response is passed to the Validator Agent for security assessment before being returned to the user.

3.7. Validator Agent: Output Firewall with Multi-Dimensional Security Checks

The Validator Agent represents the core security contribution of this work. Operating as an output firewall, it receives as input the original user query, the candidate response generated by the Generator Agent, the retrieved context used during generation, and the current system context including user role, session state, and applicable operational policies. The Validator Agent’s task is to evaluate whether the generated response is safe for transmission to the user, applying multiple independent validation criteria that collectively form a comprehensive security assessment. What’s important is that, unlike the Generator Agent which is designed to optimize for utility, the Validator Agent is explicitly designed and prompted to prioritize security and policy compliance, even when doing so may limit response utility.
In our implementation, the Validator Agent is realized as a fixed pipeline that combines structural, rule-based, and semantic checks. First, the candidate response is validated against a predefined JSON schema in order to detect malformed or incomplete outputs that would cause downstream failures. Next, a set of rule-based policy checks is applied to the user query, the retrieved context, and the candidate response, capturing organization- and domain-specific constraints such as disallowed entities, phrases, or categories of information. Finally, the Validator performs LLM-based semantic analysis under a security-focused system prompt, analyzing the candidate response (and, when needed, the query and context) for signs of prompt injection, attempts to override safety policies, potential data leakage, and toxic or otherwise policy-violating content.
Based on the combined outcome of these stages, the Validator Agent produces one of three decisions: allow (the response is forwarded unchanged), modify (the response is redacted or rephrased to remove problematic elements), or block (the response is replaced with a safe fallback message that explains why the original answer cannot be provided). The following subsections describe the main security validation dimensions in more detail.
The Validator Agent operates through multiple security validation dimensions, each addressing distinct classes of attacks.

3.7.1. Prompt Injection Detection

The Validator Agent analyzes the generated response for indicators of successful prompt injection attacks. This includes detecting anomalous instruction-following patterns that suggest the LLM may have adopted injected instructions rather than adhering to its original system prompt. The validation logic examines whether the response contains unexpected changes in tone, role-playing behaviors, or evidence of the model discussing internal instructions or system prompts. The validator checks for textual markers commonly associated with injection attempts, such as phrases indicating role assumption (“I am now”, “pretend I am”) or explicit instruction overrides (“ignore your guidelines”, “from now on”). Additionally, the validator assesses whether the response contains outputs that directly violate known security boundaries (e.g., claiming to perform system administration tasks, access external systems, or override its operational constraints).
While sophisticated attackers may craft responses that evade simple pattern-based checks, the multi-dimensional validation approach helps in ensuring that attack evidence manifesting in other dimensions can still be captured. For instance, an injected instruction that successfully manipulates the model into adopting a different role may simultaneously trigger the sensitive information detection layer if that new role involves accessing restricted data, or the policy compliance layer if the new role involves prohibited actions.

3.7.2. Sensitive Information Filtering

One of the most critical functions of the Validator Agent is preventing unintended leakage of sensitive information, addressing a category of attacks that represent persistent threats to LLM-based systems. The system implements multiple channels for detecting such leakage. First, regular expression-based pattern matching identifies common sensitive data structures including PII, such as email addresses, phone numbers, national identification numbers, and financial information such as account numbers and credit card patterns. Additionally, the system maintains databases of internal identifiers, employee names, proprietary system architectures, and other organizational information that should remain confidential.
Second, semantic analysis evaluates whether the response discusses topics that should remain confidential within the organizational context, such as internal policies, employee information, or proprietary processes. This semantic layer is crucial because simple pattern matching can be evaded through reformulation (for example, writing out numbers in words rather than digits, disguising identifiers through acronyms, or alluding to sensitive information indirectly). Semantic analysis captures the intent to disclose sensitive categories of information even when explicit patterns are obscured. The semantic layer is implemented through a combination of rule-based keyword detection for high-confidence sensitive terms and learned classifiers trained to recognize semantic content relevant to restricted categories.

3.7.3. Policy Compliance Verification

The system implements a configurable policy engine that encodes domain-specific operational requirements. For the energy auditing scenario in which this system is deployed, policies include requirements that responses must not recommend actions violating building regulations, must not suggest cost-cutting measures that compromise safety, must clearly distinguish between legally required and optional recommendations, and must accurately represent the substantive requirements of the Energy Performance of Buildings Directive. The Validator Agent evaluates generated responses against these policies, ensuring adherence before user exposure.
Policy violations are detected through a combination of approaches: rule-based checks searching for specific prohibited terms or patterns (for instance, flagging responses that claim to override safety requirements), keyword-based matching for policy-critical concepts (for instance, matching responses against regulatory terminology), and semantic classification assessing whether the response’s semantic content aligns with policy requirements. The policy engine is intentionally designed to support dynamic updates without model retraining: new policies can be added by updating rule sets or providing additional training examples to classifiers, enabling rapid adaptation to changing regulatory requirements or organizational guidelines.

3.7.4. Toxic and Harmful Content Blocking

The Validator Agent includes detection mechanisms for toxic, abusive, or otherwise harmful content. This operates as a content moderation layer, flagging responses containing improper language or socially harmful content. This layer is meant to protect both user experience and organizational reputation, making sure that even if the Generator Agent produces problematic content (whether through model misalignment or successful adversarial manipulation), it is prevented from reaching users. The toxic content detection operates using classical pre-trained content moderation classifiers, which can be customized according to organizational use-cases or cultural context.

3.8. Implementation Framework and System Integration

The entire system is implemented using the Ollama framework and API, which provides efficient local model serving and inference optimization. The authors have used the Polish Bielik 2.3 LLM in quantized version (specifically: Bielik-11B-v2.3-Instruct-GGUF-Q4_K_M with 4-bit quantization). Ollama-based multiagent architecture enables rapid agent switching by simply storing and using two sets of different interaction sessions (system prompts and prompt history) for the two agents, while maintaining the same underlying model in memory, avoiding the computational overhead of full model reloads. The choice of the Bielik 2.3 model was motivated by its fluent support for Polish language.
The knowledge base is prepared according to the following proposed procedure. The information covering the domain of interest (in our deployment scenario, the EPBD directive, relevant national and local regulations, and available subsidy programs) is provided by domain experts as plain-text files, with their contents organized into thematically coherent paragraphs. This structure is designed intentionally to mitigate common issues encountered during automated chunk slicing and during embedding. Each paragraph is then embedded using the Ollama embeddings function, producing dense vector representations that capture semantic content. All resulting vectors are stored in JSON format for efficient access during runtime. These embeddings enable efficient similarity-based retrieval by allowing fast search and comparison between user queries and the structured knowledge base. The similarity search is implemented using dense vector comparison based on the dot product function. During inference, the system calculates similarity scores between the embedding of a user query and all precomputed embeddings of the knowledge base, producing a ranking list of candidate knowledge chunks. The top five most relevant chunks are selected and incorporated into the system prompt provided to the Generator Agent. This approach has proven sufficiently efficient for identifying relevant knowledge fragments while maintaining acceptable response latency across diverse hardware platforms.
The Validator Agent’s security validation logic is designed as a combination of rule-based and learning-based components. Rule-based components include regular expression patterns for PII detection, any signs of information extraction, policy checks against prohibited terms/topics, and pattern matching for known attack signatures from threat intelligence sources. Learning-based components may use smaller classification models trained to detect toxic content and assess semantic policy alignment. This hybrid approach is able to offer interpretability and maintainability (rule-based systems are easily auditable and can be updated by domain experts without machine learning expertise) with the expressiveness of learning-based systems, which can capture subtle semantic patterns that would evade simple pattern matching otherwise.
Importantly, the Validator Agent’s security rules can be updated without retraining the underlying LLM. New policies and detection patterns can be added, existing rules refined, and the contents of policies can be adjusted in response to any new threats that may emerge, or if organizational requirements change. This operational flexibility gives a significant practical advantage over approaches requiring model fine-tuning to adapt to new security requirements, as it eliminates the need for model retraining infrastructure and accelerates the deployment of security updates.

3.9. Firewall Operational Layers

While the Validator Agent represents the primary security innovation, the complete firewall architecture operates across three operational layers, each addressing distinct attack surfaces and providing defense-in-depth.

3.9.1. Input Layer Security

At the input layer, user prompts undergo preliminary validation to detect obvious attack attempts. The input validation checks for excessively long inputs that might attempt computational denial of service and detects queries containing known attack patterns from threat intelligence databases using regular rexpressions (RegEx). Input layer filtering provides the first step in attack prevention and is able to reject obviously malicious queries before they consume downstream resources or expose the knowledge base to retrieval amplification attacks. This layer also implements rate limiting to prevent brute-force attempts to discover system behavior or trigger resource exhaustion.

3.9.2. Retrieval Layer Security

The retrieval layer filters documents retrieved from the knowledge base to reduce the risk of indirect prompt injection via possibly compromised (poisoned) knowledge base entries. Retrieved documents are scanned for injection indicators and any other red-flag patterns before merging the user prompt with the retrieved information as a context and the current conversation session history. In high-security environments, documents retrieved from external sources or community-contributed content may and should be subjected to additional verification before inclusion.

3.9.3. Output Layer Security

The output layer, implemented by the Validator Agent, represents the final and the most important security checkpoint. As detailed in the previous section, the Validator Agent applies multi-dimensional security validation to all generated content. This layer identifies attack attempts that successfully bypassed input and retrieval layer defenses, and attacks targeting the Generator Agent’s behaviour itself. The output layer is intentionally positioned as a comprehensive security boundary where failures are conservative (rejecting legitimate responses if necessary) rather than permissive.
An important structural implication of the proposed architecture is that the Validator agent remains unaffected by the user prompt or the retrieved data; its role is to analyse the system’s output rather than to let the inputs control its behaviour.

4. Discussion and Conclusions

4.1. Summary of Contributions

This paper reframes the Dual-agent RAG architecture from our previous work, as an LLM Firewall providing output-layer security validation. The core contribution is demonstrating that separation of generation and validation creates a trust boundary enabling comprehensive post hoc defense against diverse LLM attack vectors. The multi-dimensional validation approach (combining prompt injection detection, sensitive information filtering, policy compliance verification, and toxic content blocking) addresses attacks that are able to bypass input-level defenses and manifest only in generated output text.
Compared to existing dual-LLM patterns and guardrail frameworks, our design emphasizes a minimal dual-agent configuration with an explicitly defined trust boundary between Generator and Validator, and concentrates the firewall logic in an output-level validation stage suitable for resource-constrained on-premise environments.

4.2. Advantages and Limitations

The Dual-agent architecture offers practical advantages for on-premise deployments: security policies can be updated without model retraining, validation policies and decisions are fully auditable, and the approach is able to function along other existing input-level security approaches without conflicts or degradation of security posture. The architecture requires no specialized modifications to base models and is expected be relatively easy to integrate with existing architecture.
However, the proposed approach does have some limitations: the validation layer introduces latency, and certain attack classes (such as model weight backdoors or supply chain poisoning) gain limited protection from output validation alone. Another important limitation is the lack of systematic empirical metrics in the present work. We do not yet report quantitative results such as false-positive/false-negative rates, detection coverage for different attack classes, or precise latency overhead introduced by the Validator Agent. As a consequence, the security posture of the architecture must currently be understood qualitatively, and concrete performance numbers remain to be established in future evaluations.
The Dual-agent Firewall represents one design point among complementary LLM security approaches. It is most effective as part of a hybrid/layered defense strategy, combining input, retrieval, and output-layer protections. Organizations should evaluate the architecture in their specific deployment context instead of following the path of universal applicability.

4.2.1. False Positives and Usability Trade-Offs

An inherent drawback of output-level validation is the possibility of false positives, where benign answers are blocked or excessively modified. In our design, the Validator Agent is intentionally biased towards caution: in ambiguous cases it may prefer to refuse or redact an answer rather than risk exposing sensitive information or producing policy-violating content. While such behavior is appropriate in high-security, on-premise deployments, it can reduce user satisfaction and increase the need for human review. In practice, this trade-off can be mitigated by tuning the strictness of the policies, distinguishing between “block” and “modify” decisions, and using validator logs to iteratively adjust the rules to the organization’s risk tolerance. Nevertheless, the possibility of false positives remains a fundamental limitation of output firewalls and an important aspect of their operational deployment.

4.2.2. Evaluation Limitations

Evaluation limitations. The present work focuses primarily on the architectural design and security rationale of a dual-agent LLM firewall. While we report practical observations from our deployment and illustrate the defense layers in Figure 1 and Figure 2, we do not provide a systematic benchmark or detailed ablation study. A comprehensive empirical evaluation, including standardized attack suites, comparisons with alternative guardrail strategies, and controlled ablations of the Validator Agent components, is an important direction for future work.

4.3. Future Directions

Future research will involve the analysis and benchmarking of exact adaptive validation approaches for the Validator agent, integration strategies with other security layers (possibly using information bus between the Validator agent and other security modules of the system for coordinated threat-level assessment of any given interaction), formal methods for security analysis, and standardized evaluation benchmarks. The main idea is that checking the model’s output adds another layer of protection besides input-level defenses. This approach applies to numerous deployment scenarios and should be explored further.

4.4. Conclusions

Large Language Models introduce security challenges, which are far beyond traditional IT/software security. Our work suggests that straightforward architectural ideas (i.e., the separation of generation and validation responsibilities, and the output filtering/analysis), may serve as an additional layer of defense against various attack vectors. The proposed dual-agent firewall was intended to raise the bar sufficiently so that the LLM systems might be considered adequately secure, to be able to be implemented as components of critical information/interaction pipelines, handling sensitive data.

Author Contributions

Conceptualization, M.P. and M.B.; methodology, M.P., M.B. and L.K.; software, M.P. and M.B.; validation, M.P. and W.R.; formal analysis, M.P. and L.K.; investigation, M.P., M.B. and M.C.; resources, M.P.; data curation, M.P. and M.B.; writing—original draft preparation, M.P., M.B., M.C., L.K. and W.R.; writing—review and editing, M.P. and W.R.; visualization, M.P.; supervision, M.P.; project administration, M.P.; funding acquisition, M.B. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the European Union from the European Regional Development Fund under the regional program “European Funds for Opole Voivodship” 2021–2027. Project title: “e-Assistant for energy and environmental auditor—Industrial research and experimental development work in the field of artificial intelligence application in energy and environmental assessments of residential buildings in Europe”. Grant number FEOP.01.01-IP.01-0009/23-00.

Data Availability Statement

The original contributions presented in this study are included in the article. Further inquiries can be directed to the corresponding authors.

Conflicts of Interest

Author Marek Baranowski was employed by the Opolskie Centrum Zarzadzania Projektami. The remaining authors declare that the re-search was con-ducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

References

  1. Yao, H.; Shi, H.; Chen, Y.; Jiang, Y.; Wang, C.; Qin, Z. ControlNET: A Firewall for RAG-based LLM System. arXiv 2025, arXiv:2504.09593. [Google Scholar]
  2. A Dual-Agent Strategy Towards Trustworthy On-Premise Conversational LLMs. Under review.
  3. Esmradi, A.; Yip, D.W.; Chan, C.F. A Comprehensive Survey of Attack Techniques, Implementation, and Mitigation Strategies in Large Language Models. arXiv 2023, arXiv:2312.10982. [Google Scholar] [CrossRef]
  4. Abdelnabi, S.; Gomaa, A.; Bagdasarian, E.; Kristensson, P.O.; Shokri, R. Firewalls to Secure Dynamic LLM Agentic Networks. arXiv 2025, arXiv:2502.01822. [Google Scholar] [CrossRef]
  5. OWASP. LLM01: 2025 Prompt Injection. 2025. Available online: https://genai.owasp.org/llmrisk/llm01-prompt-injection/ (accessed on 15 December 2025).
  6. DeepTeam. OWASP Top 10 for LLMs. 2025. Available online: https://www.trydeepteam.com/docs/frameworks-owasp-top-10-for-llms (accessed on 15 June 2025).
  7. Dev.to Contributor. Overview: OWASP Top 10 for LLM Applications 2025: A Comprehensive Guide. 2025. Available online: https://dev.to/foxgem/overview-owasp-top-10-for-llm-applications-2025-a-comprehensive-guide-8pk (accessed on 15 December 2025).
  8. Li, R.; Chen, M.; Hu, C.; Chen, H.; Xing, W.; Han, M. GenTel-Safe: A Unified Benchmark and Shielding Framework for Defending Against Prompt Injection Attacks. arXiv 2024, arXiv:2409.19521. [Google Scholar]
  9. Check Point. OWASP Top 10 for LLM Applications 2025: Prompt Injection. 2025. Available online: https://www.checkpoint.com/cyber-hub/what-is-llm-security/prompt-injection/ (accessed on 15 December 2025).
  10. Duvall, P.M. Deep Dive into OWASP LLM Top 10 and Prompt Injection. 2025. Available online: https://www.paulmduvall.com/deep-dive-into-owasp-llm-top-10-and-prompt-injection/ (accessed on 15 December 2025).
  11. NeuralTrust. Which Firewall Best Prevents Prompt Injection Attacks? 2025. Available online: https://neuraltrust.ai/blog/prevent-prompt-injection-attacks-firewall-comparison (accessed on 15 December 2025).
  12. Raga AI. Security and LLM Firewall Controls. 2025. Available online: https://raga.ai/resources/blogs/llm-firewall-security-controls (accessed on 15 May 2025).
  13. Aiceberg. What Is an LLM Firewall? Available online: https://www.aiceberg.ai/blog/what-is-an-llm-firewall (accessed on 15 December 2025).
  14. Nightfall. Firewalls for AI: The Essential Guide. 2024. Available online: https://www.nightfall.ai/blog/firewalls-for-ai-the-essential-guide (accessed on 15 December 2025).
  15. The Moonlight. Literature Review: ControlNET: A Firewall for RAG-Based LLM System. 2025. Available online: https://www.themoonlight.io/en/review/controlnet-a-firewall-for-rag-based-llm-system (accessed on 15 December 2025).
  16. Cloudflare. Block Unsafe Prompts Targeting Your LLM Endpoints with Firewall for AI. 2025. Available online: https://blog.cloudflare.com/block-unsafe-llm-prompts-with-firewall-for-ai/ (accessed on 15 December 2025).
  17. AccuKnox. How to Secure LLM Prompts and Responses. 2025. Available online: https://accuknox.com/blog/llm-prompt-firewall-accuknox (accessed on 15 December 2025).
  18. Greshake, K.; Abdelnabi, S.; Mishra, S.; Endres, C.; Holz, T.; Fritz, M. Not what you’ve signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection. arXiv 2023, arXiv:2302.12173. [Google Scholar]
  19. Mangaokar, N.; Hooda, A.; Choi, J.; Ch, rashekaran, S.; Fawaz, K.; Jha, S.; Prakash, A. PRP: Propagating Universal Perturbations to Attack Large Language Model Guard-Rails. arXiv 2024, arXiv:2402.15911. [Google Scholar] [CrossRef]
  20. Liu, H.; Huang, H.; Gu, X.; Wang, H.; Wang, Y. On Calibration of LLM-based Guard Models for Reliable Content Moderation. arXiv 2025, arXiv:2410.10414. [Google Scholar]
  21. Threat Model Co. The Dual LLM Pattern for LLM Agents. 2025. Available online: https://threatmodel.co/blog/dual-llm-pattern (accessed on 15 December 2025).
  22. Coralogix. LLM’s Insecure Output Handling: Best Practices and Prevention. 2025. Available online: https://coralogix.com/ai-blog/llms-insecure-output-handling-best-practices-and-prevention/ (accessed on 15 December 2025).
  23. Cobalt. Introduction to LLM Insecure Output Handling. 2024. Available online: https://www.cobalt.io/blog/llm-insecure-output-handling (accessed on 15 December 2025).
  24. MindsDB. Harnessing the Dual LLM Pattern for Prompt Security with MindsDB. 2025. Available online: https://mindsdb.com/blog/harnessing-the-dual-llm-pattern-for-prompt-security-with-mindsdb (accessed on 15 December 2025).
  25. Beurer-Kellner, L.; Buesser, B.; Creţu, A.M.; Debenedetti, E.; Dobos, D.; Fabian, D.; Fischer, M.; Froelicher, D.; Grosse, K.; Naeff, D.; et al. Design Patterns for Securing LLM Agents against Prompt Injections. arXiv 2025, arXiv:2506.08837. [Google Scholar] [CrossRef]
  26. Willison, S. The Dual LLM Pattern for Building AI Assistants That Can Resist Prompt Injection. 2023. Available online: https://simonwillison.net/2023/Apr/25/dual-llm-pattern/ (accessed on 15 December 2025).
  27. Cui, J.; Xu, Y.; Huang, Z.; Zhou, S.; Jiao, J.; Zhang, J. Recent Advances in Attack and Defense Approaches of Large Language Models. arXiv 2024, arXiv:2409.03274. [Google Scholar] [CrossRef]
  28. Rossi, S.; Michel, A.M.; Mukkamala, R.R.; Thatcher, J.B. An early categorization of prompt injection attacks on large language models. arXiv 2024, arXiv:2402.00898. [Google Scholar] [CrossRef]
  29. Liu, X.; Yu, Z.; Zhang, Y.; Zhang, N.; Xiao, C. Automatic and universal prompt injection attacks against large language models. arXiv 2024, arXiv:2403.04957. [Google Scholar] [CrossRef]
  30. Kumar, S.S.; Cummings, M.; Stimpson, A. Strengthening LLM trust boundaries: A survey of prompt injection attacks. In Proceedings of the 2024 IEEE 4th International Conference on Human-Machine Systems (ICHMS), Toronto, ON, Canada, 15–17 May 2024; pp. 1–6. [Google Scholar]
  31. Hung, K.H.; Ko, C.Y.; Rawat, A.; Chung, I.; Hsu, W.H.; Chen, P.Y. Attention tracker: Detecting prompt injection attacks in LLMs. arXiv 2024, arXiv:2411.00348. [Google Scholar] [CrossRef]
  32. Liu, Y.; Jia, Y.; Geng, R.; Jia, J.; Gong, N.Z. Formalizing and benchmarking prompt injection attacks and defenses. In Proceedings of the 33rd USENIX Security Symposium (USENIX Security 24), Philadelphia, PA, USA, 14–16 August 2024; pp. 1831–1847. [Google Scholar]
  33. Jacob, D.; Alzahrani, H.; Hu, Z.; Alomair, B.; Wagner, D. Promptshield: Deployable detection for prompt injection attacks. In Proceedings of the Fifteenth ACM Conference on Data and Application Security and Privacy, Pittsburgh, PA, USA, 4–6 June 2024; pp. 341–352. [Google Scholar]
  34. Suo, X. Signed-prompt: A new approach to prevent prompt injection attacks against LLM-integrated applications. AIP Conf. Proc. 2024, 3194, 040013. [Google Scholar]
  35. Hines, K.; Lopez, G.; Hall, M.; Zarfati, F.; Zunger, Y.; Kiciman, E. Defending against indirect prompt injection attacks with spotlighting. arXiv 2024, arXiv:2403.14720. [Google Scholar] [CrossRef]
  36. Yi, J.; Xie, Y.; Zhu, B.; Kiciman, E.; Sun, G.; Xie, X.; Wu, F. Benchmarking and defending against indirect prompt injection attacks on large language models. In Proceedings of the 31st ACM SIGKDD Conference on Knowledge Discovery and Data Mining V. 1, Toronto, ON, Canada, 3–7 August 2025; pp. 1809–1820. [Google Scholar]
  37. Yao, H.; Lou, J.; Qin, Z. Poisonprompt: Backdoor attack on prompt-based large language models. In Proceedings of the ICASSP 2024—2024 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Seoul, Republic of Korea, 14–19 April 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 7745–7749. [Google Scholar]
  38. Ostermann, S.; Baum, K.; Endres, C.; Masloh, J.; Schramowski, P. Soft begging: Modular and efficient shielding of LLMs against prompt injection and jailbreaking based on prompt tuning. arXiv 2024, arXiv:2407.03391. [Google Scholar] [CrossRef]
  39. Jiang, F.; Xu, Z.; Niu, L.; Xiang, Z.; Ramasubramanian, B.; Li, B.; Poovendran, R. ArtPrompt: ASCII Art-based Jailbreak Attacks against Aligned LLMs. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), Bangkok, Thailand, 11–16 August 2024; pp. 15157–15173. [Google Scholar]
  40. Yang, G.Y.; Cheng, T.Y.; Teng, Y.W.; Wang, F.; Yeh, K.H. ArtPerception: ASCII art-based jailbreak on LLMs with recognition pre-test. J. Netw. Comput. Appl. 2025, 244, 104356. [Google Scholar] [CrossRef]
  41. Saiem, B.A.; Shanto, M.S.H.; Ahsan, R.; ur Rashid, M.R. SequentialBreak: Large Language Models Can be Fooled by Embedding Jailbreak Prompts into Sequential Prompt Chains. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics, Vienna, Austria, 27 July–1 August 2025. [Google Scholar]
  42. Bhardwaj, R.; Poria, S. Language model unalignment: Parametric red-teaming to expose hidden harms and biases. arXiv 2023, arXiv:2310.14303. [Google Scholar] [CrossRef]
  43. Pilán, I.; Manzanares-Salor, B.; Sánchez, D.; Lison, P. Truthful Text Sanitization Guided by Inference Attacks. arXiv 2024, arXiv:2412.12928. [Google Scholar] [CrossRef]
  44. Zhang, M.; Abdollahi, M.; Ranbaduge, T.; Ding, M. POSTER: When Models Speak Too Much: Privacy Leakage on Large Language Models. In Proceedings of the 20th ACM Asia Conference on Computer and Communications Security, Hanoi, Vietnam, 25–29 August 2025; pp. 1809–1811. [Google Scholar]
  45. Wang, Y.; Cao, Y.; Ren, Y.; Fang, F.; Lin, Z.; Fang, B. PIG: Privacy Jailbreak Attack on LLMs via Gradient-based Iterative In-Context Optimization. arXiv 2025, arXiv:2505.09921. [Google Scholar]
  46. Cheng, S.; Li, Z.; Meng, S.; Ren, M.; Xu, H.; Hao, S.; Yue, C.; Zhang, F. Understanding PII Leakage in Large Language Models: A Systematic Survey. Codex 2021, 8, 10409–10417. [Google Scholar] [CrossRef]
  47. Lukas, N.; Salem, A.; Sim, R.; Tople, S.; Wutschitz, L.; Zanella-Béguelin, S. Analyzing leakage of personally identifiable information in language models. In Proceedings of the 2023 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA, 21–25 May 2023; IEEE: Piscataway, NJ, USA, 2023; pp. 346–363. [Google Scholar]
  48. Chen, X.; Tang, S.; Zhu, R.; Yan, S.; Jin, L.; Wang, Z.; Su, L.; Zhang, Z.; Wang, X.; Tang, H. The Janus Interface: How Fine-Tuning in Large Language Models Amplifies the Privacy Risks. In CCS ’24, Proceedings of the 2024 on ACM SIGSAC Conference on Computer and Communications Security, Salt Lake City, UT, USA, 14–18 October 2024; Association for Computing Machinery: New York, NY, USA, 2024. [Google Scholar]
  49. Kanth Nakka, K.; Jiang, X.; Zhou, X. PII Jailbreaking in LLMs via Activation Steering Reveals Personal Information Leakage. arXiv 2025, arXiv:2507.02332. [Google Scholar] [CrossRef]
  50. Wan, Z.; Cheng, A.; Wang, Y.; Wang, L. Information leakage from embedding in large language models. arXiv 2024, arXiv:2405.11916. [Google Scholar] [CrossRef]
  51. Sivashanmugam, S.P. Model Inversion Attacks on Llama 3: Extracting PII from Large Language Models. arXiv 2025, arXiv:2507.04478. [Google Scholar] [CrossRef]
  52. Shu, Y.; Li, S.; Dong, T.; Meng, Y.; Zhu, H. Model Inversion in Split Learning for Personalized LLMs: New Insights from Information Bottleneck Theory. arXiv 2025, arXiv:2501.05965. [Google Scholar] [CrossRef]
  53. Dong, T.; Meng, Y.; Li, S.; Chen, G.; Liu, Z.; Zhu, H. Depth Gives a False Sense of Privacy: LLM Internal States Inversion. In Proceedings of the 34th USENIX Security Symposium (USENIX Security 25), Seattle, WA, USA, 13–15 August 2025; pp. 1629–1648. [Google Scholar]
  54. Chen, Y.; Lent, H.; Bjerva, J. Text embedding inversion security for multilingual language models. arXiv 2024, arXiv:2401.12192. [Google Scholar] [CrossRef]
  55. Luo, Z.; Shao, S.; Zhang, S.; Zhou, L.; Hu, Y.; Zhao, C.; Liu, Z.; Qin, Z. Shadow in the cache: Unveiling and mitigating privacy risks of KV-cache in llm inference. arXiv 2025, arXiv:2508.09442. [Google Scholar] [CrossRef]
  56. Li, C.; Zhang, J.; Cheng, A.; Ma, Z.; Li, X.; Ma, J. CPA-RAG: Covert Poisoning Attacks on Retrieval-Augmented Generation in Large Language Models. arXiv 2025, arXiv:2505.19864. [Google Scholar]
  57. Kuo, M.; Zhang, J.; Zhang, J.; Tang, M.; DiValentin, L.; Ding, A.; Sun, J.; Chen, W.; Hass, A.; Chen, T.; et al. Proactive privacy amnesia for large language models: Safeguarding PII with negligible impact on model utility. arXiv 2025, arXiv:2502.17591. [Google Scholar] [CrossRef]
  58. Shen, G.; Cheng, S.; Zhang, Z.; Tao, G.; Zhang, K.; Guo, H.; Yan, L.; Jin, X.; An, S.; Ma, S.; et al. BAIT: Large language model backdoor scanning by inverting attack target. In Proceedings of the 2025 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA, 12–15 May 2025; IEEE: Piscataway, NJ, USA, 2025; pp. 1676–1694. [Google Scholar]
  59. Wang, H.; Guo, S.; He, J.; Liu, H.; Zhang, T.; Xiang, T. Model Supply Chain Poisoning: Backdooring Pre-trained Models via Embedding Indistinguishability. In Proceedings of the ACM on Web Conference 2025, Sydney, Australia, 28 April–2 May 2025; pp. 840–851. [Google Scholar]
  60. Wang, S.; Zhao, Y.; Liu, Z.; Zou, Q.; Wang, H. SoK: Understanding vulnerabilities in the large language model supply chain. arXiv 2025, arXiv:2502.12497. [Google Scholar] [CrossRef]
  61. Hu, Y.; Wang, S.; Nie, T.; Zhao, Y.; Wang, H. Understanding Large Language Model Supply Chain: Structure, Domain, and Vulnerabilities. arXiv 2025, arXiv:2504.20763. [Google Scholar] [CrossRef]
  62. Liu, T.; Meng, G.; Zhou, P.; Deng, Z.; Yao, S.; Chen, K. The Art of Hide and Seek: Making Pickle-Based Model Supply Chain Poisoning Stealthy Again. arXiv 2025, arXiv:2508.19774. [Google Scholar] [CrossRef]
  63. Fu, T.; Sharma, M.; Torr, P.; Cohen, S.B.; Krueger, D.; Barez, F. PoisonBench: Assessing Language Model Vulnerability to Poisoned Preference Data. In Proceedings of the Forty-Second International Conference on Machine Learning, Vancouver, BC, Canada, 13–19 July 2025. [Google Scholar]
  64. Bowen, D.; Murphy, B.; Cai, W.; Khachaturov, D.; Gleave, A.; Pelrine, K. Data poisoning in LLMs: Jailbreak-tuning and scaling laws, 2024. arXiv 2024, arXiv:2408.02946. [Google Scholar]
  65. Jiang, S.; Kadhe, S.R.; Zhou, Y.; Cai, L.; Baracaldo, N. Forcing generative models to degenerate ones: The power of data poisoning attacks. arXiv 2023, arXiv:2312.04748. [Google Scholar] [CrossRef]
  66. Zhou, X.; Qiang, Y.; Zade, S.Z.; Roshani, M.A.; Khanduri, P.; Zytko, D.; Zhu, D. Learning to Poison Large Language Models for Downstream Manipulation. arXiv 2024, arXiv:2402.13459. [Google Scholar]
  67. Das, A.; Tariq, A.; Batalini, F.; Dhara, B.; Banerjee, I. Exposing vulnerabilities in clinical LLMs through data poisoning attacks: Case study in breast cancer. In medRxiv; 2024. Available online: https://pmc.ncbi.nlm.nih.gov/articles/PMC10984073/ (accessed on 15 December 2025).
  68. Cheng, Y.; Sadasivan, V.S.; Saberi, M.; Saha, S.; Feizi, S. Adversarial Paraphrasing: A Universal Attack for Humanizing AI-Generated Text. arXiv 2025, arXiv:2506.07001. [Google Scholar] [CrossRef]
  69. Vitorino, J.; Maia, E.; Praça, I. Adversarial evasion attack efficiency against large language models. In Proceedings of the International Symposium on Distributed Computing and Artificial Intelligence, Salamanca, Spain, 26–28 June 2024; Springer: Cham, Switzerland, 2024; pp. 14–22. [Google Scholar]
  70. Wang, Z.; Wang, W.; Chen, Q.; Wang, Q.; Nguyen, A. Generating valid and natural adversarial examples with large language models. In Proceedings of the 2024 27th International Conference on Computer Supported Cooperative Work in Design (CSCWD), Tianjin, China, 8–10 May 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 1716–1721. [Google Scholar]
  71. Kezron, N. Securing the AI supply chain: Mitigating vulnerabilities in AI model development and deployment. World J. Adv. Res. Rev. 2024, 22, 2336–2346. [Google Scholar] [CrossRef]
  72. Moia, V.H.G.; de Meneses, R.D.; Sanz, I.J. An Analysis of Real-World Vulnerabilities and Root Causes in the LLM Supply Chain. In Proceedings of the Simpósio Brasileiro de Segurança da Informação e de Sistemas Computacionais (SBSeg), Foz do Iguaçu, Brasil, 1–4 September 2025; SBC, 2025. pp. 388–396. [Google Scholar] [CrossRef]
  73. Ferrag, M.A.; Alwahedi, F.; Battah, A.; Cherif, B.; Mechri, A.; Tihanyi, N.; Bisztray, T.; Debbah, M. Generative AI in cybersecurity: A comprehensive review of LLM applications and vulnerabilities. Internet Things Cyber-Phys. Syst. 2025, 5, 1–46. [Google Scholar] [CrossRef]
  74. Pankajakshan, R.; Biswal, S.; Govindarajulu, Y.; Gressel, G. Mapping LLM security landscapes: A comprehensive stakeholder risk assessment proposal. arXiv 2024, arXiv:2403.13309. [Google Scholar] [CrossRef]
  75. Derner, E.; Batistič, K.; Zahálka, J.; Babuška, R. A security risk taxonomy for prompt-based interaction with large language models. IEEE Access 2024, 12, 126176–126187. [Google Scholar] [CrossRef]
  76. Jiang, S.; Kadhe, S.R.; Zhou, Y.; Ahmed, F.; Cai, L.; Baracaldo, N. Turning generative models degenerate: The power of data poisoning attacks. arXiv 2024, arXiv:2407.12281. [Google Scholar] [CrossRef]
  77. Inan, H.; Upasani, K.; Chi, J.; Rungta, R.; Iyer, K.; Mao, Y.; Tontchev, M.; Hu, Q.; Fuller, B.; Testuggine, D.; et al. Llama Guard: LLM-based Input-Output Safeguard for Human-AI Conversations. arXiv 2023, arXiv:2312.06674. [Google Scholar]
  78. Phute, M.; Helbling, A.; Hull, M.; Peng, S.; Szyller, S.; Cornelius, C.; Chau, D.H. LLM self defense: By self examination, LLMs know they are being tricked. arXiv 2023, arXiv:2308.07308. [Google Scholar]
  79. Wang, Y.; Zhu, R.; Wang, T. Self-Destructive Language Model. arXiv 2025, arXiv:2505.12186. [Google Scholar] [CrossRef]
  80. Cai, Z.; Shabihi, S.; An, B.; Che, Z.; Bartoldson, B.R.; Kailkhura, B.; Goldstein, T.; Huang, F. AegisLLM: Scaling agentic systems for self-reflective defense in LLM security. arXiv 2025, arXiv:2504.20965. [Google Scholar]
  81. Horodnyk, V.; Sabodashko, D.; Kolchenko, V.; Shchudlo, I.; Khoma, V.; Khoma, Y.; Baranowski, M.; Podpora, M. Comparison of Modern Deep Learning Models for Toxicity Detection. In Proceedings of the 13th IEEE International Conference on Intelligent Data Acquisition and Advanced Computing Systems, Gliwice, Poland, 4–6 September 2025; IEEE: Piscataway, NJ, USA, 2025. [Google Scholar]
  82. Harris, C.R.; Millman, K.J.; Van Der Walt, S.J.; Gommers, R.; Virtanen, P.; Cournapeau, D.; Wieser, E.; Taylor, J.; Berg, S.; Smith, N.J.; et al. Array programming with NumPy. Nature 2020, 585, 357–362. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.