A comprehensive collection of research and engineering projects for securing LLM-based Web Agents against direct prompt injection, unauthorized actions, privacy violations, and excessive agency.
Advanced Web Agent Security is a unified research and engineering repository dedicated to developing, evaluating, and improving the security of Large Language Model (LLM)-based Web Agents.
LLM-based Web Agents can interpret natural-language instructions, inspect websites, plan tasks, interact with browser interfaces, and execute actions on behalf of users. However, connecting language models to browser automation introduces security risks that extend beyond ordinary text generation.
An agent may follow adversarial instructions, abandon its original objective, execute unauthorized actions, disclose sensitive information, or retain untrusted instructions in persistent memory.
This repository addresses these challenges through 10 complementary security projects, covering prompt-injection analysis, runtime enforcement, goal verification, privacy protection, access control, monitoring, and reproducible security evaluation.
The projects share a common research direction while remaining independently organized so that each can be implemented, tested, evaluated, and extended.
Project status: Research and development. The repository defines 10 planned projects. Implementations, supported configurations, tests, and experimental results will be documented as they become available.
| No. | Project | Primary Focus |
|---|---|---|
| 1 | ActionShield | Runtime action enforcement |
| 2 | WebGuardBench | Web Agent security benchmarking |
| 3 | GoalGuard | Goal-conditioned action verification |
| 4 | LeakGuard | Sensitive data exfiltration prevention |
| 5 | SafeClick | Risk-aware human approval |
| 6 | MemoryShield | Persistent memory security |
| 7 | RedBlue Lab | Controlled attack-defense evaluation |
| 8 | WebPermit | Least-privilege browser permissions |
| 9 | AgentSentinel | Runtime monitoring and anomaly detection |
| 10 | AgentFirewall | Prompt-injection screening and instruction-conflict analysis |
- Overview
- Research Motivation
- Project Collection
- Overall Architecture
- Research Questions
- Threat Model
- Evaluation Framework
- Technology Stack
- Repository Structure
- Getting Started
- Development Roadmap
- Security and Responsible Use
- Reproducibility
- Contributing
- Research and Publications
- License
A Web Agent can transform model-generated decisions into actions that affect websites, accounts, applications, and external services.
Important security challenges include:
- Direct prompt injection: Adversarial instructions attempt to redirect an agent or override its authorized objective.
- Goal hijacking: The agent departs from the user's intended task.
- Unauthorized actions: The agent performs operations outside its granted permissions.
- Excessive agency: The agent possesses more capabilities than its task requires.
- Sensitive data exfiltration: Private information is disclosed to an unauthorized destination.
- Persistent memory contamination: Untrusted information influences future agent behavior.
- Insufficient monitoring: Security violations occur without being detected or recorded.
- Inadequate evaluation: A defense performs well on familiar scenarios but fails under different tasks or attack conditions.
The central objective of this repository is to investigate how these failures can be detected, prevented, measured, and understood.
The projects are organized around six principles:
- Instruction integrity: Distinguish authorized task requirements from conflicting or untrusted instructions.
- Goal preservation: Keep agent behavior consistent with the user's authorized objective.
- Action authorization: Check permissions before browser operations produce external effects.
- Least privilege: Give agents only the capabilities required for their tasks.
- Continuous monitoring: Record and investigate suspicious behavior.
- Reproducible evaluation: Measure both security effectiveness and legitimate task utility.
No individual mechanism is assumed to provide complete protection against every form of prompt injection.
Runtime Security and Action Enforcement for Web Agents
ActionShield aims to inspect proposed browser actions and enforce security policies before execution.
The main idea is to separate the agent's decision-making process from the mechanism that authorizes and executes external actions.
- Browser action interception.
- Authorization checks for clicking, typing, navigation, and form submission.
- Policy-based action enforcement.
- Risk assessment for sensitive operations.
- Human approval integration.
- Structured security logs.
- Explanations for blocked actions.
- Integration with GoalGuard and WebPermit.
A user asks an agent to compare three laptops. A webpage instructs the agent to purchase one immediately.
ActionShield should reject the purchase if it falls outside the user's authorization while allowing legitimate comparison tasks to continue.
Investigate whether runtime action enforcement reduces unauthorized actions while preserving legitimate task completion.
A Benchmarking Framework for Web Agent Security
WebGuardBench aims to provide a reproducible environment for evaluating security failures and comparing Web Agent defenses.
- Controlled browser tasks and test websites.
- Direct prompt-injection scenarios.
- Agent trajectory collection.
- Ground-truth authorization labels.
- Standardized security and utility metrics.
- Baseline and defense comparisons.
- Experiment configuration management.
- Reproducible evaluation reports.
Evaluate multiple Web Agents under controlled adversarial instructions. Record their proposed actions, executed actions, task outcomes, and authorization violations.
Investigate how security effectiveness varies across agents, tasks, attack conditions, and defense configurations.
A benchmark should define its task distribution, threat model, success criteria, and evaluation procedure explicitly.
Goal-Conditioned Action Verification
GoalGuard aims to determine whether a proposed browser action is consistent with the user's original objective and explicit permissions.
An action may appear reasonable in isolation while violating the user's actual goal.
- Explicit task requirement representation.
- Proposed-action verification.
- Goal-deviation detection.
- Browser-state-aware checks.
- Action authorization analysis.
- Explanations for rejected actions.
- Integration with runtime enforcement.
The user asks an agent to compare hotel prices. A webpage instructs the agent to reserve a non-refundable room.
GoalGuard should identify that making a reservation is outside the requested comparison unless the user has separately authorized it.
Investigate whether goal-conditioned verification can identify unauthorized actions more effectively than prompt-level filtering alone.
Sensitive Data Exfiltration Prevention
LeakGuard aims to prevent unauthorized disclosure of sensitive information during Web Agent execution.
- Identification of synthetic sensitive test data.
- Monitoring of supported data-entry and submission operations.
- Destination-aware disclosure policies.
- Data-flow monitoring.
- Unauthorized transfer detection.
- Privacy evaluation.
- Security event logging.
An agent is authorized to inspect profile information but is not authorized to transmit it to an unrelated external website.
LeakGuard should prevent the unauthorized transfer while preserving operations permitted by the user's task and security policy.
Investigate whether data-flow controls reduce unauthorized disclosure without unnecessarily restricting legitimate information-sharing tasks.
Risk-Aware Human Approval for Web Agents
SafeClick aims to determine when an agent may proceed automatically, when it should request user approval, and when an action should be blocked.
- Browser action risk classification.
- Configurable confirmation policies.
- Approval workflows.
- Sensitive-action detection.
- Human-readable action summaries.
- Security and usability evaluation.
- Integration with ActionShield.
An agent may browse websites and compare products automatically but require confirmation before purchasing an item or changing account settings.
Investigate how risk-aware approval mechanisms reduce unauthorized actions while minimizing unnecessary interruptions and task delays.
Security and Provenance for Web Agent Memory
MemoryShield aims to protect persistent agent memory from untrusted instructions and information.
- Information provenance tracking.
- Trusted and untrusted information labels.
- Memory-write authorization policies.
- Detection of suspicious persistent instructions.
- Separation of user-approved preferences from webpage content.
- Cross-session security evaluation.
- Memory access and modification logs.
An agent encounters an adversarial instruction during one browsing session that attempts to influence future sessions.
MemoryShield should prevent untrusted webpage content from becoming an authoritative persistent instruction.
Investigate whether provenance-aware memory controls reduce persistent prompt-injection risks without preventing useful information retention.
Controlled Attack and Defense Evaluation
RedBlue Lab aims to provide an isolated environment for testing attack scenarios and comparing defensive mechanisms.
- Controlled prompt-injection scenarios.
- Configurable adversarial conditions.
- Attack and defense comparisons.
- Agent trajectory analysis.
- Defense configuration management.
- Automated experiment reports.
- Security regression testing.
Evaluate an agent without an additional defense and then with different security mechanisms enabled.
Compare attack success, unauthorized actions, legitimate task completion, and execution overhead.
Investigate which conditions expose weaknesses in existing defenses and whether improved mechanisms generalize to previously unseen scenarios.
All experiments should use authorized, controlled environments.
Least-Privilege Browser and Tool Authorization
WebPermit aims to limit an agent to the browser capabilities required for its current task.
- Explicit browser permission policies.
- Task-scoped authorization.
- Website-scoped authorization.
- Permissions for reading, typing, submitting, downloading, and modifying information.
- Runtime authorization checks.
- Permission-denial logging.
- Policy testing and auditing.
An agent authorized to read product information should not automatically receive permission to purchase products or modify account settings.
WebPermit should reject operations outside the granted permission scope.
Investigate how least-privilege controls limit the impact of prompt injection, including cases where the model proposes an unauthorized action.
Runtime Monitoring, Anomaly Detection, and Security Auditing
AgentSentinel aims to monitor agent execution and identify suspicious behavior, policy violations, and unexpected changes in action patterns.
Unlike ActionShield, which focuses on enforcing decisions before execution, AgentSentinel focuses on observing execution, identifying security-relevant events, and generating audit records.
- Browser action and trajectory monitoring.
- Security event collection.
- Detection of unexpected action sequences.
- Goal-deviation alerts.
- Repeated authorization-failure detection.
- Anomaly scoring.
- Audit trails and incident reports.
- Integration with WebGuardBench and RedBlue Lab.
An agent repeatedly navigates away from the requested task, attempts sensitive operations, and encounters multiple permission denials.
AgentSentinel should flag the suspicious sequence, preserve the relevant audit events, and support investigation of the agent's behavior.
Investigate whether trajectory-aware monitoring can detect security-relevant behavior that is missed by isolated action checks.
Detection quality should be evaluated against labeled benign and adversarial trajectories, including false-positive rates.
Prompt-Injection Screening and Instruction-Conflict Analysis
AgentFirewall aims to inspect relevant instruction and context boundaries for suspicious content, conflicting requirements, and attempts to redirect the agent away from its authorized task.
It complements GoalGuard and ActionShield by focusing on instruction and context analysis rather than relying exclusively on browser-action enforcement.
- Instruction and context inspection.
- Identification of suspicious instruction patterns.
- Detection of conflicts with established task requirements.
- Instruction provenance labels where available.
- Risk scoring for conflicting or suspicious instructions.
- Policy-based warnings or escalation.
- Integration with GoalGuard and ActionShield.
- Evaluation against benign instructions and adversarial examples.
The user asks an agent to compare products without making a purchase. The agent encounters a suspicious instruction that attempts to override that restriction.
AgentFirewall should identify the conflict and flag it for the applicable policy or verification mechanism.
Investigate how instruction-conflict analysis contributes to prompt-injection resistance and whether it can improve security beyond action-level controls alone.
AgentFirewall should not assume that every direct user instruction is malicious. Its analysis must be grounded in the authorized task, applicable instruction hierarchy, and explicit security policies.
The proposed architecture separates instruction analysis, agent reasoning, action authorization, execution, and monitoring.
USER TASK
|
v
+----------------------+
| AgentFirewall |
| |
| Instruction Analysis|
| Conflict Detection |
+----------------------+
|
v
+----------------------+
| LLM-Based Agent |
| |
| Observe |
| Reason |
| Plan |
| Propose Action |
+----------------------+
|
v
+----------------------+
| Proposed Browser |
| Action |
+----------------------+
|
v
+-------------------------------------------+
| SECURITY ENFORCEMENT |
| |
| GoalGuard: Goal Verification |
| WebPermit: Permission Checking |
| LeakGuard: Data-Flow Protection |
| SafeClick: Human Approval |
| ActionShield: Runtime Enforcement |
+-------------------------------------------+
|
v
Authorization Decision
/ \
v v
ALLOW DENY
| |
v v
Browser Execution Block or Review
| |
+------+------+
|
v
+----------------------+
| AgentSentinel |
| |
| Monitoring |
| Anomaly Detection |
| Security Audit |
+----------------------+
|
v
+----------------------+
| Evaluation Framework |
| |
| WebGuardBench |
| RedBlue Lab |
+----------------------+
MemoryShield protects persistent
agent state throughout execution.
This architecture is a design proposal. Actual enforcement guarantees depend on implementation details, browser interception coverage, and policy correctness.
- Instruction integrity: Analyze conflicting instructions in the context of the authorized task.
- Separation of reasoning and enforcement: The model proposes actions; security mechanisms independently check authorization.
- Explicit authorization: The user's task and permissions define the allowed scope of execution.
- Pre-execution checks: Prevent external effects whenever reliable interception is possible.
- Defense in depth: Combine complementary controls without assuming they are interchangeable.
- Continuous monitoring: Record security-relevant events and suspicious behavior.
- Auditability: Preserve relevant decisions and execution outcomes.
- Measurable effectiveness: Evaluate security, utility, false positives, and runtime overhead.
The repository supports the following research directions.
- Instruction Integrity: How can conflicting or adversarial instructions be identified without unnecessarily blocking legitimate user requests?
- Goal Deviation: At what point in an execution trajectory does behavior become inconsistent with the authorized objective?
- Runtime Prevention: Can unauthorized browser actions be prevented before they produce external effects?
- Direct Prompt Injection: How do adversarial instructions influence agent decisions, and which defenses remain effective when the model follows them?
- Least-Privilege Security: How much can restricted browser capabilities reduce the impact of successful prompt injection?
- Privacy Protection: How can sensitive information be prevented from reaching unauthorized destinations?
- Persistent Memory: Can provenance-aware memory policies prevent untrusted information from influencing future behavior?
- Runtime Monitoring: Can trajectory-aware monitoring identify security violations missed by isolated action checks?
- Generalization: Do defenses remain effective across different tasks, websites, models, and agent architectures?
- Security–Utility Trade-Off: How can stronger protection be achieved without excessive false blocking, task failures, or runtime overhead?
These are research questions, not claims that the repository has already answered them.
Individual research papers should focus on a well-defined problem, a defensible research gap, an explicit threat model, and experimentally supported contributions.
The initial threat model focuses on direct prompt injection against LLM-based Web Agents and the consequences of unauthorized action execution.
- User-authorized task objectives.
- Browser sessions and account permissions.
- Sensitive information accessible to the agent.
- Integrity of external actions performed on the user's behalf.
- Persistent agent memory.
- Integrity of the agent's execution process.
Depending on the experiment, an attacker may attempt to:
- Supply adversarial instructions through a defined input channel.
- Redirect the agent away from its original task.
- Induce unauthorized browser actions.
- Exploit excessive agent permissions.
- Cause unauthorized disclosure of sensitive information.
- Influence persistent agent memory through untrusted content.
Each experiment must specify the attacker's capabilities and access to the agent, browser, and external environment.
The initial system assumes that:
- The original task can be represented sufficiently for the selected verification method.
- Security policies can define relevant authorization boundaries.
- Browser actions can be intercepted at supported execution points.
- The test environment provides observable execution outcomes.
- Ground-truth labels can distinguish authorized from unauthorized actions.
- The evaluation procedure can identify successful malicious objectives.
These assumptions may not hold universally and must be tested.
The initial prototype does not claim to defend against:
- Fully compromised operating systems or browsers.
- Malicious browser extensions with unrestricted privileges.
- Complete compromise of the underlying language model.
- Every form of indirect prompt injection.
- Every possible side channel or browser vulnerability.
- Attacks that bypass the implemented interception points.
A successful evaluation within the stated threat model does not establish universal protection against prompt injection.
The evaluation framework measures security effectiveness and legitimate task utility together.
| Metric | Purpose |
|---|---|
| Attack Success Rate (ASR) | Measures how often an attack achieves its predefined malicious objective. |
| Unauthorized Action Rate (UAR) | Measures how frequently unauthorized actions are executed. |
| Legitimate Task Success Rate | Measures successful completion of benign tasks. |
| False Blocking Rate | Measures legitimate actions incorrectly blocked by a defense. |
| Detection Precision | Measures the accuracy of security-violation detections. |
| Detection Recall | Measures the proportion of actual violations detected. |
| Detection F1 | Summarizes detection precision and recall. |
| Runtime Overhead | Measures additional latency introduced by the defense. |
| Recovery Rate | Measures recovery from defined attack-induced deviations. |
| Sensitive Data Leakage Rate | Measures unauthorized disclosure in controlled privacy tests. |
| Monitoring Detection Rate | Measures the proportion of labeled security incidents identified by monitoring. |
| Alert False-Positive Rate | Measures benign events incorrectly flagged as security incidents. |
Metric definitions, trial counts, and evaluation procedures must be specified for each experiment.
Attack success and unauthorized action are distinct outcomes and should not be treated as interchangeable.
Where applicable, evaluations should include:
- Baseline comparisons.
- Security effectiveness tests.
- Legitimate task completion tests.
- Ablation studies.
- Robustness tests.
- Generalization to unseen scenarios.
- Runtime and resource measurements.
- Monitoring false-positive analysis.
- Evaluation of interactions between defense modules.
Results should include appropriate sample counts, uncertainty estimates, and limitations.
No performance improvement should be claimed until the corresponding experiments have been completed.
The initial development stack is expected to include:
| Component | Technology | Purpose |
|---|---|---|
| Programming language | Python | Core implementation |
| Browser automation | Playwright | Browser interaction |
| Agent orchestration | LangGraph or a custom agent loop | Agent execution |
| Evaluation environments | BrowserGym and compatible environments | Web task evaluation |
| Backend API | FastAPI | Optional service interfaces |
| Dashboard | Streamlit | Experimental visualization |
| Testing | pytest | Unit and integration testing |
| Configuration | YAML / JSON | Policies and experiment settings |
| Version control | Git | Source management |
| Repository hosting | GitHub | Collaboration and reproducibility |
Final dependencies and supported versions will be documented as implementations become available.
All 10 projects will be maintained under one GitHub repository, with a dedicated directory for each project.
advanced-web-agent-security/
│
├── projects/
│ ├── actionshield/
│ ├── webguardbench/
│ ├── goalguard/
│ ├── leakguard/
│ ├── safeclick/
│ ├── memoryshield/
│ ├── redblue-lab/
│ ├── webpermit/
│ ├── agent-sentinel/
│ └── agent-firewall/
│
├── shared/
│ ├── agent_adapters/
│ ├── browser/
│ ├── policies/
│ ├── logging/
│ ├── monitoring/
│ └── evaluation/
│
├── benchmarks/
│ ├── tasks/
│ ├── attacks/
│ ├── expected_outcomes/
│ └── results/
│
├── configs/
│ ├── agents/
│ ├── policies/
│ └── experiments/
│
├── tests/
│ ├── unit/
│ ├── integration/
│ └── security/
│
├── docs/
│ ├── architecture/
│ ├── threat_model/
│ ├── methodology/
│ └── experiments/
│
├── scripts/
├── requirements.txt
├── .gitignore
├── LICENSE
└── README.md
This structure is a starting point. Directories and shared utilities should be introduced incrementally as the corresponding implementations are developed.
The initial development environment is expected to require:
- Python 3.11 or another explicitly supported Python version.
- Git.
- Playwright and a compatible browser.
- An LLM endpoint or locally available model for agent experiments.
- An authorized test environment.
Exact version requirements will be documented as implementation progresses.
Open your GitHub repository, select Code → HTTPS, and copy the repository URL.
Run:
git clone <your-repository-url>
cd advanced-web-agent-securityReplace <your-repository-url> with the URL copied from GitHub.
Linux or macOS:
python3 -m venv .venv
source .venv/bin/activateWindows PowerShell:
python -m venv .venv
.venv\Scripts\Activate.ps1After requirements.txt has been populated with tested dependencies:
python -m pip install --upgrade pip
pip install -r requirements.txtAfter Playwright has been included in the dependencies:
playwright install chromiumOnce the test suite is available:
python -m pytest tests/ -vThese commands describe the intended development workflow. They do not imply that every project, dependency, or test suite is already implemented.
Project-specific installation instructions should be added to the README inside each project directory as its implementation becomes available.
- Define the threat model and authorization boundaries.
- Establish the repository structure.
- Integrate a baseline Web Agent.
- Create controlled local websites and benign tasks.
- Record browser observations and action trajectories.
- Define initial evaluation metrics.
- Implement ActionShield.
- Develop the initial GoalGuard verifier.
- Implement WebPermit authorization policies.
- Add security decision logging.
- Test authorized and unauthorized actions.
- Develop AgentFirewall.
- Define instruction-conflict test cases.
- Evaluate false positives on benign instructions.
- Integrate relevant policy checks with GoalGuard.
- Test defenses against controlled direct prompt-injection scenarios.
- Develop WebGuardBench task definitions.
- Implement AgentSentinel monitoring.
- Establish ground-truth authorization labels.
- Implement metric calculations.
- Integrate RedBlue Lab.
- Compare baseline and defended agents.
- Develop LeakGuard.
- Implement SafeClick.
- Investigate MemoryShield.
- Test interactions between security modules.
- Add security regression tests.
- Conduct ablation studies.
- Evaluate robustness across attack conditions.
- Measure security–utility trade-offs.
- Evaluate generalization to unseen scenarios.
- Document reproducible experiment configurations.
- Publish validated findings and implementation limitations.
Progress should be tracked for each project independently. Features should be marked complete only after implementation and relevant testing.
This repository is intended for authorized security research, defensive engineering, and controlled evaluation.
- Prefer local mock websites and synthetic accounts.
- Do not test against third-party services without authorization.
- Do not use real credentials or unnecessary personal information in experiments.
- Isolate adversarial scenarios from production systems.
- Use synthetic data for privacy and exfiltration testing.
- Document threat models and assumptions.
- Report false positives, false negatives, and known limitations.
- Avoid claims of complete protection based on limited experiments.
The effectiveness of a security mechanism depends on its implementation, policy correctness, threat model, and evaluation coverage.
Each completed experiment should document:
- Agent model and version.
- Browser and execution environment.
- Task and attack configurations.
- Defense settings and thresholds.
- Dataset and sampling procedure.
- Metric definitions.
- Random seeds where applicable.
- Number of evaluation trials.
- Raw or appropriately sanitized results.
- Statistical uncertainty and limitations.
Experiment configurations should be version-controlled so that results can be reproduced and compared.
Credentials, secrets, and private user information must not be included in published artifacts.
Contributions are welcome in:
- Web Agent security research.
- Direct prompt-injection evaluation.
- Runtime policy enforcement.
- Browser permission systems.
- Sensitive data protection.
- Memory security.
- Security monitoring and anomaly detection.
- Benchmark development.
- Testing and reproducibility.
- Documentation and software engineering.
Before contributing a new project, document its security problem, threat model, technical approach, interfaces, evaluation plan, and relationship to existing modules.
Contributions should follow the repository's coding, testing, and documentation practices as they are introduced.
This repository supports research into trustworthy LLM-based Web Agents, direct prompt injection, runtime enforcement, privacy protection, and reproducible security evaluation.
Potential research topics include:
- Action-level security enforcement.
- Goal-conditioned verification of browser actions.
- Detection and measurement of goal deviation.
- Least-privilege defenses against direct prompt injection.
- Privacy-aware Web Agent execution.
- Persistent memory security.
- Trajectory-aware security monitoring.
- Instruction-conflict analysis.
- Security–utility trade-offs in autonomous Web Agents.
Publications, technical reports, and validated implementations will be linked here as they become available.
Research novelty should be established through a review of relevant prior work and supported by experimental evidence.
This project is licensed under the MIT License.
Copyright (c) 2026 Advanced Web Agent Security contributors
To develop practical, measurable, and reproducible security mechanisms that help LLM-based Web Agents remain within their authorized objectives, even when confronted with adversarial instructions.
Advanced Web Agent Security brings 10 complementary projects together under one repository, providing a foundation for continued software development, rigorous security evaluation, and future research contributions.