Many-shot jailbreaking is a prompt-injection technique that places a fabricated human–assistant dialogue, containing harmful answers, before a final malicious request. Larger context windows make it possible to include many such examples and pressure the model toward unsafe behavior. section 13.2.1
Figure 13.8 Many-shot jailbreaking
Inspect the supplied illustration of a fabricated dialogue followed by a final question. section 13.2.1
Apply defensive controls around models exposed to this attack:
- Validate and sanitize model responses before passing them to backend functions. section 13.2.1
- Encode model output returned to users to reduce unintended code execution, including JavaScript execution. section 13.2.1
