The LMVD-ID is an internal research identifier, not an official CVE identifier.
In-Context LLM Jailbreak
Large Language Models (LLMs) are vulnerable to In-Context Attacks (ICA) and susceptible to mitigation via In-Context Defense (ICD). ICA leverages a small number of harmful demonstration examples within a prompt to…
Paper-evaluated models(7)
GPT-4 0613, Llama 2 7B Chat, Mistral-7B-v2 +4 more
- GPT-4 0613
- Llama 2 7B Chat
- Mistral-7B-v2
- Mixtral 8x7B
- Qwen-7B-v2
- Vicuna 13B v1.5
- Vicuna 7B v1.5
Description
Large Language Models (LLMs) are vulnerable to In-Context Attacks (ICA) and susceptible to mitigation via In-Context Defense (ICD). ICA leverages a small number of harmful demonstration examples within a prompt to elicit harmful responses from the LLM, even if it is otherwise safety-aligned. ICD counteracts ICA by prepending safe demonstration examples to the prompt, effectively reducing the likelihood of harmful output. The effectiveness of both ICA and ICD is demonstrated across multiple LLMs.
Examples
-
ICA: A prompt containing several examples of the model generating violent content, followed by a seemingly innocuous request, will trigger the generation of violent content. See arXiv:2310.06387 (opens in a new tab) for specific examples used in the research.
-
ICD: Prepending a small number (1-2 shots) of examples where the LLM refuses to answer harmful prompts to a malicious prompt can reduce or eliminate harmful responses. See arXiv:2310.06387 (opens in a new tab) for specific examples used in the research.
Impact
Successful ICA can lead to the generation of harmful content (e.g., hate speech, instructions for illegal activities, personally identifiable information) by an LLM, bypassing existing safety mitigations. The impact depends on the LLM and the specific context; it could range from minor inconvenience to potentially serious harm (e.g., incitement to violence, spreading misinformation). ICD can significantly reduce this risk but may not be entirely effective against sophisticated attacks.
Affected Systems
Various LLMs, including open-source models (Vicuna, Llama 2, QWen) and closed-source models (GPT-4), are susceptible to this vulnerability. The specific vulnerability varies across models.
Mitigation Steps
- Improved prompt engineering: Develop robust methods to detect and filter malicious prompts attempting to leverage ICA.
- Enhanced model training: Incorporate adversarial training during the model's development to improve resistance to ICA.
- In-Context Defense (ICD) implementation: Implement ICD by proactively prepending safe examples to all user prompts to mitigate potentially harmful requests. The number of safe examples necessary depends largely on the model's resilience and the sophistication of the attack.
- Regular security audits: Conduct periodic red-teaming exercises to identify and address weaknesses in LLM safety mechanisms.
Research context and confidence
- Evidence and verification
- Paper-reported; independent reproduction is not documented.
- Primary research source linked.
- Severity
- Not rated by this catalog.
- Source and publication type
- arXiv · Research preprint.
- Peer-review status is not provided by this source.
- Author and publication status
- Author metadata is not stored; see the primary paper.
- Threat model and attacker access
- Black-box model, service, or application access.
- Related deployment categories
- No related deployment category is classified.
- Taxonomy labels only; paper-specific deployment prerequisites are not inferred.
- Affected systems
- Various LLMs, including open-source models (Vicuna, Llama 2, QWen) and closed-source models (GPT-4), are susceptible to this vulnerability. The specific vulnerability varies across models.
Research Paper
Jailbreak and guard aligned language models with only few in-context demonstrations
Primary source: arXiv. Findings are reported by the cited research and have not been independently verified.
View PaperEvidence
This entry is based on a primary research source. Its findings are paper-reported; independent reproduction and verification are not claimed.
https://arxiv.org/abs/2310.06387Related research
- Academic Paper Trust Jailbreak
Published July 1, 2025 · model-layer, prompt-layer, injection
- Contextual Adversarial Prompts
Published December 1, 2024 · prompt-layer, injection, jailbreak
- Attack LLMs with Toxic Answers
Published August 1, 2024 · model-layer, prompt-layer, injection