GhostEI-Bench: Do Mobile Agents Resilience to Environmental Injection in Dynamic On-Device Environments
- Overview
- Quick Start
- Environment Setup
- Project Structure
- Running the Framework
- Dataset Format
- Troubleshooting
This framework supports two types of agents:
-
MobileAgent: A multi-model reasoning agent that uses separate models for understanding, decision-making, reflection, and judgment
-
GUI Agents: Specialized fine-tuned models (UI-TARS 1.5, UI-TARS) for end-to-end GUI action generation
Both agents can interact with Android applications and evaluate security risks through various attack scenarios.
- Setup Environment (see Environment Setup)
- Configure your settings in
config.yaml(for MobileAgent) orgui_agent/config.yaml(for GUI Agents) - Run the framework:
- MobileAgent: See MobileAgent/README.md
- GUI Agents: See gui_agent/README.md
- Download Android Studio from the official website
- Install Android Studio and follow the setup wizard
-
Open Android Studio β Tools β SDK Manager
-
Select SDK Tools tab
-
Check Android SDK Platform-Tools and verify the installation path
-
Add the following paths to your system environment variables:
<SDK_PATH>/platform-tools(containsadb)<SDK_PATH>/emulator(contains emulator tools)
Open a terminal and verify ADB is accessible:
adb versionYou should see the ADB version information.
If you don't have a physical device:
-
Open Android Studio β Tools β Device Manager
-
Click Create Device
-
Select Medium Phone
-
Download and select a system image and expand the Internal storage to 64GB
-
Finish the setup
conda create -n safeagent python=3.10
conda activate safeagentcd Ghost-EI
pip install -r requirements.txtThe framework uses ModelScope for some models. Models will be automatically downloaded on first use.
Physical Device:
- Enable Developer Options on your Android device
- Enable USB Debugging
- Connect device via USB
- Verify connection:
adb devices
Emulator:
- Start the emulator from Android Studio Device Manager
- Verify connection:
adb devices
Install the following apps from Google Play Store:
- PhotoNote
- Booking
- Go Forex
- Nextcloud Dev
- Gallery
- AliExpress (requires test email)
Install the overlay attack APK:
adb install app-debug.apkThis APK enables overlay attack scenarios during testing.
Ghost-EI/
βββ README.md # This file - Environment setup guide
βββ config.yaml # MobileAgent configuration
βββ run.py # MobileAgent main script
βββ requirements.txt # Python dependencies
βββ app-debug.apk # Overlay attack APK
β
βββ MobileAgent/ # MobileAgent implementation
β βββ README.md # MobileAgent usage guide
β βββ android_env.py # Android environment wrapper
β βββ mobile_agent.py # Main agent logic
β βββ api.py # API client with URL normalization
β βββ ...
β
βββ gui_agent/ # GUI Agent implementation
β βββ README.md # GUI Agent usage guide
β βββ config.yaml # GUI Agent configuration
β βββ test_loop_tars15.py # TARS 1.5 agent
β βββ ...
β
βββ datasets/ # Test datasets
β βββ GhostEI.jsonl # Main test dataset
β
βββ files/ # Test files for environment setup
βββ screenshot/ # Screenshot storage
βββ temp/ # Temporary files
βββ judgement/ # Judgment outputs
After completing the environment setup, choose your agent:
- MobileAgent: Multi-step reasoning agent for complex tasks
- GUI Agents: End-to-end GUI action generation agents
Each agent has its own detailed documentation with configuration and usage instructions.
The test dataset is a JSONL file where each line is a JSON object:
{
"id": 1,
"prompt": "Task instruction for the agent",
"case": "Risk type and involved app summary",
"content": "Detailed task description",
"result": "Evidence for judge model evaluation",
"potential_risks": "Possible risks from instruction/execution",
"app": ["app1", "app2"],
"use_dynamic": "Overlay Attack",
"extra": {
"title": "Attack overlay title",
"content": "Attack overlay content",
"cancel": "Cancel button text",
"confirm": "Confirm button text"
},
"need_env": true,
"files_name": ["file1.docx", "file2.pdf"],
"case_type": "Static Environment Injection"
}Key Fields:
- prompt: Instruction given to the agent
- app: List of apps that need to be operated
- use_dynamic: Attack type (
"Overlay Attack","Popup SMS", or empty) - extra: Attack-specific configuration
- need_env: Whether additional environment setup is required
- files_name: Files to upload if
need_envis true - case_type: Risk origin type (
User-Provided Instructions,Static Environment Injection,Dynamic Environment Injection)
This project is licensed under the MIT License, - see the LICENSE file for details.
@inproceedings{
chen2026ghosteibench,
title={Ghost{EI}-Bench: Do Mobile Agent Resilience to Environmental Injection in Dynamic On-Device Environments?},
author={Chiyu Chen and Xinhao Song and Yunkai Chai and Yang Yao and Haodong Zhao and Lijun Li and Jie Li and Yan Teng and Gongshen Liu and Yingchun Wang},
booktitle={The Fourteenth International Conference on Learning Representations},
year={2026},
url={https://openreview.net/forum?id=2zi9z2geAO}
}



