The Cognitive Firewall: Securing Browser-Based AI Agents against Indirect Prompt Injection via Hybrid Edge-Cloud Defense
Qianlong Lan, Anuj Kaul · 2026
Read The Cognitive Firewall: Securing Browser-Based AI Agents against Indirect Prompt Injection via Hybrid Edge-Cloud Defense by Qianlong Lan, Anuj Kaul (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2603-23791.txt.
Introduction
Lan and Kaul present the Cognitive Firewall, a defense for browser-based AI agents. Such agents face indirect prompt injection hidden in web content. Their system splits checks across the device and the cloud in three stages. A local visual guard screens pages, a cloud planner checks meaning, and a fixed guard enforces rules at run time. Across 1,000 attack samples, the full system cuts attack success below 1 percent. It also runs far faster than cloud-only checks.
Catalog record
| CREATOR | Qianlong Lan, Anuj Kaul |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 41240 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2603.23791
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
The Cognitive Firewall: Securing Browser-Based AI Agents against Indirect Prompt Injection via Hybrid Edge-Cloud Defense Thanks: Citation : Authors. Title. Pages…. DOI:000000/11111. Qianlong Lan, Anuj Kaul Abstract Deploying large language models (LLMs) as autonomous browser agents exposes a significant attack surface in the form of Indirect Prompt Injection (IPI). Cloud-based defenses can provide strong semantic analysis, but they introduce latency and raise privacy concerns. We present the Cognitive Firewall, a three-stage split-compute architecture that distributes security checks across the client and the cloud. The system consists of a local visual Sentinel, a cloud-based Deep Planner, and a deterministic Guard that enforces execution-time policies. Across 1,000 adversarial samples, edge-only defenses fail to detect 86.9% of semantic attacks. In contrast, the full hybrid architecture reduces the overall attack success rate (ASR) to below 1% (0.88% under static evaluation and 0.67% under adaptive evaluation), while maintaining deterministic constraints on side-effecting actions. By filtering presentation-layer attacks locally ( ∼ \sim 0.02 ms), the system avoids unnecessary cloud inference and achieves an approximately ∼ \sim 17,000x latency advantage over cloud-only baselines. These results indicate that deterministic enforcement at the execution boundary can complement probabilistic language models, and that split-compute provides a practical foundation for securing interactive LLM agents. K eywords Large Language Models \cdot Indirect Prompt Injection \cdot Browser Security \cdot Split Computing \cdot Defense-in-Depth \cdot Edge-Cloud Architecture \cdot Adversarial Robustness 1 Introduction Web browsers are increasingly serving as execution platforms for autonomous Artificial Intelligence (AI) agents rather than merely passive interfaces [ 32 , 38 ] . Unlike traditional automation scripts, these agents rely on Large Language Models (LLMs) to interpret the Document Object Model (DOM), perceive page content, plan actions, and execute multi-step workflows, from booking flights to managing enterprise Jira tickets. In this setting, user instructions and external web content are processed within the same context window, blurring the distinction between the control plane and the data plane and introducing a structural vulnerability. This overlap enables Indirect Prompt Injection (IPI) [ 8 ] , classified as LLM01 in the OWASP Top 10 [ 19 ] . An attacker can embed malicious instructions in web content that remains unnoticed by users but is visible to the LLM, for example through zero-opacity text [ 33 ] . Once the model incorporates such content into its reasoning, the agent may act as a confused deputy, leaking sensitive information or performing unauthorized actions [ 15 ] . Unlike Cross-Site Scripting (XSS), which exploits rigid syntactic parsing [ 37 , 13 ] , IPI targets ambiguity at the semantic level and the model’s interpretation of contextual authority [ 8 , 20 ] . Consequently, browser-level mechanisms such as the Same-Origin Policy (SOP) [ 4 ] provide limited protection when agents intentionally ingest cross-origin content. Standard defenses from Adversarial Machine Learning (AML), including adversarial training [ 7 , 17 ] and randomized smoothing [ 5 ] , are computationally demanding for interactive use and do not scale to the open-ended space of linguistic jailbreaks [ 30 , 39 ] . Current defenses face a trade-off between latency and semantic depth. Server-side filtering supports richer analysis but can add substantial delay (often exceeding 500 ms) and raises privacy concerns [ 22 ] . Lightweight client-side filters reduce latency but lack the capacity to detect sophisticated cognitive manipulation. As agents move toward real-time interaction, centralized inference becomes a practical bottleneck. We therefore draw on split-computing frameworks, which demonstrate that distributing computation between edge and cloud can reduce end-to-end latency. While prior work has focused primarily on Computer Vision (CV) workloads [ 11 , 29 , 14 ] , we adapt these ideas to the security of LLM-driven agents. We introduce the Cognitive Firewall, a split-compute architecture that distributes security checks across client and cloud components. A lightweight, browser-resident model performs fast screening near the user, while cloud-based LLMs handle inputs that require deeper semantic analysis. In our prototype, browser-integrated Small Language Models (SLMs), such as Gemini Nano in Google Chrome [ 28 ] , serve as a low-latency Sentinel. The system operates in three stages. First, a local Sentinel applies visual and DOM-level heuristics to detect presentation-layer attacks, such as hidden text or CSS-based obfuscation, with sub-millisecond overhead. Second, inputs that pass this stage are forwarded to a cloud-based Deep Planner, which evaluates high-level intent and identifies jailbreak-style manipulations that are difficult to detect on-device. Third, a deterministic Guard enforces execution-time constraints through a Synchronous JavaScript Interceptor, blocking actions that violate origin or verb-level policies. Our contributions are threefold. We formalize a Defense Funnel model that organizes split-compute security as a staged inspection process, assigning inexpensive checks to the edge and reserving deeper analysis for the cloud while enforcing strict execution policies at the boundary. We evaluate the architecture on 1,000 adversarial samples and show that the edge Sentinel filters presentation-layer attacks in approximately \sim 0.02 ms, providing roughly \sim 17,000x lower latency than cloud-only baselines and reducing the Attack Success Rate (ASR) from 100% to 0.88%. Finally, we quantify efficiency gains: although the edge layer does not capture all semantic attacks, it blocks 13.1% of high-frequency visual threats, lowering cloud token usage while maintaining a 99.1% overall interception rate. 2 Background and Related Work 2.1 The Rise of LLM Agents & Prompt Injection Large Language Models (LLMs) are increasingly used as autonomous agents that execute multi-step workflows [ 32 , 38 ] . Many systems follow the ReAct pattern [ 36 ] , where the model alternates between generating intermediate reasoning and invoking external tools, including API calls learned through approaches such as Toolformer [ 26 ] . Frameworks such as HuggingGPT [ 27 ] illustrate how far this direction can go, but they also highlight a core security problem: the agent often consumes untrusted web content and user instructions through the same context, without a clear isolation boundary. Indirect Prompt Injection (IPI), formalized by Greshake et al. [ 8 ] , exploits this blending by steering an agent through content it passively reads. Follow-up work argues that the risk is not limited to brittle surface patterns, but reflects a deeper weakness in how LLMs prioritize and interpret contextual cues [ 20 ] . These vulnerabilities can transfer across models. For example, Zou et al. [ 39 ] show universal adversarial suffixes that can bypass alignment across multiple model families. The threat is also no longer limited to text. Qi et al. [ 21 ] and Bailey et al. [ 3 ] demonstrate visual prompt injection, where malicious instructions are embedded in images to evade text-only filters. Our design targets this multimodal setting by reasoning over rendered DOM properties (Section 2.2 ). 2.2 Limitations of Existing Defenses Industry systems such as NVIDIA NeMo Guardrails [ 23 ] enforce safety using server-side scripts (e.g., Colang). This approach can work well for chatbot-style interactions, but it introduces latency and cannot inspect client-side DOM structure, which makes it ineffective against visual obfuscation on web pages. More broadly, defenses against adversarial inputs in LLM systems tend to follow a few common directions, but none fully meet the requirements of real-time browser agents. One line of work adapts classical adversarial machine learning defenses, including adversarial training [ 7 , 17 ] and randomized smoothing