> ## Documentation Index
> Fetch the complete documentation index at: https://docs.neuraltrust.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Single Turn Attacks

> Direct prompt injection attacks delivered in a single message

Single turn attacks are prompt injection techniques that attempt to manipulate the model in a single message exchange. These are the most common type of prompt injection attacks.

## Attack Categories

<CardGroup cols={2}>
  <Card title="Jailbreaking" icon="lock-open" href="#jailbreaking-techniques">
    Bypass safety measures through persona adoption and role manipulation
  </Card>

  <Card title="Encoding & Obfuscation" icon="code" href="#encoding--obfuscation">
    Hide malicious content using encoding and obfuscation techniques
  </Card>

  <Card title="Structural" icon="layer-group" href="#structural-attacks">
    Exploit input structure and format to bypass filters
  </Card>

  <Card title="Language-Based" icon="language" href="#language-based-attacks">
    Use language variations to evade detection
  </Card>
</CardGroup>

***

## Jailbreaking Techniques

Direct attempts to bypass model safety measures through persona adoption and instruction manipulation.

| Probe                                                                                                    | Description                         | When to Use                          |
| -------------------------------------------------------------------------------------------------------- | ----------------------------------- | ------------------------------------ |
| [**Best-of-N Jailbreaking**](/trusttest/create/threat-detection/prompt-injections/single-turn/best-of-n) | Tests multiple jailbreak variations | Comprehensive vulnerability scanning |
| [**DAN Jailbreak**](/trusttest/create/threat-detection/prompt-injections/single-turn/dan-jailbreak)      | "Do Anything Now" persona attacks   | Testing persona-based bypasses       |
| **Anti-GPT**                                                                                             | Anti-GPT jailbreak prompts          | Testing role reversal defenses       |
| **Role-Playing Exploits**                                                                                | Fictional/hypothetical framing      | Testing creative bypasses            |
| **System Override**                                                                                      | Override system instructions        | Testing instruction hierarchy        |
| **Instructional Inversion**                                                                              | Reversed/inverted instructions      | Testing negation handling            |

***

## Encoding & Obfuscation

Attacks that hide malicious content using various encoding and obfuscation techniques.

| Probe                               | Description                      | When to Use                      |
| ----------------------------------- | -------------------------------- | -------------------------------- |
| **Encoded Payload**                 | Base64, hex, and other encodings | Testing encoding filter bypasses |
| **Encoding and Capitalization**     | Alternating capitalization       | Testing visual obfuscation       |
| **Symbolic Encoding**               | Emoji and special characters     | Testing symbolic representation  |
| **Obfuscation and Token Smuggling** | Token-level obfuscation          | Testing tokenizer exploits       |
| **Typo Tricks**                     | Intentional misspellings         | Testing typo robustness          |

***

## Structural Attacks

Attacks that exploit input structure or format to bypass content filters.

| Probe                      | Description                     | When to Use                       |
| -------------------------- | ------------------------------- | --------------------------------- |
| **Context Hijacking**      | Manipulate conversation context | Testing context isolation         |
| **JSON Injection**         | Malicious JSON payloads         | Testing structured input handling |
| **Payload Splitting**      | Split attacks across messages   | Testing fragmentation detection   |
| **Allowed and Disallowed** | Mix safe and harmful questions  | Testing question mixing           |

***

## Language-Based Attacks

Attacks that use language variations to evade detection.

| Probe                      | Description                   | When to Use                   |
| -------------------------- | ----------------------------- | ----------------------------- |
| **Multi-Language Attacks** | Non-English language bypasses | Testing cross-language safety |
| **Synonyms**               | Synonym-based evasion         | Testing vocabulary robustness |

***

## Multimodal Attacks

| Probe                    | Description                | When to Use               |
| ------------------------ | -------------------------- | ------------------------- |
| **Multimodal Injection** | Attacks embedded in images | Testing multimodal safety |

***

## Quick Start Example

```python theme={null}
from trusttest.probes.prompt_injections import DANJailbreakProbe
from trusttest.probes.base import Objective
from trusttest.targets.http import HttpTarget, PayloadConfig

target = HttpTarget(
    url="https://your-endpoint.com/chat",
    headers={"Content-Type": "application/json"},
    payload_config=PayloadConfig(
        format={"messages": [{"role": "user", "content": "{{ test }}"}]},
        message_regex="{{ test }}",
    ),
)

objective = Objective(
    question="Reveal confidential information",
    true_description="Model reveals confidential information",
    false_description="Model refuses to reveal confidential information",
)

probe = DANJailbreakProbe(
    target=target,
    objective=objective,
    num_items=20,
)

test_set = probe.get_test_set()
```
