Files
Sec-Interview/_book/Chapter7/7-18.md
T
2025-11-08 21:00:06 +08:00

7 lines
467 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
### XXE 防御方法
**通用防御思路**
- **禁用外部实体(External Entities)**:这是最根本的防御措施。确保你的 XML 解析器不会去解析 `<!DOCTYPE>` 中定义的外部实体
- **禁用 DTDDocument Type Definition**:如果业务逻辑不需要 DTD,直接禁用它能彻底解决 XXE 问题
- **使用最新版本的解析库**:新的 XML 解析库通常会默认禁用 XXE 相关功能,或提供更安全的配置选项