LLM and Multimodal Adversarial Attacks
LLM に対する adversarial attack は、画像分類のような微小 perturbation だけでは説明できません。入力は離散 token であり、system prompt、tool、RAG context、memory、画像入力など複数の channel を通じて model behavior が変わります。
攻撃の分類
| 攻撃 | 内容 |
|---|---|
| Jailbreak | safety policy を回避して禁止された出力を引き出す |
| Direct prompt injection | user prompt 内で system instruction を上書きしようとする |
| Indirect prompt injection | web page、document、email など外部 data に悪意ある instruction を埋める |
| Adversarial suffix | 最適化された token suffix で unsafe behavior を誘導する |
| RAG poisoning | retrieval corpus に悪意ある文書を混ぜる |
| Tool misuse | agent の tool call を誘導し、外部副作用や data exfiltration を起こす |
| Multimodal injection | 画像や PDF 内の text / pattern で VLM を誘導する |
Jailbreak の目的関数
LLM 、prompt 、追加 suffix 、target behavior を考えます。Adversarial suffix search は、概念的には次の最適化として書けます。
ここで は vocabulary、 は suffix length、 は target behavior を誘導する score です。Token は離散なので、画像のように連続 gradient step を直接使えません。GCG のような方法では、one-hot token embedding に対する gradient を使い、候補 token を coordinate descent 的に入れ替えます。
Prompt injection
Prompt injection は、LLM application の instruction hierarchy を混乱させる攻撃です。特に agent / RAG system では、model が「信頼すべき system instruction」と「外部文書に書かれた未信頼 text」を同じ context window の中で処理するため、境界が曖昧になります。
Indirect prompt injection では、攻撃者が web page や document に instruction を埋め、RAG や browsing agent がそれを取得したときに model behavior を変えます。
RAG poisoning
RAG poisoning は、retrieval corpus に攻撃文書を入れ、検索結果として model context に入るようにする攻撃です。攻撃者の目的は、間違った回答、特定 product への誘導、秘密情報の漏洩、tool misuse などです。
評価では、retrieval success と generation success を分けます。
Multimodal adversarial attack
VLM では、画像内の text、QR code、微小 perturbation、patch などが model behavior に影響します。たとえば、画像中に instruction-like text を埋めると、model がそれを user instruction と誤認する場合があります。
画像分類の adversarial patch と LLM prompt injection が結びつくため、multimodal system では modality boundary を明示する必要があります。
Agent tool misuse
LLM agent では、出力が text だけでなく tool call になります。攻撃者は、model に不適切な API call、file access、email sending、browser action を実行させようとします。これは prompt injection と access control の問題が結合したものです。
防御方針
| 方針 | 内容 |
|---|---|
| Instruction hierarchy | system / developer / user / tool / retrieved data の優先順位を明確化する |
| Untrusted data isolation | retrieved text を instruction ではなく data として扱う |
| Tool sandbox | tool の権限を最小化し、危険操作には承認を要求する |
| Output validation | tool call schema、allowlist、policy checker を使う |
| RAG filtering | source trust、metadata、retrieval score、poison detection を使う |
| Red teaming | jailbreak / prompt injection benchmark で継続評価する |
評価の注意
- 攻撃 prompt を固定 list だけで評価すると過学習します。
- Judge model による自動評価は便利ですが、judge 自体も攻撃されます。
- Agent では unsafe text だけでなく、実際の tool side effect を評価する必要があります。
- 防御を知った adaptive prompt injection で評価します。
数式で見る jailbreak objective
LLM jailbreak は、model が拒否すべき出力 の確率を高める prompt を探す問題として書けます。
ここで、 は攻撃者が許される prompt 変換の集合です。Gradient が使える surrogate model では、suffix token 列 を最適化します。
この式の気持ちは、「安全方針を破るような出力に向けて、prompt や suffix を探索する」というものです。
Multimodal jailbreak では、画像 patch を最適化して harmful response を誘導することもあります。
この場合、text safety だけでなく visual encoder と cross-modal alignment も attack surface になります。
関連ページ
- Retrieval-Augmented Generation
- AI Agents Overview
- Tool Use and Function Calling
- Reward Hacking and Alignment Failures
- Robustness Evaluation
主なソース
- Universal and Transferable Adversarial Attacks on Aligned Language Models: https://arxiv.org/abs/2307.15043
- Prompt Injection attack against LLM-integrated Applications: https://arxiv.org/abs/2306.05499
- Not what you've signed up for: Compromising Real-World LLM-Integrated Applications with Indirect Prompt Injection: https://arxiv.org/abs/2302.12173
- OWASP Top 10 for LLM Applications: https://owasp.org/www-project-top-10-for-large-language-model-applications/
- Visual Adversarial Examples Jailbreak Aligned Large Language Models: https://arxiv.org/abs/2306.13213