Skip to main content

BrowserGym extensions for DoomArena

Project description

BrowserGym+ AgentLab Threat Models

This repository contains tools and scripts for defining and testing threat models in the BrowserGym + AgentLab agentic framework. It allows researchers and developers to evaluate the security posture of LLM-powered web agents against various attack vectors such as security warning popups and malicious banner attacks.

Overview

The framework provides a structured way to:

  • Simulate various attack scenarios against web agents
  • Measure attack success rate (ASR), task success rate (TSR), and attack stealth rate
  • Evaluate different LLM models' robustness against these attacks
  • Generate comprehensive reports of attack effectiveness

This toolkit specifically focuses on testing agents in the BrowserGym setting.

Installation

  1. Clone this repository
  2. Install the required dependencies:
pip install -r bgym_requirements.txt

Usage

You can run any of the following experiment scripts to test different attack scenarios:

  • run_banner_attack_webarena_reddit_notext.py - Test banner attacks without text
  • run_banner_with_alt_text_attack_webarena_reddit.py - Test banner attacks with alt text
  • run_popup_attack_webarena_reddit.py - Test security warning popup attacks
  • run_bgym_experiment.py - Run a general BrowserGym experiment with customizable parameters

For example:

python -m scripts.browsergym.scripts.run_bgym_experiment

Experiment Configuration Parameters

When running experiments, you can customize various parameters to configure how the tests are executed. Here's an explanation of the key parameters that can be set:

# Example usage:
run_bgym_experiment(
    base_url="http://webarena2.eastus.cloudapp.azure.com",
    bgym_experiments=bgym_experiments,
    relaunch=False,
    n_jobs=0,  # set to 1 for headless, more for parallel headless with "ray"
    max_steps=15,  # lower for faster testing, use 15 for full task
    skip_reset_and_massage=True,
)
  • base_url: The URL of the BrowserGym server where the experiments will run.

  • bgym_experiments: A list of experiment configurations defining which benchmarks, tasks, agents, and attacks to run.

  • relaunch: When set to True, forces rerunning of experiments even if results already exist but were aborted. Default is False to avoid duplicate runs.

  • n_jobs: Controls parallelization of experiment execution:

    • 0: Runs with visible browser UI (non-headless mode); useful for demo/debugging
    • 1: Runs in headless mode (no UI) with a single process
    • >1: Runs in parallel headless mode using Ray with the specified number of workers
  • max_steps: Maximum number of steps each agent is allowed to take per task. Lower values (5-10) are useful for quick testing, while higher values (30) are recommended for full task completion evaluation.

  • skip_reset_and_massage: When set to True, skips environment reset to speed up debugging. This should always be set to False when making experiments.

Results

Experiment results are stored in the results/browsergym directory, organized by the datetime when they were created. Each results directory contains:

  • Detailed information about benchmarks, attacks, and tasks
  • CSV files with metrics including:
    • Attack Success Rate (ASR)
    • Task Success Rate (TSR)
    • Attack Stealth Rate
    • Input/output token usage
    • Step counts
    • Agent model information

You can drill down into individual tasks using standard BrowserGym tools to further analyze agent behavior during the attacks.

Attack Types

The framework currently supports several attack types:

  1. Security Warning Popup Attacks - Simulates malicious popups that attempt to deceive agents
  2. Banner Attacks - Tests agents against misleading banner elements
  3. SVG Attacks - Evaluates agent behavior with potentially malicious SVG elements

Project Structure

├── README.md
├── __init__.py
├── attack_gateway.py
├── attack_scripts.py
├── attacked_browser_env_args.py
├── bgym_requirements.txt
├── init_scripts.py
├── scripts
│   ├── __init__.py
│   ├── bgym_analysis.py
│   ├── run_banner_attack_webarena_reddit_notext.py
│   ├── run_banner_with_alt_text_attack_webarena_reddit.py
│   ├── run_bgym_experiment.py
│   ├── run_parallel_bgym_experiment.py
│   ├── run_popup_attack_webarena_reddit.py
│   ├── sweep_bgym.py
│   └── test_task.py
└── webarena_subsets.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

doomarena_browsergym-0.0.1.tar.gz (42.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

doomarena_browsergym-0.0.1-py3-none-any.whl (46.6 kB view details)

Uploaded Python 3

File details

Details for the file doomarena_browsergym-0.0.1.tar.gz.

File metadata

  • Download URL: doomarena_browsergym-0.0.1.tar.gz
  • Upload date:
  • Size: 42.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for doomarena_browsergym-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9cac1ff270ad4eb8cc8ada8b020ebaa3c78dcfb14e7d80bf51061e72d0fac77f
MD5 f19a295c9f8bcfe56943170b146a29da
BLAKE2b-256 6a09df0b425e64b0e839f547d3441970978f318009395f6a340f4672e88a07ac

See more details on using hashes here.

File details

Details for the file doomarena_browsergym-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for doomarena_browsergym-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 98ede1077a552ea9b93b466333dedba282b3757f31a575d072d2a115e829d590
MD5 ead7d9917826143b6b93e69103211f97
BLAKE2b-256 a9f8e91edbf47c54c345451b6f7ca610d6e532c6dfb0f8f3ee3f12c00e36c38f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page