Prismata: Restricting Cross-Site Prompt Injection in Web AgentsPrismata: Confining Cross-Site Prompt Injection in Web Agents
Prismata constrains web agents with critical-path labeling and mechanical isolation, reducing the average ASR for three popup attacks from 85.5% to 0.7%.
An attacker can inject text into user, hosted-party, or external content on benign sites, can infer the task, and can attack trust inference over multiple rounds; the labeling model is not assumed to be adversarially robust. JavaScript is limited to sandboxed iframes. Prismata sits between the BrowserGym agent and the browser, and only defends against text XSP that exceeds task permissions.
- Web agents mix developer, user, and external content on benign pages; natural language injection can hijack tasks through in-site functionality. Judging whether an action is over-privileged requires reading structures entangled with untrusted content, and model-level refusal and pre-planned tool calls have difficulty directly handling such entanglement.
- Prismata sits between the agent and the browser. The action gate only sees the task and the element's DOM critical path; Biba parsing uses ancestors and structural cues to lock down sources, and labels cannot be higher than parent nodes. The policy model only sees the task, and deterministic code then removes or downgrades over-privileged elements.
- On the three pop-up attacks in WebArena, the authors report average ASR from 85.5% to 0.7%, average TSR under attack from 4.5% to 23.0%, and benign TSR from 29.9% to 26.6%. The authors state that end-to-end attack success on adaptive WA20 was eliminated, and WASP Goal 0's plain-goal success was blocked.
- The authors state that only text XSP exceeding task permissions is blocked, integrity takes priority over labeling accuracy, and the method is affected by the model and page structure. For high-demand tasks, they suggest isolated agents. Experiments include three WebArena templates, WASP, and adaptive WA20, with 20 labeled observations; the number of tasks in Table 2 and the defense component models are not reported.
- Evaluated models
- GPT-5.4GPT-5.4-miniGPT-5.4-nanoGemini 3 FlashGPT-OSS-120BQwen3-8BMiniMax-M2.5
- Benchmarks
- WebArenaWASPWA20Mind2WebCommon CrawlTranco top 10K
- Metrics
- TSRASRDSRreward-weighted task success rateallowed-element precisionallowed-element recallallowed-element F1
The researchers propose Prismata, a defense method that provides context-based least privilege for web agents to limit cross-site prompt injection. The method generates permission labels for page content through dynamic trust inference, and draws on classical integrity models to give structural constraint guarantees, so that labels can only lower permissions and labeling errors are bounded. Mechanical isolation enforces these labels by pruning content and limiting agent capabilities, and requires no developer labeling, covering long-tail websites. On published web agent attacks and adaptive variants, Prismata substantially reduces attack success rates while maintaining normal task utility.
Paper analysis
What problem does this paper attempt to solve?
Web agents treat untrusted natural language as instructions; Prismata restricts both what they see and what they can do according to the task.
Web agents treat natural language on the page as instructions, while judging whether an action exceeds authority requires reading structures entangled with untrusted content.
- Scenario: The authors state that agents on benign shopping and other sites simultaneously see developer UI, user comments, and external ads. Injections in third-party content can let the agent exfiltrate data or change permissions via in-site functionality. The authors call this Cross-Site Prompting (XSP) and state that XSS defenses do not transfer directly because payloads are natural language and images.
- Existing gaps: The authors state that adaptive attacks still bypass model-level defenses at high rates. The authors state that CaMeL requires pre-planning all actions, making it hard for data-dependent web tasks; read-only domains stop at the source level; page-level policies previously required developers to manually build maps per site.
- Observation: The authors state that the critical path of interactive elements is mostly developer structure nodes, and untrusted content rarely falls on the path; titles, accessibility attributes, and class names often appear before untrusted subtrees.
- Method: Prismata applies task-based least privilege, limiting both what is seen and what can be done. Dynamic trust derivation applies source and permission labels, and the authors state that labeling errors only reduce privilege; mechanical isolation handles redaction and capability restriction. The authors state that no developer labeling is needed.
- Threat model:
- Goal: Block actions that exceed task-required permissions. Fake reviews while reading reviews are within permissions, and the authors state they are not within this defense's goal.
- Knowledge: May infer the task and target injections; may attack trust derivation over multiple rounds. No assumption of adversarial robustness for the labeling model. The paper does not use white-box or black-box to describe this threat model.
- Capability: Can inject text into user, hosted-party, or external content. JavaScript is limited to sandboxed iframes; arbitrary execution on trusted sources is considered classic XSS and out of scope.
- Victim system: Web agents in BrowserGym, with observations as accessibility trees and a limited action space. Prismata sits between the agent and the browser. Assumes sites have XSS defenses. Only handles text inputs.
What related research exists?
The authors state that model-level defenses can still be bypassed by adaptive attacks, and system-level methods have difficulty directly handling web entanglement.
The authors discuss prompt injection defenses along two routes, model-level and system-level, and compare them with page-level annotation and XSS isolation.
Model-level defenses
- Resistance-based methods: The authors classify StruQ (Chen et al., 2024), Instruction Hierarchy (Wallace et al., 2024), DataSentinel (Liu et al., 2025), etc., as a class that relies on the model to resist injection, and state that adaptive attacks still bypass them at a high rate. The paper does not give the numbers for those bypass experiments here.
- Web agent detection: The authors state that existing web agent defenses are mainly model-level. For In-Context Defense (Yang et al., 2025) and WebGuard (Zheng et al., 2025), the authors state they generalize less easily and are also more susceptible to XSP-like attacks. The paper does not provide a numerical comparison with Prismata.
System-level isolation
- CaMeL (Debenedetti et al., 2025): Pre-plans on structured tool APIs with semantics to achieve full mediation. The authors state that click(id) on web pages has no security semantics itself, and tasks depend on page data, so it cannot be directly applied; they also state it is difficult to generalize to data-dependent web tasks.
- Information flow and just-in-time policies: Information flow control (Costa et al., 2025, etc.) uses metadata of tool parameters. The authors state that web actions lack such metadata, and source-level control granularity such as read-only domains is likely insufficient. Tsai and Bagdasarian (2025) explore just-in-time policies on open tasks; the authors do not criticize that work and do not provide a numerical comparison.
- Dual-LLM (Willison, 2023): An isolated model passes bounded variables to a privileged planner, with several later implementations. The authors believe that since web action parameters point to untrusted DOM, a strict two-level division is insufficient, so they add an intermediate exposure layer.
Page policies and XSS
- ceLLMate (Meng et al., 2025): The authors state that fine-grained page-level policies against XSP previously required developers to manually build a complete site map per site.
- XSS protection: Input sanitization, Content Security Policy, iframe sandboxing, and SafeFrame are used to restrict executable code or ad capabilities. The authors state these cannot be directly used for agents because the model does not distinguish data from instructions, and external content cannot be isolated from the agent context.
Baselines and benchmarks
- Baseline methods: The same BrowserGym agent with Prismata enabled versus disabled is compared; the paper does not provide numerical comparisons with other defense systems. Attack templates are adapted from Pop-up (Zhang et al., 2024), including Shortcut, Fake Completion (Willison, 2023), and Ignore Instruction (Perez and Ribeiro, 2022). WASP (Evtimov et al., 2025) is also used for stress testing.
- Environment and corpus: The task environment is WebArena (Zhou et al., 2024). Page statistics use Common Crawl, Tranco, and Mind2Web (Deng et al., 2023).
The authors position this work as a system-level contextual least-privilege defense that does not rely on developer annotation: it uses critical paths and Biba-style constraints to handle web entanglement, rather than relying on model refusal or pre-fixing all tool calls. In the conclusion, the authors state that Prismata is a novel contextual least-privilege defense.
How does the paper address this problem?
Prismata performs action gating and Biba resolution along the DOM critical path, then executes least privilege with deterministic code.
Prismata sits between the web agent and the browser: it first derives minimal-privilege labels from the restricted page structure, then uses deterministic code execution rather than letting the model refuse injections itself.
Problem Setting
- Entanglement: The same click(id) could be a purchase, a comment reply, or an ad click; the safety meaning lies in the site, not in the action name. The authors call this the web entanglement problem.
- Observation and Actions: The system is based on BrowserGym. Element actions use identifiers to point to page elements; navigation and control actions do not point to page content. The agent sends only one action per step. The page is modeled as a rooted DOM tree, and interactive elements have a critical path from the root to that element.
- Effective Capability: The action gate and Biba resolution each assign values; the effective capability takes the stricter one: cap(e,task)=min(capgate(e,task),capbiba(e,task)). This means that an injection-free label from either mechanism can cap the capability.
Action Gate
- Input Scope: Buttons, links, and forms are enumerated via DevTools. Each critical path is given to the LLM separately; the input is only the user task and the structural context on the path, with the rest of the page content invisible.
- Injection-Free Case: When there is no untrusted content on the path, the decision is injection-free by construction. Injections outside the path cannot change that path and therefore cannot affect the gating of that element.
Biba Resolution
- Sources and Direction: Content is labeled as developer, user, hosted-party, or external. Labeling looks only at the element itself and its ancestors from the root; child nodes and siblings are masked (no-read-down). Once a label is determined, it is locked and cannot be higher than the parent (no-write-up).
- Clue Cascade: When titles, accessibility attributes, or developer class names indicate untrusted content, the label cascades to all descendants, and that subtree is no longer queried.
- Capability: Non-developer subtrees get both source and capability. Content not needed for the task is pruned; content needed for the task is restricted to read-only, observable but not interactive.
Policy Model and Mechanical Isolation
- Source-Level Pruning: Another policy model looks only at the task description, not the DOM, and decides which sources are needed, thereby pruning entire classes such as user, hosted-party, or external. The authors claim that attackers therefore cannot change which sources are retained via page content.
- Execution Boundary: It processes captured HTML, accessibility trees, and DevTools metadata, without modifying the live DOM. Over-privileged nodes are removed from the observation; read-only elements have their target identifiers removed or disabled. After an action returns, the same capability table is checked; if the identifier is removed or the capability is insufficient, it is rejected before being handed to Playwright.
- Repetition: Recapture and filter after each action. The authors state that DOM structures for nearby page states can be cached, and label and capability tables can be reused. The paper does not specify temperatures, thresholds, or model names for the components.
Security Argument
- Three Placements: Case 1, the injection is not on the target critical path, so the action gate is injection-free. Case 2, the injection is on the path but there is a prior structural clue, so Biba resolution restricts capability before exposing the injection. Case 3, the injection is on the path with no prior clue, and neither step can rule out seeing the attack content during labeling. The authors claim that an attacker must defeat both mechanisms.
- Informal Argument: The authors enumerate three routes: influencing the action gate, influencing Biba resolution, and bypassing execution. The first two are blocked by path-limited inputs in Cases 1 and 2. The action space is closed, with no arbitrary JavaScript; the isolation is deterministic code, not dependent on the LLM, and stands before every action.
- Residual: In Case 3, the authors claim that labels may still be correct, but even if mislabeled, the capabilities of other elements not containing that injection are unaffected.
What experiments did the paper conduct?
When enabled, the average ASR for the three attacks drops from 85.5% to 0.7%, and the benign TSR drops from 29.9% to 26.6%.
Experimental Setup
- Agent: Main experiments use gpt-5.4-mini. For selection, gpt-5.4, gpt-5.4-mini, and gpt-5.4-nano were compared on full WebArena, with reward-weighted TSR of 33.6%, 30.8%, and 16.0%. Snapshots are gpt-5.4-2026-03-05, gpt-5.4-mini-2026-03-17, and gpt-5.4-nano-2026-03-17 (Table 6).
- Defense-side models: The authors state that inference cost is no higher than or comparable to the agent. Labeling comparisons are Gemini 3 Flash, GPT-OSS-120B, Qwen3-8B, MiniMax-M2.5, GPT-5.4-mini, and GPT-5.4-nano. Which model is used for the action gate, Biba parsing, and policy model in Table 2 is not specified in the paper. Table 5 also lists gpt-oss-20b and gemini-3-flash-preview; the paper does not specify the former's role, nor whether the latter is the same as the Gemini 3 Flash in the main text.
- Environment and attacks: WebArena, including GitLab, shopping, forum-style sites, CMS, etc. Three pop-up templates are Shortcut, Completion (also called Fake Completion in the main text), and Ignore (Ignore Instruction), adapted from Pop-up attacks; injection positions are limited to DOM that malicious users or external parties can modify. Also WASP and adaptive WA20.
- Metrics: TSR follows WebArena definitions, combining programmatic checks, LLM-as-a-judge, and string matching; the judge model is not specified in the paper. ASR refers to the agent interacting with injected malicious content. DSR refers to Prismata removing the injection or downgrading it to read-only.
- Repeats and human effort: Each experiment is run three times, reporting mean and standard deviation. Labeling validation samples 4 observations randomly from benign baseline observations per site, totaling 20 observations across 5 sites, with 1 expert and each candidate model labeling once each, about 20 hours. The number of task rows in Table 2 is not specified in the paper.
- Corpus labeling: §3 uses two unnamed language models to label sources and the intervals where structural cues first appear; the source model's prompt was manually iterated against human-checked pages.
Main Results
According to Table 2, agent is gpt-5.4-mini, three-run means (%). Without attack, ASR and DSR are not applicable and are reported as not reported in the table. Defense component models are not specified in the paper.
Swipe horizontally to read the table
Setting No TSR With TSR No ASR With ASR With DSR Benign baseline 29.9 26.6 Not reported Not reported Not reported Shortcut 11.2 24.4 63.9 2.1 88.4 Completion 2.3 24.8 92.5 0.0 95.8 Ignore 0.0 19.9 100.0 0.0 95.1 Standard deviations: benign TSR are 1.4 and 0.3; Shortcut TSR are 0.9 and 1.1, ASR are 2.0 and 0.4, DSR is 2.0; Completion TSR are 0.3 and 0.8, ASR are 0.7 and 0.0, DSR is 2.7; Ignore TSR are 0.0 and 0.7, ASR are 0.0 and 0.0, DSR is 5.0.
- Author summary: §5.2 states that average TSR across the three attacks goes from 4.5% to 23.0% (+18.5 percentage points, about 5.1x relative), average ASR from 85.5% to 0.7%, average DSR is 93.1%, and ΔASR is −84.8 percentage points. The evaluation summary in the introduction is consistent with these averages.
- Per-attack: The authors state that Completion and Ignore ASR are reduced to the table's 0.0%, while Shortcut remains nonzero when enabled, and its DSR is also lower than the other two rows. TSR under attack remains below the benign baseline. The authors do not explain Shortcut's residual.
- Relationship between metrics: The authors state that ASR and DSR are not complementary. Attack success always counts as defense failure; when the agent itself ignores the injection, the attack can fail without Prismata removing or downgrading it.
Critical Path Measurements
- Corpus: Common Crawl takes 2,832 domains from Tranco top 10K, 100 pages per domain, totaling 283,200 archived DOMs. The labeling corpus is one page per domain plus an equal number of Mind2Web pages, totaling 5,664 DOMs, half from each. Untrusted paths are 90,408, with Common Crawl 24,992 and Mind2Web 65,416.
- Coverage: 1,086 paths (1.2%) contain actionable descendants; of these, 94 have no structural cue before the action, accounting for 8.7% of actionable cases and 0.10% of the full corpus. Of these 94, 79 (84%) are plain links: 57 a[href] and 22 role=link.
- Residual: The authors assume that same-origin GET does not change state, then the residual goes from 0.10% to 0.017%, i.e., 15 non-link controls. Figure 5's caption states that most sites satisfy both conditions for nearly all untrusted paths; the extracted text has no curve endpoints. Figure 6 and the main text state that lineage cache coverage increases as same-site DOMs increase, steeper for Mind2Web and shallower for Common Crawl; the main text does not give cache rate numbers.
WASP and Adaptive Attacks
- WASP: In Table 3, E2E and Int. without Prismata are 1/21 for Goal 0 and 0/21 for Goal 1; with Prismata, both rows are 0/21 and 0/21. The authors state that without defense, plain-goal succeeds once on Goal 0 and is blocked when enabled; this task uses the site's account management function to change the user's email. The main text does not define Int. or explain the difference between Goal 0 and Goal 1.
- Adaptive: The authors state that end-to-end attack success on WA20 was eliminated. In Table 3, with Prismata, ASR aligned with Shortcut and Completion is 0.0; without defense, Shortcut is 100.0 and Completion is 65.0. The Ignore row is misaligned with markers in the extracted text, so its no-defense numbers are not used. The paper does not specify the number of iterations or queries.
- Exceptions: Adaptive Completion's no-defense ASR of 65.0% is lower than Table 2's 92.5%. The authors do not explain. Goal 1 is already 0/21 without defense.
Labeling Validation
- Comparison: An expert replaces Biba parsing's ownership and capability labels, leaving the rest of the cascade and execution unchanged. Allowed elements are those still available after policy and mechanical isolation. Low precision indicates over-permissiveness, low recall indicates over-restrictiveness. The sample is 20 observations.
- Six models: The authors state that each model has precision above 93% and F1 above 87%, with the strongest configuration's precision between 95% and 99%. The authors state that GPT-5.4-nano has the highest precision at 98.69% and the lowest recall at 82.69%. The authors state that Gemini 3 Flash has the highest F1 at 95.14%. The three open-source models also have high precision but lower recall. Figure 8 is the average over 20 observation pairs; aside from these numbers, the extracted text has no bar heights.
- Per-site: In Figure 9, GPT-5.4-nano has precision no lower than 95% across sites, F1 above 89%, and lowest recall on Maps; the exact recall for Maps is not given in the paper. The authors state that F1 is element-averaged and does not capture worst cases; a single critical mislabel could still let attack-relevant elements through, though capability restrictions may still block them. Human labeling may suffer fatigue, so at most four per site.
Other Ablations and Analyses
- Benign TSR mean difference is 3.3 percentage points (§5.4); the authors state that most baseline utility is preserved.
- WA20 matched runs: agent request time goes from 1,649.8s to 1,781.4s; policy model 459.0s, action gate 1,098.2s, Biba parsing 789.6s (§5.4, Figure 10).
- Cost after caching for 20 tasks goes from $1.105 to $1.623. The main text states that KV reuse avoids $1.821 and request-level reuse avoids $1.102; Figure 10D labels $2.023, $1.102, and $0.202, inconsistent with the main text's KV numbers.
- The reward-weighted TSR used for selection is not the same number as Table 2's benign TSR of 29.9%; the paper does not explain where the difference comes from.
- Actionable descendant determination: non-hidden form controls, links, label targets, interactive ARIA roles, onclick, editable areas, or tabindex (§3).
- The paper does not report the number of queries in attack loops, nor does it provide numerical comparisons with other defenses.
What are some points that can be further explored?
The authors note that completeness is prioritized over annotation accuracy, and that text modality and in-permission attacks are out of scope.
Limitations and future directions noted by the authors
- Integrity vs. accuracy: The authors state that the key limitation is intentionally trading accuracy for integrity. Models that can see parent-child nodes may label more accurately, but this method mechanically prevents upward tampering and privilege escalation under the stated action space and threat model (§6.3).
- Model and page snapshots: The authors state that the method is limited by the accuracy of the policy model, the action gate, and the model used for Biba parsing. The deviation between the captured DOM and the real-time page at execution time, the authors state, is a fundamental limitation of LLM web agents, not introduced by Prismata (§6.3).
- Page structure: Labeling relies on HTML layout and signals such as headings and link targets, and is inherently heuristic. The validation study is used as a comparison against a safety-oriented human reference, and the authors state they are not claiming ground truth (§6.3).
- Modality: Only text is handled. The authors state that gradient-based image perturbations, non-text jailbreaks, and multimodal attacks can still be exploited; mapping the same DOM permissions into screenshots is beyond the scope of this paper (§2.1, §6.3).
- Attacks within permissions: Only defends against XSP whose targets exceed the permissions required by the task. In-permission influences such as fake reviews, the authors state, are better suited to model-level reasoning (§2.1).
- High-demand tasks: Some tasks may require all content types and all capabilities. The authors suggest as future work handing large amounts of untrusted work to isolated web agents, similar to isolated models in tool calling (§6.3).
Experimental coverage
- The main attack table compares Shortcut, Completion, and Ignore on WebArena, with Prismata on and off, three runs per setting; also WASP (denominator 21, E2E and Int., Goal 0 and Goal 1) and adaptive WA20 (Table 2, Table 3, §5.1–§5.2).
- The main model for the tested agents is gpt-5.4-mini; on the full WebArena, reward-weighted TSR is also reported for gpt-5.4 and gpt-5.4-nano (§5.1).
- Labeling validation covers GitLab, Maps, Reddit, Shopping, and Shopping Admin, with 20 observations total, 4 per site, 1 expert, and 6 labeling models, each labeled once (§5.3).
- Structural measurements cover 283,200 archived DOMs, 5,664 labeled DOMs, and 90,408 untrusted paths; overhead measurements use matched WA20, 20 tasks (§3, §5.4).
- The paper does not report the number of tasks in Table 2, the models for each of the three defense components, the number of adaptive iterations, the WebArena judge model, or the agreement between attack determination and human judgment. The two corpus labeling models in §3 are also unnamed.
Summarize the main content of the paper
Prismata uses critical paths and Biba constraints to isolate XSP, reducing the average ASR across three attacks from 85.5% to 0.7%.
Prismata is a system-level least-privilege defense against Cross-Site Prompting for web agents, requiring no labeling from site developers.
- Problem: Benign pages mix developer structure with user, hosted, and external content. Action names have no security semantics, yet policies must be derived from structures that may contain injections.
- Method: The action gate only receives the task and that element's DOM critical path; Biba parsing locks down sources by ancestors and structural cues, and labels cannot be higher than parent nodes. The policy model only sees the task. Deterministic code removes over-privileged content and rejects out-of-scope tool calls, with effective permissions taking the stricter of the two.
- Structural measurements: Of 90,408 untrusted paths, 1.2% contain actionable descendants; those without prior cues account for 0.10%. The authors state that under the same-origin GET no-state-change assumption, the residual is 0.017%.
- Attack-defense numbers: On WebArena with gpt-5.4-mini as the agent, average ASR across three pop-up attacks goes from 85.5% to 0.7%, average TSR under attack from 4.5% to 23.0%, and average DSR is 93.1%. Benign TSR goes from 29.9% to 26.6%. The authors state that end-to-end attack success on adaptive WA20 was eliminated; WASP's plain-goal succeeds once on Goal 0 without defense and is blocked when enabled, and Goal 1 also does not succeed without defense.
- Labeling: The authors state that all six labeling models have allowed-element precision above 93%; the authors state the highest is GPT-5.4-nano's 98.69%, with recall of 82.69%.
- Author conclusion: The authors state that when the target lies on an uncontaminated critical path, or the contaminated path has prior structural cues, deterministic labeling can avoid touching attack content and preserve most benign utility. In-permission misleading, non-text inputs, and tasks requiring all untrusted capabilities are outside current guarantees.
Related papers
- Same-Origin Policy for Agentic BrowsersDefensesarXiv