Skip to content
KitploitKITPLOIT
工具漏洞利用博客
Log in
提交
工具漏洞利用博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
WAInjectBench — 针对 Web 代理的提示注入检测基准测试。 | Kitploit
工具/GitHubGitHub/norrrrrrr-lyn/wainjectbench
漏洞分析Web安全机器学习论文与研究学习与教育AI 安全对抗性攻击
GitHubnorrrrrrr-lyn/wainjectbench

WAInjectBench

针对 Web 代理的提示注入检测基准测试。

查看仓库
234472个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

WAInjectBench

WAInjectBench 是一个面向 Web 智能体中提示注入检测的综合基准。 它涵盖6 种攻击类型,跨越两种模态:文本和图像。


📂 数据集结构

  • data/
    • text/
      • benign/ → 4 个类别,以 JSONL 文件存储
      • malicious/ → 8 种攻击类型,以 JSONL 文件存储
    • image/
      • benign/ → 2 个类别,存储在子文件夹中
      • malicious/ → 7 种攻击类型,存储在子文件夹中

⚙️ 安装

克隆仓库并创建环境:

root@kitploit:~
git clone https://github.com/Norrrrrrr-lyn/WAInjectBench.git
cd WAInjectBench
conda env create -f environment.yml
conda activate wainjectbench

🚀 评估

WAInjectBench 支持两种评估流程:基于文本的检测和基于图像的检测。

🔹 基于文本的检测

root@kitploit:~
python main_text.py \
  --data_dir [path to text dataset] \
  --detector [detector name] \
  --result_dir [output path] \
  --gpu [gpu id]

可用检测器: ["kad", "promptarmor", "embedding-t", "promptguard", "datasentinel", "ensemble"]

PromptArmor → 需要将 OPENAI_API_KEY 设置为环境变量。

DataSentinel →

root@kitploit:~
git clone https://github.com/liu00222/Open-Prompt-Injection.git

将预训练模型下载到:WAInjectBench/Open-Prompt-Injection/DataSentinel_Models 在 detector_text/datasentinel.py 中设置目录和模型路径。

🔹 基于图像的检测

root@kitploit:~
python main_image.py \
  --data_dir [path to image dataset] \
  --detector [detector name] \
  --result_dir [output path] \
  --gpu [gpu id]

可用检测器: ["gpt-4o-prompt", "llava-1.5-7b-prompt", "jailguard", "embedding-i", "llava-1.5-7b-ft", "ensemble"]

GPT-4o-Prompt → 需要将 OPENAI_API_KEY 设置为环境变量。

JailGuard →

root@kitploit:~
git clone https://github.com/shiningrain/JailGuard.git

按照其 README 配置 MiniGPT4。

LLaVA-1.5-7B-FT → 需要下载我们微调后的模型,并在 detector_image/llava.py 中设置其路径。

🔹 域内泛化

我们还提供了 Embedding-T 和 Embedding-I 模型的域内训练版本,位于 model/embedding-t/in-domain 和 model/embedding-i/in-domain。要使用它们,请遵循与主实验相同的评估流程,但需更新 detector_text/embedding-t.py 和 detector_image/embedding-i.py 中的模型路径。

🏋️ 训练

我们提供了用于训练基于嵌入的文本和图像二分类器的代码。

文本嵌入分类器

root@kitploit:~
python train/embedding-t.py \
  --input_dir [dir with training text jsonl files] \
  --output_dir [model output path]

JSONL 格式:

root@kitploit:~
{"text": "example", "label": 1}   # 1 for malicious, 0 for benign

图像嵌入分类器

root@kitploit:~
python train/embedding-i.py \
  --input_dir [dir with training image jsonl files] \
  --output_dir [model output path]

JSONL 格式:

root@kitploit:~
{"path": "path/to/image.png", "label": 1}

微调 LLaVA-1.5-7B

root@kitploit:~
python train.py \
  --train_jsonl train.jsonl \
  --val_jsonl val.jsonl \
  --use_lora \
  --amp_dtype bf16 \
  --device_mode single \
  --gpu_id 0

JSONL 文件应包含图像路径和标签(1 = 恶意,0 = 良性)。 我们论文中的实验使用默认超参数。

下载工具