Test LLMs for prompt injection vulnerabilities
Runs Meta's CyberSecEval benchmark in promptfoo to test LLMs for prompt injection vulnerabilities.
0.121.18Add to Favorites
Why it matters
Run Meta's CyberSecEval benchmark to systematically test large language models for prompt injection vulnerabilities and security weaknesses, helping teams identify and mitigate risks before deploying AI systems in production.
Outcomes
What it gets done
Execute CyberSecEval test cases against multiple LLM providers
Configure and run prompt injection vulnerability assessments
Compare security performance across different models
Generate detailed reports on prompt injection susceptibility
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/pfoo-redteam-cyberseceval | bash Steps
Steps in the chain
Overview
Redteam Cyberseceval
Runs Meta's CyberSecEval (PurpleLlama) prompt injection benchmark against multiple LLM providers via promptfoo to assess vulnerability. Use when red-teaming an LLM against Meta's CyberSecEval prompt injection benchmark before deployment.
What it does
This promptfoo example runs Meta's CyberSecEval benchmark to test LLMs for prompt injection vulnerabilities. Models are configured in promptfooconfig.yaml across multiple providers:
providers:
- openai:gpt-4o # OpenAI
- anthropic:messages:claude-sonnet-4-6 # Anthropic
- ollama:chat:llama3.3 # Ollama
- replicate:meta/llama-2-70b-chat # Replicate
When to use - and when NOT to
Use this example when red-teaming an LLM against Meta's CyberSecEval prompt injection benchmark to assess vulnerability before deployment.
Inputs and outputs
Run via npx promptfoo@latest init --example redteam-cyberseceval, npm install, then npx promptfoo eval for the full test set or npx promptfoo eval --filter-sample 30 for a sampled subset, followed by npx promptfoo view to inspect results. Three files structure the example: promptfooconfig.yaml (main configuration), prompt.json (the system prompt given to the model under test), and prompt_injection.json (the CyberSecEval prompt injection test cases themselves).
Integrations
Built on Meta's CyberSecEval / PurpleLlama prompt injection benchmark, tested here across OpenAI, Anthropic, Ollama, and Replicate providers. Points to the CyberSecEval documentation, the prompt injection benchmark reference, and a full tutorial on the promptfoo blog for further detail.
Who it's for
Security and LLM evaluation teams red-teaming a model's resistance to prompt injection attacks using Meta's standardized CyberSecEval benchmark, across any of several provider backends, rather than writing prompt injection test cases from scratch.
Source README
redteam-cyberseceval (CyberSecEval Example)
You can run this example with:
npx promptfoo@latest init --example redteam-cyberseceval
cd redteam-cyberseceval
This example shows how to run Meta's CyberSecEval benchmark to test LLMs for prompt injection vulnerabilities.
Setup
- Install dependencies:
npm install
- Configure your model in
promptfooconfig.yaml:
providers:
- openai:gpt-4o # OpenAI
- anthropic:messages:claude-sonnet-4-6 # Anthropic
- ollama:chat:llama3.3 # Ollama
- replicate:meta/llama-2-70b-chat # Replicate
Usage
Run all tests:
npx promptfoo eval
Run a sample of tests:
npx promptfoo eval --filter-sample 30
View results:
npx promptfoo view
Configuration
The example includes:
promptfooconfig.yaml: Main configuration fileprompt.json: System prompt for the modelprompt_injection.json: CyberSecEval test cases
Learn More
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.