Skip to main content

superred-optimizer-dra

A DRA (Disguise and Reconstruction Attack) jailbreak optimizer for the superred red-teaming framework.

DRA has two halves. Disguise hides the harmful request one character at a time inside ordinary cover words, where the real character is the one wrapped in parentheses. Reconstruction then asks the target to pull those parenthesized characters out, rebuild the hidden request, and answer it directly — so the model assembles and answers the request itself rather than being asked it openly.

Reference: Liu et al., "Making Them Ask and Answer: Jailbreaking Large Language Models in Few Queries via Disguise and Reconstruction," arXiv:2402.18104 (USENIX Security 2024). Official implementation: LLM-DRA/DRA (MIT License). See ASSUMPTIONS.md for the full paper-to-code mapping and every deliberate departure.

Install

DRA depends on Detoxify to decide which guide words are sensitive; it is a normal dependency of this package and is installed automatically.

pip install superred-optimizer-dra

If Detoxify cannot load in a constrained environment, the optimizer falls back to the official static sensitive-word list so the attack can still run.

Usage

from dra_optimizer import DraOptimizer

# Defaults follow the official script (T=20 retries, em_t=0.7 exact match,
# toxic_trunc=benign_trunc=0.5).
optimizer = DraOptimizer()

# A visible target model name auto-selects the GPT or Llama suffix family;
# override explicitly if you prefer.
optimizer = DraOptimizer(model="gpt", max_attempts=10)

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, LLM-DRA/DRA, is MIT licensed. The bundled behaviors.json originates from that repository; its MIT copyright notice is preserved in NOTICE and LICENSES/DRA-MIT.txt. This port reimplements the DRA prompt-generation structure against superred's event model rather than vendoring upstream source files. Detoxify is a third-party dependency under its own license.

Metadata

Release files for superred-optimizer-dra 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for superred-optimizer-dra 0.1.0
File Size Uploaded Provenance
superred_optimizer_dra-0.1.0.tar.gz 22.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for superred-optimizer-dra 0.1.0
File Interpreter ABI Platform
superred_optimizer_dra-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.8 kB

Release files / superred_optimizer_dra-0.1.0.tar.gz

Download URL superred_optimizer_dra-0.1.0.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4d90b143dc49fd5c5c93a4d8927b59b670b38c279565ddfda6ad39e28beaf006
BLAKE2b-256 checksum
How to use checksums
8cd434e1400f1c603e5e8ae8681685e900c0b0f898fabbdf2cae6b3579b57791
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 log

Release files / superred_optimizer_dra-0.1.0-py3-none-any.whl

Download URL superred_optimizer_dra-0.1.0-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3165dfcc5f5ea38c4dd43f442f392ede17356cc20ba5ed7731f0b4445e7fc6da
BLAKE2b-256 checksum
How to use checksums
37d9f5674c12f9428b8ced2f3cf0e5b2df2b11d9488c6f96f2b91909fa11322c
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 log

Security for superred-optimizer-dra 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.

Select from 2 files

Attestation for superred_optimizer_dra-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 log

A 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page