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.
Metadata
Release files for superred-optimizer-poisonedrag 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| superred_optimizer_poisonedrag-0.1.0.tar.gz | 124.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 243.7 kB
Release files / superred_optimizer_poisonedrag-0.1.0.tar.gz
| Download URL | superred_optimizer_poisonedrag-0.1.0.tar.gz |
|---|---|
| Size | 124.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
654abd7130f76c40c33af01f6445d0421fdecd030bb1769ac4cefa427e99c1ff
|
|
BLAKE2b-256 checksum How to use checksums |
d37f78ff8475d2f0e72cdfb6c3782248eee62dcaaefcbd73d9faa43344182f42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.
Transparency logRelease files / superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl
| Download URL | superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl |
|---|---|
| Size | 119.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a210296aabd8fb19b02149a85be40bb3a1c9fe7debc0ebcf6d8b597040671fdd
|
|
BLAKE2b-256 checksum How to use checksums |
aed44dfc84b97a9ed0ff8ed7478be4167c579a2238d35dc6efd09a8f2d36ba87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.
Transparency logSecurity for superred-optimizer-poisonedrag 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for superred_optimizer_poisonedrag-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.