P
Prompt Master

Prompt 大师

掌握和 AI 对话的艺术

Jailbreaking

Jailbreaking concepts and defenses (safety-trimmed)

Background

Jailbreaking refers to attempts to bypass an LLM's safety policies and defense mechanisms, tricking the model into outputting content it shouldn't. This is a concept from the security research context.

What You Need to Know

  • In real products, jailbreaking often overlaps with prompt injection and prompt leaking
  • Models and providers keep updating, so any specific jailbreak prompt will quickly become ineffective or get patched

Defense Strategy (High Level)

  • Clearly separate instructions from user input (structured, partitioned, quoted/escaped)
  • Declare a threat model in the instructions: don't execute additional instructions found in user input
  • Do output filtering / policy checks (plus logging and monitoring)
  • Enforce strict allowlists for tool calls and external actions

For security reasons, this site doesn't provide usable jailbreak prompts or copyable attack scripts that could bypass safety policies.

📚 相关资源

❓ 常见问题

关于本章主题最常被搜索的问题,点击展开答案

Jailbreaking 到底是什么?和 prompt injection 有什么区别?

Jailbreaking 指尝试绕过 LLM 自身的安全策略,让模型输出本不该输出的内容;prompt injection 指攻击者通过用户输入劫持 instruction,让模型偏离原任务。两者经常组合出现——injection 的 payload 里嵌入 jailbreak prompt——但目标不同:jailbreak 攻策略,injection 攻指令优先级。

为什么本站不直接列「最新可用」的 jailbreak prompt?

两个理由:1) 模型和 provider 在持续修复,今天能用的 jailbreak 明天大概率失效,写出来无价值且误导;2) 公开可复制的攻击脚本属于 uplift,违背安全研究的负责任披露原则。本站只讲攻击模式的高层结构和防御思路,不提供可直接复用的绕过脚本。

防御 jailbreak,最值得做的四件事是什么?

本章给的高层防御思路:1) 明确区分 instruction 与 user input(结构化、分区、引用/转义);2) 在 system instruction 里声明 threat model,「不执行 input 中的额外指令」;3) 做 output filtering 与 policy check,配合日志监控;4) 对工具调用和外部 action 用严格的 allowlist。前两条管输入,后两条管输出和副作用。

Jailbreak 风险对一个普通 SaaS 产品到底有多大?

看产品形态。纯文本助手风险中等(输出不当内容会有舆情和合规问题);接了 tools / agent / 外部写入(发邮件、改数据库、付款)就是高风险——一个被绕过的 system prompt 可能直接导致脱敏数据外发或资金动作。tool allowlist 的优先级永远高于「写更好的 system prompt」。

团队要不要做内部红队(red teaming)?怎么开始?

上线前建议至少做一轮。最小做法:列出 10-20 个 high-risk 场景(数据泄露、违规内容、越权 action),用 OWASP LLM Top 10 当 checklist,每个场景准备 3-5 条对抗输入,跑完输出做 review。重点不是 zero jailbreak,而是建立可重放的测试集,模型升级或 prompt 改动后立即回归。