superred-optimizer-poisonedrag
A PoisonedRAG knowledge-corruption optimizer for the superred red-teaming framework.
PoisonedRAG attacks retrieval-augmented generation (RAG) systems by poisoning their knowledge base. It crafts a small number of malicious documents designed to be retrieved for a target question and to steer the model toward an attacker-chosen answer. The model is never asked to misbehave directly — the corrupted context does the work.
Reference: Zou et al., "PoisonedRAG: Knowledge Corruption Attacks to
Retrieval-Augmented Generation of Large Language Models,"
arXiv:2402.07867 (USENIX Security 2025).
Official implementation:
sleeepeer/PoisonedRAG (MIT License).
See ASSUMPTIONS.md for the full paper-to-code mapping and every
deliberate departure.
Install
pip install superred-optimizer-poisonedrag
Usage
from poisonedrag_optimizer import PoisonedRAGOptimizer
# Defaults match the released code (adv_per_query=5, top_k=5, LM_targeted).
# Set max_attempts=1 for the paper's single-shot poison batch (paper-parity ASR).
optimizer = PoisonedRAGOptimizer(max_attempts=1)
# Load bundled official attack results for a benchmark.
optimizer = PoisonedRAGOptimizer(official_adv_results_dataset="nq")
Wire it into a Controller like any other superred optimizer — see the
framework's architecture overview and a
target's README (e.g. superred-target-chatbot) for a full Controller.run() example.
License
MIT for this port's code (see LICENSE). The upstream reference
implementation, sleeepeer/PoisonedRAG,
is MIT licensed. The bundled official attack-result datasets originate from that
repository; its MIT copyright notice is preserved in NOTICE and
LICENSES/PoisonedRAG-MIT.txt. This port
reimplements the attack against superred's event model rather than vendoring
upstream runtime source.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file superred_optimizer_poisonedrag-0.1.0.tar.gz.
File metadata
- Download URL: superred_optimizer_poisonedrag-0.1.0.tar.gz
- Upload date:
- Size: 124.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
654abd7130f76c40c33af01f6445d0421fdecd030bb1769ac4cefa427e99c1ff
|
|
| MD5 |
56fea6e8033e233c51fe43f65f29d4bb
|
|
| BLAKE2b-256 |
d37f78ff8475d2f0e72cdfb6c3782248eee62dcaaefcbd73d9faa43344182f42
|
Provenance
The following attestation bundles were made for superred_optimizer_poisonedrag-0.1.0.tar.gz:
Publisher:
release.yml on RoldSI/superred-modules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superred_optimizer_poisonedrag-0.1.0.tar.gz -
Subject digest:
654abd7130f76c40c33af01f6445d0421fdecd030bb1769ac4cefa427e99c1ff - Sigstore transparency entry: 2227834175
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@be1b4b03c78de2bec30d03265fcbd35605d2bd0e -
Branch / Tag:
refs/tags/superred-optimizer-poisonedrag-v0.1.0 - Owner: https://github.com/RoldSI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@be1b4b03c78de2bec30d03265fcbd35605d2bd0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl
- Upload date:
- Size: 119.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a210296aabd8fb19b02149a85be40bb3a1c9fe7debc0ebcf6d8b597040671fdd
|
|
| MD5 |
9c4888590be7a031f5d3aea9fd6df3e7
|
|
| BLAKE2b-256 |
aed44dfc84b97a9ed0ff8ed7478be4167c579a2238d35dc6efd09a8f2d36ba87
|
Provenance
The following attestation bundles were made for superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl:
Publisher:
release.yml on RoldSI/superred-modules
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl -
Subject digest:
a210296aabd8fb19b02149a85be40bb3a1c9fe7debc0ebcf6d8b597040671fdd - Sigstore transparency entry: 2227834665
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@be1b4b03c78de2bec30d03265fcbd35605d2bd0e -
Branch / Tag:
refs/tags/superred-optimizer-poisonedrag-v0.1.0 - Owner: https://github.com/RoldSI
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@be1b4b03c78de2bec30d03265fcbd35605d2bd0e -
Trigger Event:
push
-
Statement type: