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.
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_dra-0.1.0.tar.gz.
File metadata
- Download URL: superred_optimizer_dra-0.1.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d90b143dc49fd5c5c93a4d8927b59b670b38c279565ddfda6ad39e28beaf006
|
|
| MD5 |
70410a97e1e25f3b2d31f99e3ea5c752
|
|
| BLAKE2b-256 |
8cd434e1400f1c603e5e8ae8681685e900c0b0f898fabbdf2cae6b3579b57791
|
Provenance
The following attestation bundles were made for superred_optimizer_dra-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_dra-0.1.0.tar.gz -
Subject digest:
4d90b143dc49fd5c5c93a4d8927b59b670b38c279565ddfda6ad39e28beaf006 - Sigstore transparency entry: 2227817005
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@be1b4b03c78de2bec30d03265fcbd35605d2bd0e -
Branch / Tag:
refs/tags/superred-optimizer-dra-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_dra-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superred_optimizer_dra-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.2 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 |
3165dfcc5f5ea38c4dd43f442f392ede17356cc20ba5ed7731f0b4445e7fc6da
|
|
| MD5 |
2ce22e820781cd4397b6f66551fe0ac9
|
|
| BLAKE2b-256 |
37d9f5674c12f9428b8ced2f3cf0e5b2df2b11d9488c6f96f2b91909fa11322c
|
Provenance
The following attestation bundles were made for superred_optimizer_dra-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_dra-0.1.0-py3-none-any.whl -
Subject digest:
3165dfcc5f5ea38c4dd43f442f392ede17356cc20ba5ed7731f0b4445e7fc6da - Sigstore transparency entry: 2227817376
- Sigstore integration time:
-
Permalink:
RoldSI/superred-modules@be1b4b03c78de2bec30d03265fcbd35605d2bd0e -
Branch / Tag:
refs/tags/superred-optimizer-dra-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: