Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
PISmith — PISmith: Reinforcement Learning-based Red Teaming for Prompt Injection Defenses | Kitploit
Tools/GitHubGitHub/albert-y1n/pismith
Payload GenerationMachine LearningPapers & ResearchRed TeamingAI SecurityAdversarial Attack
GitHubalbert-y1n/pismith

PISmith

PISmith: Reinforcement Learning-based Red Teaming for Prompt Injection Defenses

View Repository
2231 month agoReviewed by Kitploit

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

PISmith: Reinforcement Learning-based Red Teaming for Prompt Injection Defenses(COLM 2026)

This is an official implementation of PISmith: Reinforcement Learning-based Red Teaming for Prompt Injection Defenses


Environment Setup

PISmith has been tested using Python 3.10 and CUDA Version: 12.9

1. Create a Python 3.10 conda environment

root@kitploit:~
conda create -n PISmith python=3.10 -y
conda activate PISmith

2. Install dependencies

root@kitploit:~
pip install -r requirements.txt

3. (Optional) Prepare the Meta-SecAlign model checkpoint

For experiments targeting the secalign defense, run the provided merge script to download and merge the base model with the SecAlign adapter:

root@kitploit:~
python merge_meta_secalign.py

This downloads meta-llama/Llama-3.1-8B-Instruct and facebook/Meta-SecAlign-8B from HuggingFace, merges them, and saves the result to checkpoints/Meta-SecAlign-8B-merged/.


Scripts

PIArena

PIArena supports training and evaluation against a range of prompt injection defenses. Use the defense argument to select the target defense.

Supported defenses: secalign, none, promptguard, promptarmor, sandwich, instructional, datasentinel, piguard, datafilter

Training

root@kitploit:~
bash scripts/train_piarena.sh <defense> [train_gpus] [target_gpu] [target_port]

Examples:

root@kitploit:~
# Train against SecAlign defense
bash scripts/train_piarena.sh secalign

# Train against no defense (plain LLM)
bash scripts/train_piarena.sh none

Evaluation

root@kitploit:~
bash scripts/eval_piarena.sh <checkpoint> <defense> [target_port] [target_gpu] [attacker_gpu] [attacker_port] [num_samples]

Examples:

root@kitploit:~
# Evaluate against SecAlign (default settings)
bash scripts/eval_piarena.sh checkpoints/piarena/checkpoint-500 secalign

# Evaluate against no piguard, pass@10
bash scripts/eval_piarena.sh checkpoints/piarena_none/checkpoint-500 piguard

AgentDojo

Supports GPT-4o-mini, GPT-4o, GPT-5-nano, and local vLLM targets.

root@kitploit:~
bash scripts/train_agentdojo.sh [target_type] [suites] [train_gpus]
root@kitploit:~
# Default: GPT-4o-mini target on the firsr 7 injected task of workspace suite
bash scripts/train_agentdojo.sh

# Train on all suites (workspace, banking, travel, slack)
bash scripts/train_agentdojo.sh gpt4o-mini all

Evaluation:

root@kitploit:~
bash scripts/eval_agentdojo.sh <checkpoint> [target_type] [eval_suites] [num_samples] [target_defense]

# Example
bash scripts/eval_agentdojo.sh checkpoints/agentdojo/checkpoint-500 gpt4o-mini

AgentDyn

AgentDyn is built on top of AgentDojo. Install it separately before running AgentDyn experiments:

root@kitploit:~
git clone https://github.com/SaFo-Lab/AgentDyn.git
cd AgentDyn
pip install -e . --no-deps

Training supports AgentDyn suites such as github, dailylife, and shopping.

root@kitploit:~
bash scripts/train_agentdyn.sh [target_type] [suites] [train_gpus]

# Example
bash scripts/train_agentdyn.sh gpt5-nano github "0,1,2,3"

Evaluation reports both pass@k and sample-level average ASR, and supports data-parallel attacker vLLM serving:

root@kitploit:~
ATTACKER_GPUS=0,1,2,3 ATTACKER_DP_SIZE=4 \
bash scripts/eval_agentdyn.sh checkpoints/agentdyn/checkpoint-500 gpt5-nano "github,dailylife,shopping" 5

InjecAgent

Supports a local vLLM target, GPT-4o-mini, or multi-target mode.

root@kitploit:~
bash scripts/train_injecagent.sh [target_type] [train_gpus] [target_gpu] [target_port]
root@kitploit:~
# Default: local vLLM target (Meta-SecAlign-8B)
bash scripts/train_injecagent.sh

# GPT-4o-mini API target
bash scripts/train_injecagent.sh gpt4o-mini

Evaluation:

root@kitploit:~
bash scripts/eval_injecagent.sh <checkpoint> [target_type] [target_gpu] [target_port] [eval_gpu] [num_samples]

# Example
bash scripts/eval_injecagent.sh checkpoints/injecagent/checkpoint-500

Experiment Results

Main Results (vs. Meta-SecAlign-8B, 13 Benchmarks)

PISmith is evaluated against 7 baselines spanning static, search-based, and RL-based attack categories. All RL-based methods report ASR@10 / ASR@1; static and search-based methods report ASR@1.

Utility–Robustness Trade-off (8 Defenses, Qwen3-4B-Instruct-2507)

PISmith ASR@1 averaged over 13 benchmarks. Utility measures task accuracy without attack.

It remains challenging for state-of-the-art defenses to simultaneously achieve high utility (≥0.70) and low ASR (≤0.60), revealing a fundamental utility–robustness trade-off.

Agentic Settings

InjecAgent

AgentDojo (best static baseline vs. PISmith)

Target ModelBest Static ASR@1PISmith ASR@10/1
GPT-4o-mini
Download Tool
ArgumentDefaultDescription
defensesecalignDefense to train against
train_gpus"1,2,3"GPU indices for RL training
target_gpu0GPU for the target vLLM server
target_port8010Port for the target vLLM server
ArgumentDefaultDescription
checkpoint—Path to trained attacker checkpoint
defensesecalignDefense to evaluate against
target_port8000Port for the target vLLM server
target_gpu0GPU for the target vLLM server
attacker_gpu1GPU for the attacker vLLM server
attacker_port8001Port for the attacker vLLM server
num_samples10Pass@k: number of samples per test case
MethodCategoryAvg. ASR@10Avg. ASR@1
DirectStatic—0.04
CombinedStatic—0.07
TAPSearch-based—0.11
PAIRSearch-based—0.16
StrategySearch-based—0.21
Vanilla GRPORL-based0.130.05
RL-HammerRL-based0.700.48
PISmith (Ours)RL-based1.000.87
DefenseTypeUtilityPISmith ASR@1
No Defense—0.740.92
SandwichPrevention0.740.91
InstructionalPrevention0.730.92
PromptArmorPrevention0.740.92
DataFilterPrevention0.630.49
PIGuardFilter0.720.82
PromptGuardFilter0.660.89
DataSentinelFilter0.550.52
Target ModelDirect ASR@1PISmith ASR@10/1
Meta-SecAlign-8B0.001.00 / 0.99
GPT-4o-mini0.021.00 / 0.99
GPT-4.1-nano0.011.00 / 1.00
GPT-5-nano0.001.00 / 0.95
0.23
0.78 / 0.62
GPT-4.1-nano0.200.81 / 0.64
GPT-5-nano0.010.38 / 0.24