18.2 Jailbreaking & Defense
Jailbreak는 model이 의도한 행동 policy를 위반하게 만드는 input 전략입니다. Pre-training이 alignment를 “압도한다”고 설명하는 것은 정확하지 않으며, model이 수학적으로 compliance를 강요받는 것도 아닙니다. 관찰된 실패는 학습된 instruction-following, context adaptation, tokenization, safety-classifier blind spot과 그 상호작용에서 생길 수 있습니다.
Security engineering은 boundary를 정하는 데서 시작합니다. Chat model이 금지된 text를 출력하는 것, agent가 허가되지 않은 tool을 실행하는 것, retrieval system이 비밀 문서를 노출하는 것은 impact와 방어법이 다른 실패입니다.
1. Jailbreak인가 Prompt Injection인가
- Jailbreak: 공격자가 model의 safety behavior를 자신을 향해 바꾸려 합니다. 예를 들어 policy상 거부해야 할 내용을 생성하게 만듭니다.
- Prompt injection: web page, email, retrieved document, tool output 같은 신뢰하지 않는 data의 instruction이 application instruction과 경쟁합니다. 목표가 data exfiltration이나 unauthorized action일 수 있습니다.
둘은 결합될 수 있습니다. Document의 injection이 model-level refusal을 약화시키는 jailbreak를 호출할 수 있습니다. 따라서 model alignment가 개선되어도 application은 authorization을 model 밖에서 집행해야 합니다.
2. 먼저 Threat Model을 쓴다
재현 가능한 평가는 다음을 명시합니다.
- Adversary access: black-box/white-box, query·token·시간 budget, prompt/classifier/model version에 대한 지식
- Interaction: single-turn/multi-turn, text·image·audio·file·retrieval·tool output
- Authority: application이 노출하는 tool, credential, document, network destination
- Success unit: unsafe completion, 충분한 정보를 담은 policy violation, unauthorized action, secret disclosure, turn 간 persistence
- Evaluator: 정확한 policy version, classifier 또는 human rubric, refusal·partial compliance·grader disagreement 처리
이 정보가 없으면 두 attack-success rate는 대체로 비교할 수 없습니다. JailbreakBench는 threat model, chat template, system prompt, scoring을 표준화하기 위해 제안되었습니다 [4].
3. 대표적인 Attack Family
Many-shot context attack
Many-shot jailbreaking은 target request 앞에 바람직하지 않은 행동의 demonstration을 많이 배치합니다. Anil et al.은 수백 개까지의 demonstration을 시험했고 평가한 환경에서 power-law 형태의 scaling을 보고했습니다 [1]. 모든 model, policy, context length에서 attack success가 단조 증가한다는 정리는 아닙니다. Prompt 구성, model family, target behavior, mitigation이 모두 영향을 줍니다.
가능한 mechanism은 in-context learning과 연결됩니다. Demonstration이 model이 이어 쓸 conditional distribution을 바꿉니다. Output behavior만으로 학습된 policy 요소와 인과 기여를 분리할 수 없으므로 “example이 RLHF를 완전히 override한다”는 표현은 지나칩니다.
Obfuscation과 Representation Mismatch
Encoding, 특이한 orthography, low-resource language, multimodal transformation은 capability model과 safety classifier 사이의 해석 차이를 드러낼 수 있습니다. 실무 질문은 “filter가 Base64를 아는가?”가 아닙니다. 허용하는 모든 representation을 정상 content를 파괴하지 않으면서 일관되게 normalize, interpret, policy-check할 수 있는가입니다. 과도한 canonicalization 자체가 ambiguity나 denial-of-service 위험을 만들 수 있습니다.
Multi-turn Adaptation
공격자는 intent를 여러 turn에 나누고, 정상적인 context를 쌓고, refusal에 맞춰 전술을 바꿀 수 있습니다. Li et al.은 automated single-turn 평가에서 강해 보인 defense를 상대로 human multi-turn attack이 높은 성공률을 보인 사례를 보고했습니다 [5]. 모든 deployment로 자동 일반화되는 결과는 아니지만, message별 filter만으로 conversation 전체를 방어하기 어렵다는 점을 보여줍니다.
4. Structured Role은 Sandbox가 아니다
System, developer, user, tool role은 chat model에 provenance와 priority signal을 줍니다. Operating-system security boundary를 만들지는 않습니다. 모든 role content는 결국 model input이며, model이 낮은 우선순위 또는 인용된 instruction을 잘못 따를 수 있습니다.
Instruction-hierarchy training은 privileged instruction을 우선하고 충돌하는 lower-privilege content를 무시하도록 model을 명시적으로 학습합니다. Wallace et al.은 평가한 GPT-3.5 설정에서 robustness 향상을 보고했습니다 [3]. 견고한 hierarchy도 bank transfer를 승인하거나 database credential을 보호하지는 못합니다. 그 작업은 deterministic policy layer가 중재해야 합니다.
5. Defense in Depth
5.1 Blast Radius 줄이기
가장 강한 control은 model의 실수 하나로 harm이 완성되지 않게 만드는 것입니다.
- Request마다 short-lived, least-privilege credential 발급
- General shell/browser/database session 대신 좁은 tool 노출
- Destination, method, argument, amount, tenant, data classification을 model 밖에서 검증
- High-impact action에 user confirmation 또는 second principal 요구
- Prompt와 retrieved context에서 secret을 제거하고 가능하면 opaque handle 반환
- Tool execution 격리, runtime/output 제한, retry idempotency 보장
5.2 Model Behavior 개선
Adversarial training, instruction hierarchy, refusal training, policy-specific fine-tuning은 model이 금지된 action을 제안할 확률을 낮출 수 있습니다. Artifact contract에는 base model, tokenizer, chat template, system policy, safety adapter, generation setting, tool schema가 포함됩니다. 하나가 바뀌면 평가 일부가 무효가 됩니다.
5.3 Input과 Output 분류
Input classifier는 알려진 attack pattern을 막고 output classifier는 생성 뒤 policy violation을 찾습니다. Cascade는 score calibration, threshold, latency, false positive, failure behavior를 드러내야 합니다. Classifier timeout에서 allow와 deny는 availability와 safety 효과가 다르므로 action class별로 명시적으로 선택합니다.
5.4 Randomized Smoothing
SmoothLLM은 perturbation 개 를 sampling하고 model을 실행한 뒤 각 output을 판정 로 바꾸어 집계합니다.
는 perturbation strength, 는 validation data에서 고른 aggregation threshold이며 보편적인 0.5가 아닙니다. 논문은 adaptive GCG 설정을 포함한 여러 평가 attack에서 robustness와 작지만 0이 아닌 nominal-performance trade-off를 보고했습니다 [2].
이 defense는 문자 변화에 취약한 adversarial prompt에 특히 근거를 둡니다. Semantic, multilingual, multi-turn, adaptive attack이 같은 brittleness를 갖는다고 보장할 수 없습니다. Model call 수도 늘리고 code, identifier, non-English text를 손상할 수 있습니다.
Perturbation sampling 설명기
Model을 호출하거나 safety를 판정하지 않습니다. Smoothing defense가 사용하는 randomized input transformation만 보여줍니다.
결정적인 예시 perturbation 5개
Summarize the qttached project nottsj + [qxz!w7%tkn]Summarize &he attached project aotes. + [qxz!v7%$kn]Summarize the attache& project notes. + [qxz!v7%tkn]oummarizf the attached project notes. + [qxz!v7%thn]Sfmmarize tre attached prolect note7. + [qxz4v7%1kn]Interactive는 perturbation sampling만 보여줍니다. Model이 comply 또는 refuse할 것이라는 판정을 의도적으로 하지 않습니다.
5.5 Activation Intervention
Representation engineering은 행동과 관련된 activation direction을 추정해 hidden state를 monitor하거나 steer할 수 있습니다 [6]. 이는 model-specific intervention이지 hardware가 집행하는 boundary가 아닙니다. Direction discovery가 correlated feature를 집을 수 있고, steering이 정상 capability를 낮추거나 activation을 분포 밖으로 옮길 수 있으며, model revision 뒤 실패할 수 있습니다. Matched-vector control, held-out attack, benign capability slice, model-version pinning을 갖춘 실험적 defense signal로 다뤄야 합니다.
6. Defense 측정
개 attack conversation에 대한 conversation-level attack success는
로 측정할 수 있습니다. Conversation 의 어느 turn이라도 success rubric을 충족하면 , 아니면 0입니다. 분자·분모, uncertainty, attack/query budget, judge disagreement를 함께 보고합니다.
- Attack family, language, modality, policy category, turn 수별 ASR
- 대응되는 legitimate request에서 benign refusal과 task-completion rate
- Tool-action authorization failure와 secret-exposure rate
- p50/p95 latency, classifier·추가 generation 비용, availability
- 고정 attack 결과와 공격자가 defense를 아는 adaptive evaluation을 분리
- Held-out model, template, policy, attack author로의 transfer
ASR만 최적화하면 안 됩니다. 모든 요청을 거부하는 defense는 ASR이 낮지만 제품 utility도 없습니다. 반대로 fluent하고 “안전해 보이는” text가 attack rubric을 충족할 만큼 충분한 정보를 담을 수 있으므로 refusal string matching만으로 judge를 만들 수 없습니다.
7. Release, Monitoring, Recovery
배포 전에 gate를 정합니다. 예를 들어 critical slice 어디에서도 통계적으로 신뢰할 수 있는 ASR regression이 없어야 하고, benign completion은 paired margin 안에 있어야 하며, p95 latency와 비용은 budget 안에 있어야 합니다. Release set에서는 unauthorized high-impact tool action이 없어야 합니다. 평균으로 가리지 말고 sample size와 uncertainty를 정당화합니다.
Production에는 privacy를 최소 침해하면서 재구성 가능한 event를 남깁니다. Artifact/policy version, conversation/request ID, classifier score, tool proposal, policy decision, outcome category가 필요합니다. Retention rule에 따라 민감한 content는 hash 또는 redact합니다. 반복 probe를 rate limit하고 단일 prompt뿐 아니라 분산 campaign도 관찰합니다.
Last-known-good bundle과 high-risk tool kill switch를 준비합니다. Credential revoke, tool disable, classifier threshold 강화, model/prompt bundle 전환, quarantine trace replay를 연습합니다. Rehearsal하지 않은 rollback은 문서에 불과합니다.
8. 핵심 정리
Jailbreak defense는 완벽한 prompt 하나를 찾는 경연이 아닙니다. Model은 위험 확률을 낮추고, application은 authority를 제한하며, classifier와 monitor는 detection을 보강하고, 평가는 선언한 adversary 아래의 residual failure를 추정합니다. 안전한 설계는 model-level defense가 실패할 수 있다고 가정하고 그 실패가 되돌릴 수 없는 action이 되지 않게 합니다.
Quizzes
Quiz 1: Structured system role이 security sandbox와 같지 않은 이유는 무엇인가요?
학습된 model에 provenance와 priority를 제공할 뿐 authorization을 집행하지 않습니다. Data와 tool access는 deterministic application control이 중재해야 합니다.
Quiz 2: ASR 값이 해석 가능하려면 어떤 정보가 함께 있어야 하나요?
Threat model, attack/query budget, chat template와 policy, success rubric과 judge, interaction unit, denominator, uncertainty, artifact date/version이 필요합니다.
Quiz 3: SmoothLLM이 한 attack family에는 효과가 있고 다른 family에는 실패할 수 있는 이유는 무엇인가요?
선택한 perturbation distribution에서 attack이 brittle하다는 조건에 의존하기 때문입니다. Semantic/adaptive attack은 intent를 유지할 수 있고 perturbation은 정상 input을 손상할 수 있습니다.
Quiz 4: High-impact tool authorization을 model 밖에 둬야 하는 이유는 무엇인가요?
Model proposal은 확률적이며 injection이나 jailbreak에 취약합니다. Policy engine은 principal, scope, argument, confirmation 요구를 deterministic하게 묶을 수 있습니다.
Quiz 5: Multi-turn attack을 conversation 수준에서 평가해야 하는 이유는 무엇인가요?
Intent와 유해한 진행이 여러 turn에 누적될 수 있습니다. Message별 success rate는 적응 뒤에만 policy boundary를 넘는 conversation을 놓칠 수 있습니다.
References
- Anil, C., et al. (2024). Many-shot Jailbreaking. NeurIPS 2024 proceedings.
- Robey, A., Wong, E., Hassani, H., & Pappas, G. J. (2023; revised 2024). SmoothLLM: Defending Large Language Models Against Jailbreaking Attacks. arXiv:2310.03684.
- Wallace, E., et al. (2024). The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions. arXiv:2404.13208.
- Chao, P., et al. (2024). JailbreakBench: An Open Robustness Benchmark for Jailbreaking Large Language Models. arXiv:2404.01318.
- Li, N., et al. (2024). LLM Defenses Are Not Robust to Multi-Turn Human Jailbreaks Yet. arXiv:2408.15221.
- Zou, A., et al. (2023). Representation Engineering: A Top-Down Approach to AI Transparency. arXiv:2310.01405.