Skip to main content

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

superred_optimizer_poisonedrag-0.1.0.tar.gz (124.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl (119.6 kB view details)

Uploaded Python 3

File details

Details for the file superred_optimizer_poisonedrag-0.1.0.tar.gz.

File metadata

File hashes

Hashes for superred_optimizer_poisonedrag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 654abd7130f76c40c33af01f6445d0421fdecd030bb1769ac4cefa427e99c1ff
MD5 56fea6e8033e233c51fe43f65f29d4bb
BLAKE2b-256 d37f78ff8475d2f0e72cdfb6c3782248eee62dcaaefcbd73d9faa43344182f42

See more details on using hashes here.

Provenance

The following attestation bundles were made for superred_optimizer_poisonedrag-0.1.0.tar.gz:

Publisher: release.yml on RoldSI/superred-modules

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for superred_optimizer_poisonedrag-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a210296aabd8fb19b02149a85be40bb3a1c9fe7debc0ebcf6d8b597040671fdd
MD5 9c4888590be7a031f5d3aea9fd6df3e7
BLAKE2b-256 aed44dfc84b97a9ed0ff8ed7478be4167c579a2238d35dc6efd09a8f2d36ba87

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page